# sidebar: Add debug action to dump multi-workspace state \(\#52785\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/3d29a0641e7f95b0581f60fa210ed3d23383a776)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 3d29a0641e7f95b0581f60fa210ed3d23383a776

Requested commit: 3d29a0641e7f95b0581f60fa210ed3d23383a776

Commit: 3d29a0641e7f95b0581f60fa210ed3d23383a776

Tree: db2c9ff5bcb7108bbb205f76b3496aace27d3c55

Author: Eric Holk

Committer: GitHub

## Message

````
sidebar: Add debug action to dump multi-workspace state (#52785)

Add a debug-only (`cfg(debug_assertions)`) action `DumpWorkspaceInfo`
that opens a read-only buffer with a dump of all workspace state. This
is useful for debugging the sidebar's view of workspaces and threads,
since the sidebar is currently the only way to see workspace-related
state.

For each workspace in the MultiWorkspace it shows:

- **Workspace DB ID** — for cross-referencing with persistence
- **All worktrees** with their paths, branches, and visibility
- **Whether each worktree is a git linked worktree** and where it links
to
- **Active agent thread** with title, session ID, status, and entry
count
- **Background agent threads** with the same detail
- **A warning** if the agent panel's workspace ID doesn't match the
workspace

Example output:
```
MultiWorkspace: 3 workspace(s)
Active workspace index: 1

--- Workspace 0 ---
Workspace DB ID: WorkspaceId(42)
Worktrees:
  - /Users/eric/repo/scratch3 [branch: refs/heads/scratch3] [linked worktree -> /Users/eric/repo/scratch]
Active thread: Git Worktree Path Consistency Check (session: 575b4349-...) [idle, 42 entries]

--- Workspace 1 (active) ---
Workspace DB ID: WorkspaceId(57)
Worktrees:
  - /Users/eric/repo/worktrees/zed/my-branch/zed [branch: refs/heads/my-branch] [linked worktree -> /Users/eric/repo/zed]
Active thread: Sidebar Not Displaying Git Worktree (session: 8f337c5c-...) [generating, 17 entries, awaiting confirmation]
Background threads (1):
  - Previous Investigation (session: abc12345-...) [idle, 83 entries]

--- Workspace 2 ---
Workspace DB ID: WorkspaceId(63)
Worktrees:
  - /Users/eric/repo/ex [branch: refs/heads/main]
Active thread: (none)
```

### Implementation

The action and handler live in the `sidebar` crate (close to what they
debug), following the same pattern as `language_tools` owning
`OpenLanguageServerLogs` and `debugger_tools` owning
`OpenDebugAdapterLogs`. The `zed` crate has only a one-line
registration.

Two small public accessors were added to `AgentPanel`:
- `workspace_id()` — exposes the panel's workspace ID for mismatch
detection
- `background_threads()` — exposes retained background conversation
views

Release Notes:

- N/A
````

## Parents

- [c9e45fe829019b99303c624ae7e82e866288b6d5](https://git.cafe/gitcafe/zed/commit/c9e45fe829019b99303c624ae7e82e866288b6d5?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/3d29a0641e7f95b0581f60fa210ed3d23383a776?format=markdown)
