Repository navigation
fix(sidebar): stop a workspace with a structured chat reading as asleep - #22098
Conversation
A workspace whose only surface is a structured native chat showed the sleeping moon, lost its pull-request glyph to it, and would vanish entirely under the hide-sleeping filter. hasActiveWorkspaceActivity asked three terminal-shaped questions: a tab in tabsByWorktree with a live PTY, a browser tab, or a fresh non-done agent-status row. A structured chat answers none of them. Its tab lives in unifiedTabsByWorktree, so the PTY term never sees it, and an idle session projects state 'done', which is exactly what isFreshNonDoneAgentStatus refuses. Both chats finishing their turn was enough to draw the moon. Add a fourth term keyed on the chat EXISTING. Not on a live provider child: that child is held only while the chat's pane is visible and is evicted 15s after it is not, so keying on it would flip the glyph on every worktree switch and report a process recycle the user never sees. The transcript, and the session's ability to take the next send, outlive the child. The term goes in the shared predicate, not the card, because the moon, the hide-sleeping filter and the Cmd+J palette all read it and must not disagree about which workspaces are asleep. Supporting moves, no behaviour change: the projection sits beside its siblings in visible-worktree-activity-inputs, and buildVisibleWorktreeOptionsFromState moves to its own module, which leaves the filter a pure function of its options and keeps both files under the 300-line cap without raising it.
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe change derives structured-chat worktree IDs from unified tabs. Workspace activity checks treat those worktrees as active, including after an agent turn reaches Priority: ➖ Normal 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description is detailed and covers the user impact, mechanism, rationale, testing, compatibility, and performance. However, it does not provide the required linked issue and does not attach the required before-and-after visual proof for this UI behavior change.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
ℹ️ Minor suggestions only. The fix is correct and well-covered; the notes below are optional.
Reviewed changes
- Structured-chat activity term.
hasActiveWorkspaceActivity/isInactiveWorkspacegain an optionalworktreeIdsWithStructuredChatset (defaulting to empty, so existing callers are unchanged), making a workspace with a native chat tab read as awake rather than asleep. - New lookup.
getWorktreeIdsWithStructuredChatderives the set fromunifiedTabsByWorktreevia the existinggetStructuredAgentSessionTabs, WeakMap-cached on the map snapshot. Presence, not the transient provider child, is the signal by design. - Threaded through every sleep consumer.
useIsSleepingWorktree,computeVisibleWorktrees/VisibleWorktreeOptions, the hide-sleeping reveal callback,useVisibleSidebarWorktrees, anduseWorktreeJumpPaletteWorktreesall pass the new set. - Refactor.
buildVisibleWorktreeOptionsFromStatemoved to its ownvisible-worktree-options-from-state.ts;visible-worktrees.tsre-exports the lookup for the palette import site. - Tests. Four cases added to the sleep-state suite: chat awake, chat with
donestatus awake, editor-tab control, cross-worktree control. I traced these against the predicate — each positive case fails without the new term, so they pin the fix.
ℹ️ Nitpicks
- The
matches isInactiveWorkspace across runtime shapescase list inuse-worktree-sleep-state.test.tsxstill has no structured-chat case. That test exists to keep the moon and the hide-sleeping filter from drifting, and structured chats are exactly the input that just changed, so adding a case there would close the one gap the direct assertions don't cover. visible-worktree-activity-inputs.tshas no direct unit test forgetWorktreeIdsWithStructuredChatalongside the sibling terminal/browser projection tests invisible-worktree-activity-inputs.test.ts; it's only exercised indirectly today. Not blocking.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Sidebar proofHidden Electron window on this branch ( Sleeping workspaces shown: Sleeping workspaces hidden: This repo has no linked pull request, so the awake lane shows the branch glyph rather than a review icon. The center pane did not paint a chat transcript; the tab was injected without a live session. The sidebar state is what the sleep check reads. |
|
Correction to the review-status comment above: the validation results are 87 focused tests passed, pnpm tc:web passed, changed-code quality passed with 0 findings, direct lint passed, and git diff --check passed. The previous comment was mangled by shell quoting; this is the authoritative status. Fixes are pushed in commit d6c908b. Electron CDP validation was completed in an isolated background instance, and the structured-chat workspace stayed visible with sleeping workspaces shown and hidden. Screenshots are attached in the preceding sidebar-proof comment. No unexpected user behavior remains in the reviewed scope. |
There was a problem hiding this comment.
✅ No new issues found. The follow-up commit closes the last gap and correctly addresses the prior review.
Reviewed changes
- Kanban board covered.
useVisibleWorkspaceKanbanWorktreeIdsnow threadsgetWorktreeIdsWithStructuredChatintocomputeVisibleWorktrees, closing the third visibility surface so a chat-only workspace no longer disappears from the board while sleeping workspaces are hidden. - Structured-chat selector gated. The sidebar list and Cmd+J palette selectors return the stable
EMPTY_STRUCTURED_CHAT_WORKTREE_IDSsentinel whileshowSleepingWorkspacesis true, so the visible-list memo stops re-keying on everyunifiedTabsByWorktreewrite — the prior review's inline thread. The corecomputeVisibleWorktreesonly reads the set insideif (!opts.showSleepingWorkspaces), so substituting the empty set there is safe. - Stable sentinel exported.
EMPTY_STRUCTURED_CHAT_WORKTREE_IDSis promoted to a module export onvisible-worktree-activity-inputs.tsand re-exported throughvisible-worktrees.tsfor the palette import site. - Tests. A kanban-board case asserts a chat-only workspace stays visible under hide-sleeping, and a sidebar-list case asserts no
computeVisibleWorktreesrescan for chat-tab writes while sleeping workspaces are shown. I traced both against the code: each fails without its change.
I re-checked every isInactiveWorkspace / hasActiveWorkspaceActivity call site: the sidebar list, Cmd+J palette, kanban board, and the reveal callback all either pass the real set or are guarded by !showSleepingWorkspaces. No remaining surface.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
CI follow-up: merged the latest origin/main and pushed b33a5e4. The prior static-analysis failure was the jump-palette file exceeding the 300-line limit; the structured-chat input/type logic is now split into focused modules. The new run is green for static analysis, typecheck, both packages, relay integration, all eight test shards, and the aggregate verify gate. Pullfrog remains pending. |
There was a problem hiding this comment.
ℹ️ No critical issues — one optional cleanup inline.
Reviewed changes
Reviewed the commits since the prior pullfrog review (d6c908bfbf): a merge of origin/main, then a refactor that keeps the jump-palette hook under the max-lines limit.
- Extracted the structured-chat gate.
getStructuredChatWorktreeIds(showSleepingWorkspaces, unifiedTabsByWorktree)now wraps theshowSleepingWorkspaces ? EMPTY : getWorktreeIdsWithStructuredChat(...)decision, and the three gated call sites delegate to it. - Extracted the palette input type.
WorktreeJumpPaletteWorktreesInputmoved to its ownworktree-jump-palette-worktrees-input.ts, bringinguse-worktree-jump-palette-worktrees.tsto 297 lines. - Repointed the palette import. The palette now imports the lookup from
visible-worktree-activity-inputsdirectly instead of through thevisible-worktrees.tsbarrel.
The refactor is behavior-preserving — I traced the helper against the inlined expressions it replaces. The three affected suites (18 tests), pnpm run typecheck:web, and check:code-quality:changed (0 findings) all pass.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| export { | ||
| EMPTY_STRUCTURED_CHAT_WORKTREE_IDS, | ||
| getWorktreeIdsWithStructuredChat | ||
| } from './visible-worktree-activity-inputs' |
There was a problem hiding this comment.
This re-export is now unused: the jump palette was its only consumer, and this commit switched it to importing getStructuredChatWorktreeIds from visible-worktree-activity-inputs directly. EMPTY_STRUCTURED_CHAT_WORKTREE_IDS and getWorktreeIdsWithStructuredChat have no other referrer anywhere in the repo, so the barrel can drop these two lines. Not blocking.
Technical details
# Remove the dead structured-chat re-export
## Affected sites
- `src/renderer/src/components/sidebar/visible-worktrees.ts:27-30` — `export { EMPTY_STRUCTURED_CHAT_WORKTREE_IDS, getWorktreeIdsWithStructuredChat } from './visible-worktree-activity-inputs'` has no importer.
- `src/renderer/src/components/use-worktree-jump-palette-worktrees.ts:8` — the former consumer now imports `getStructuredChatWorktreeIds` from `visible-worktree-activity-inputs` directly.
## Required outcome
- No module remains exporting the two symbols without a consumer.
## Suggested approach (optional)
- Delete lines 27-30; every remaining importer already reaches `visible-worktree-activity-inputs` directly.|
Review complete. Latest All required GitHub checks are green, including Pullfrog, package builds, typecheck, static analysis, relay integration, all test shards, aggregate verification, and repository guards. Focused tests, web typecheck, lint/quality checks, and Electron visual proof also passed. No remaining functional, performance, architecture, or scope issues were found in review. The PR is mergeable and ready to merge. |
|
Additional Electron validation completed in an isolated background instance with structured native chat enabled.
The branch remained clean after validation. |
|
Scope note: this native-chat run validates the live provider session, rendered chat transcript, and sidebar chat indicator. It does not replace the separate sleeping-workspace show/hide scenario; that earlier filter proof used a seeded structured-chat tab rather than a live provider session. |
Three files the 2026-09-22 rebase onto upstream `6ae5ef2d00` merged without a conflict marker, whose fixtures still describe the pre-sync shape: - `use-file-explorer-name-filter.test.ts` set `resolvedQuery` on a mocked listing. Upstream's stablyai#22173 (stale listings) deleted that field from `RuntimeFileListState` and moved the fencing into the hook, so the field no longer exists. Dropped it; the projection behaviour it stood for is unchanged. - `use-visible-worktrees.test.tsx` built a `filterState` for an upstream test added in stablyai#22098 without `hiddenWorkspaceStatusIds`, which our #23 made required. The other three literals in the file already carry it. - `AiVaultPanel.legacy-filter.test.tsx` enabled the vault search as `enabled`, the legacy name, in two tests upstream added. Our `3141d7578a` narrowed this mock's type to `contentEnabled`, which is the field the panel writes and the resolver reads first. Both tests still passed at runtime through the legacy fallback in `resolveAiVaultSearchSettings`, which is why only `pnpm tc` saw this. No production behaviour moves. `pnpm tc` is clean.
Three files the 2026-09-22 rebase onto upstream `6ae5ef2d00` merged without a conflict marker, whose fixtures still describe the pre-sync shape: - `use-file-explorer-name-filter.test.ts` set `resolvedQuery` on a mocked listing. Upstream's stablyai#22173 (stale listings) deleted that field from `RuntimeFileListState` and moved the fencing into the hook, so the field no longer exists. Dropped it; the projection behaviour it stood for is unchanged. - `use-visible-worktrees.test.tsx` built a `filterState` for an upstream test added in stablyai#22098 without `hiddenWorkspaceStatusIds`, which our #23 made required. The other three literals in the file already carry it. - `AiVaultPanel.legacy-filter.test.tsx` enabled the vault search as `enabled`, the legacy name, in two tests upstream added. Our `3141d7578a` narrowed this mock's type to `contentEnabled`, which is the field the panel writes and the resolver reads first. Both tests still passed at runtime through the legacy fallback in `resolveAiVaultSearchSettings`, which is why only `pnpm tc` saw this. No production behaviour moves. `pnpm tc` is clean.
Three files the 2026-09-22 rebase onto upstream `6ae5ef2d00` merged without a conflict marker, whose fixtures still describe the pre-sync shape: - `use-file-explorer-name-filter.test.ts` set `resolvedQuery` on a mocked listing. Upstream's stablyai#22173 (stale listings) deleted that field from `RuntimeFileListState` and moved the fencing into the hook, so the field no longer exists. Dropped it; the projection behaviour it stood for is unchanged. - `use-visible-worktrees.test.tsx` built a `filterState` for an upstream test added in stablyai#22098 without `hiddenWorkspaceStatusIds`, which our #23 made required. The other three literals in the file already carry it. - `AiVaultPanel.legacy-filter.test.tsx` enabled the vault search as `enabled`, the legacy name, in two tests upstream added. Our `3141d7578a` narrowed this mock's type to `contentEnabled`, which is the field the panel writes and the resolver reads first. Both tests still passed at runtime through the legacy fallback in `resolveAiVaultSearchSettings`, which is why only `pnpm tc` saw this. No production behaviour moves. `pnpm tc` is clean.
Three files the 2026-09-22 rebase onto upstream `6ae5ef2d00` merged without a conflict marker, whose fixtures still describe the pre-sync shape: - `use-file-explorer-name-filter.test.ts` set `resolvedQuery` on a mocked listing. Upstream's stablyai#22173 (stale listings) deleted that field from `RuntimeFileListState` and moved the fencing into the hook, so the field no longer exists. Dropped it; the projection behaviour it stood for is unchanged. - `use-visible-worktrees.test.tsx` built a `filterState` for an upstream test added in stablyai#22098 without `hiddenWorkspaceStatusIds`, which our #23 made required. The other three literals in the file already carry it. - `AiVaultPanel.legacy-filter.test.tsx` enabled the vault search as `enabled`, the legacy name, in two tests upstream added. Our `3141d7578a` narrowed this mock's type to `contentEnabled`, which is the field the panel writes and the resolver reads first. Both tests still passed at runtime through the legacy fallback in `resolveAiVaultSearchSettings`, which is why only `pnpm tc` saw this. No production behaviour moves. `pnpm tc` is clean.
Three files the 2026-09-22 rebase onto upstream `6ae5ef2d00` merged without a conflict marker, whose fixtures still describe the pre-sync shape: - `use-file-explorer-name-filter.test.ts` set `resolvedQuery` on a mocked listing. Upstream's stablyai#22173 (stale listings) deleted that field from `RuntimeFileListState` and moved the fencing into the hook, so the field no longer exists. Dropped it; the projection behaviour it stood for is unchanged. - `use-visible-worktrees.test.tsx` built a `filterState` for an upstream test added in stablyai#22098 without `hiddenWorkspaceStatusIds`, which our #23 made required. The other three literals in the file already carry it. - `AiVaultPanel.legacy-filter.test.tsx` enabled the vault search as `enabled`, the legacy name, in two tests upstream added. Our `3141d7578a` narrowed this mock's type to `contentEnabled`, which is the field the panel writes and the resolver reads first. Both tests still passed at runtime through the legacy fallback in `resolveAiVaultSearchSettings`, which is why only `pnpm tc` saw this. No production behaviour moves. `pnpm tc` is clean.
Three files the 2026-09-22 rebase onto upstream `6ae5ef2d00` merged without a conflict marker, whose fixtures still describe the pre-sync shape: - `use-file-explorer-name-filter.test.ts` set `resolvedQuery` on a mocked listing. Upstream's stablyai#22173 (stale listings) deleted that field from `RuntimeFileListState` and moved the fencing into the hook, so the field no longer exists. Dropped it; the projection behaviour it stood for is unchanged. - `use-visible-worktrees.test.tsx` built a `filterState` for an upstream test added in stablyai#22098 without `hiddenWorkspaceStatusIds`, which our #23 made required. The other three literals in the file already carry it. - `AiVaultPanel.legacy-filter.test.tsx` enabled the vault search as `enabled`, the legacy name, in two tests upstream added. Our `3141d7578a` narrowed this mock's type to `contentEnabled`, which is the field the panel writes and the resolver reads first. Both tests still passed at runtime through the legacy fallback in `resolveAiVaultSearchSettings`, which is why only `pnpm tc` saw this. No production behaviour moves. `pnpm tc` is clean.




ELI5
If a workspace's only open thing was a native chat, the sidebar drew a little moon on it and greyed it out — the "this workspace is asleep" look — even though the chat was right there and you could type into it. The moon also pushed the pull-request icon off the row, so you lost the PR status at a glance, and turning on "hide sleeping workspaces" made the workspace disappear from the sidebar completely.
Nothing had actually been put to sleep. The sidebar just had no idea native chats exist.
What Changed
Before: open a workspace, start one or two native chats in it, and leave. The moment the agents finished replying, the row dimmed and showed the sleeping moon. Its PR icon was replaced by that moon. With the sleeping filter on, the row vanished.
After: a workspace holding a native chat is never shown as asleep. It keeps its normal appearance, keeps its PR icon, and stays in the list.
Mechanism. The sidebar decides "asleep" by asking whether a workspace has any activity, and it had three ways to say yes: a terminal tab with a live process behind it, an open browser tab, or an agent that is currently mid-task. A native chat matches none of them:
So two chats finishing their replies was all it took. This adds a fourth way to say yes: the workspace has a native chat.
Two supporting moves with no behaviour change: the new lookup sits next to the two existing ones that do the same job for terminal and browser tabs, and the function that reads app state into the filter's inputs moved into its own file. That second move keeps the filter a pure function of its inputs, and keeps both touched files under the 300-line limit without raising it.
Why
The interesting question was what "awake" should mean for a native chat, because the obvious answer is wrong.
A native chat does have a background process, and there is already a flag that reports whether it is running. Keying off that flag would compile and look principled — but that process is only kept alive while the chat is actually on screen, and it is shut down 15 seconds after you look away. So the moon would have reappeared on every workspace you switched away from, a few seconds later. It would have reported an invisible process being recycled, which is not a thing anyone can act on, and it would have reproduced the original complaint in a slower form.
What actually survives is the chat: its transcript is on disk, and it will accept your next message whenever you come back. That is the fact a "this is asleep" marker must not contradict, so presence of the chat is what the check asks about.
This also went into the one shared check rather than into the sidebar row. The moon, the hide-sleeping filter, and the Cmd+J palette all read that same check, and the code already carries a comment warning that they must not disagree about which workspaces are asleep. Fixing only the row would have left the filter still hiding the workspace.
Considered and rejected: keying on the background process (above); special-casing the sidebar row only (leaves the filter and palette wrong); and folding chats into the existing "live agent" set (that set is named for something else and is read elsewhere, so overloading it would mislead the next reader).
Linked Issue
No filed issue — this came from a report in Orca itself, of a workspace with two native chats showing the sleeping icon and hiding its PR status. Happy to open one to link if that is preferred.
Visual Proof
Not yet attached. This is a visible change (moon icon and PR icon on the sidebar row), so it warrants a before/after — I did not want to hold the PR open while capturing it. I can add a before/after pair from the Electron rig on request.
Testing
Four tests added to the sleeping-state suite, two of them negative controls:
Verification run:
pnpm tc— passespnpm run check:code-quality:changed— 0 findings across 10 files, all seven gatesworktree-activity-stateandvisible-worktreessuitesPlatforms: logic is platform-independent renderer code with no path, shell, or process handling. Not separately exercised on Linux/Windows. Remote/SSH: the check reads only locally-held tab state and does not consult the execution host, so a dropped connection cannot flip a workspace to "asleep" — which was a specific hazard with the rejected alternative.
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Security: none — no new inputs, no process or filesystem access. Cross-platform: platform-independent. Remote SSH: covered above; the check requires no host contact. Mobile: untouched, this is desktop sidebar rendering. Backwards compatibility: no persisted shape or wire format changes; the new parameter defaults to empty, so any caller not yet passing it behaves exactly as before. Performance: the lookup is cached per tab-map snapshot in the same way the neighbouring live-agent lookup is, so it does not add a store-wide scan to each card's selector run.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)