Repository navigation
feat(agents): distinguish Claude background monitoring (takes over #14205) - #16201
Conversation
Adds an optional `workingMode: 'monitoring'` discriminator for a Claude session whose lead turn finished but which still has background shell tasks or session crons registered. The wire state stays `working`, so older peers that never read the field keep rendering Working. (cherry picked from commit d5d54b4) Rebased onto current main (554 commits of drift) by Brennan Benson; conflicts resolved by keeping both sides where main and this branch made independent additions to the same construct.
(cherry picked from commit fd6b386)
(cherry picked from commit ce4d61e)
(cherry picked from commit bbcfa35)
Live CDP evidence — all three statesIsolated dev instance (temp Real Orca sidebar, three workspaces driven to Separability:
|
Replaces the yellow Radio glyph from #14205 with a static dot in a new --agent-monitoring token (#8abeb7), defined once for light and once for dark like --workspace-status-done, so the status keeps its identity when the theme flips. Deliberately a fixed UI value: it never reads terminal theme state at runtime. Adds the turn-boundary notification pins. The monitoring predicate and the turnCompletedAt stamp are computed from the same "lead said done but the pane resolves to working" expression, so a rename can silently drop the stamp and kill a completion notification that works today with nothing else going red.
39fc5a7 to
76f77bf
Compare
📝 WalkthroughWalkthroughThe change adds Merge Risk: 🟡 Moderate · up to This PR adds a monitoring presentation state while keeping the wire state as working, but the current head still has concrete issues that can produce misleading tab ordering or agent status and inaccessible mobile UI: cross-host recency collisions, host monitoring overriding foreground work, stale restored entries affecting palette status, and incorrect monitoring sort priority. The notification regression test also does not exercise the claimed terminal transition, so the PR is not merge-ready until these issues are fixed or explicitly accepted. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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.
Actionable comments posted: 5
🧹 Nitpick comments (1)
src/shared/claude-background-task-status.test.ts (1)
148-153: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten the new test comments.
Keep comments to one concise non-obvious reason. Let test names and assertions describe expected behavior.
src/shared/claude-background-task-status.test.ts#L148-L153: replace the multi-line rationale with one short reason for assertingturnCompletedAt.src/renderer/src/components/terminal-pane/agent-completion-coordinator-monitoring-turn-end.test.ts#L7-L9: replace the multi-line setup explanation with one short reason for using normalized hook payloads.As per coding guidelines: “Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code.”
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 84c26734-0f32-4c54-9199-ab3fad23ddfc
📥 Commits
Reviewing files that changed from the base of the PR and between 4bc9e6b and 39fc5a7475faace0e18a05a970ea9ad9b356a609.
📒 Files selected for processing (91)
mobile/src/components/AgentSpinner.tsxmobile/src/components/AgentStateDot.tsxmobile/src/components/WorktreeListRow.test.tsmobile/src/components/WorktreeListRow.tsxmobile/src/components/agent-monitoring-indicators.test.tsmobile/src/session/use-mobile-native-chat-controller.test.tsmobile/src/session/use-mobile-native-chat-controller.tsmobile/src/worktree/agent-row-display.test.tsmobile/src/worktree/agent-row-display.tsmobile/src/worktree/workspace-list-types.tsmobile/src/worktree/worktree-list-snapshot.test.tsmobile/src/worktree/worktree-list-snapshot.tssrc/main/agent-hooks/hook-status-session-tabs-invalidation.test.tssrc/main/agent-hooks/hook-status-session-tabs-invalidation.tssrc/main/agent-hooks/server-ingest-terminal-status.test.tssrc/main/agent-hooks/server-interrupt-inference-guards.test.tssrc/main/agent-hooks/server-last-status-write.test.tssrc/main/agent-hooks/server.tssrc/main/ipc/dashboard-payload-validation.test.tssrc/main/ipc/dashboard-payload-validation.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/ssh/ssh-relay-session-agent-hooks.integration.test.tssrc/relay/agent-hook-server.test.tssrc/renderer/src/assets/main.csssrc/renderer/src/components/AgentStateDot.test.tssrc/renderer/src/components/AgentStateDot.tsxsrc/renderer/src/components/activity/ActivityPrototypePage.test.tssrc/renderer/src/components/activity/ActivityPrototypePage.tsxsrc/renderer/src/components/cmd-j/palette-live-status.test.tsxsrc/renderer/src/components/cmd-j/palette-live-status.tsxsrc/renderer/src/components/dashboard-popout/AgentKanbanCard.test.tsxsrc/renderer/src/components/dashboard-popout/AgentKanbanCard.tsxsrc/renderer/src/components/dashboard-popout/AgentMapProjectLabel.test.tsxsrc/renderer/src/components/dashboard-popout/AgentMapWorktreeRingNode.tsxsrc/renderer/src/components/dashboard-popout/agent-map-filter.tssrc/renderer/src/components/dashboard-popout/agent-map-label-declutter.tssrc/renderer/src/components/dashboard-popout/agent-map-layout.test.tssrc/renderer/src/components/dashboard-popout/agent-map-node-metadata.tssrc/renderer/src/components/dashboard-popout/agent-map-worktree-active-status.test.tssrc/renderer/src/components/dashboard-popout/agent-map.csssrc/renderer/src/components/dashboard-popout/dashboard-agent-status-patch.test.tssrc/renderer/src/components/dashboard-popout/dashboard-agent-status-patch.tssrc/renderer/src/components/dashboard-popout/useDashboardSnapshot.test.tsxsrc/renderer/src/components/dashboard/DashboardAgentRow.test.tsxsrc/renderer/src/components/dashboard/DashboardAgentRow.tsxsrc/renderer/src/components/dashboard/build-dashboard-snapshot.test.tssrc/renderer/src/components/dashboard/build-dashboard-snapshot.tssrc/renderer/src/components/dashboard/dashboard-card-bucket.tssrc/renderer/src/components/editor/ReviewNotesSendMenuContent.tsxsrc/renderer/src/components/native-chat/use-native-chat-hook-status.tssrc/renderer/src/components/native-chat/use-native-chat-live-session.test.tssrc/renderer/src/components/pet/pet-agent-state.test.tssrc/renderer/src/components/pet/pet-agent-state.tssrc/renderer/src/components/sidebar/StatusIndicator.test.tssrc/renderer/src/components/sidebar/StatusIndicator.tsxsrc/renderer/src/components/sidebar/use-worktree-activity-status.tssrc/renderer/src/components/sidebar/use-worktree-activity-statuses.tssrc/renderer/src/components/sidebar/worktree-agent-activity-summary.test.tssrc/renderer/src/components/sidebar/worktree-agent-activity-summary.tssrc/renderer/src/components/sidebar/worktree-card-agent-summary.test.tssrc/renderer/src/components/sidebar/worktree-card-agent-summary.tssrc/renderer/src/components/sidebar/worktree-card-compact-agent-row.tsxsrc/renderer/src/components/tab-bar/terminal-tab-activity-status.test.tssrc/renderer/src/components/tab-bar/terminal-tab-activity-status.tssrc/renderer/src/components/terminal-pane/agent-completion-coordinator-monitoring-turn-end.test.tssrc/renderer/src/components/workspace-cleanup/workspace-cleanup-facets.tssrc/renderer/src/hooks/useIpcEvents-agent-status-snapshot-hydration.test.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/lib/recent-workspace-tab-rows.test.tssrc/renderer/src/lib/recent-workspace-tab-rows.tssrc/renderer/src/lib/worktree-activity-state.test.tssrc/renderer/src/lib/worktree-activity-state.tssrc/renderer/src/lib/worktree-status.test.tssrc/renderer/src/lib/worktree-status.tssrc/renderer/src/runtime/sync-runtime-graph-agent-status-projection.test.tssrc/renderer/src/runtime/sync-runtime-graph.tssrc/renderer/src/runtime/web-session-tabs-sync-remote-status-title-flap.test.tssrc/renderer/src/runtime/web-session-tabs-sync.tssrc/renderer/src/store/slices/agent-status-tool-assistant-fields.test.tssrc/renderer/src/store/slices/agent-status.tssrc/shared/agent-hook-listener.tssrc/shared/agent-hook-relay.test.tssrc/shared/agent-status-ipc-payload.tssrc/shared/agent-status-types.test.tssrc/shared/agent-status-types.tssrc/shared/agent-terminal-status-equivalence.test.tssrc/shared/agent-terminal-status-equivalence.tssrc/shared/claude-background-task-status.test.tssrc/shared/dashboard-snapshot.tssrc/shared/runtime-types.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.
| if (monitoring) { | ||
| // Why: static dot, not a spinner — the lead turn is over. Keep MONITORING_COLOR | ||
| // in step with --agent-monitoring in the desktop main.css. | ||
| return ( | ||
| <View style={styles.wrapper} accessibilityLabel="Monitoring background tasks"> | ||
| <View style={[styles.dot, { backgroundColor: MONITORING_COLOR }]} /> | ||
| </View> | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- AgentSpinner.tsx ---'
sed -n '1,120p' mobile/src/components/AgentSpinner.tsx
printf '%s\n' '--- AgentStateDot.tsx ---'
sed -n '1,120p' mobile/src/components/AgentStateDot.tsx
printf '%s\n' '--- related tests ---'
rg -n -i -C 3 'AgentSpinner|AgentStateDot|Monitoring background tasks|accessible' mobile --glob '*.{test,spec}.{ts,tsx,js,jsx}' --glob '!*node_modules*' || true
printf '%s\n' '--- accessibility props and package versions ---'
rg -n -C 2 'accessibilityLabel|accessible' mobile/src mobile/package.json package.json 2>/dev/null || trueRepository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- indicator tests ---'
sed -n '1,150p' mobile/src/components/agent-monitoring-indicators.test.ts
printf '%s\n' '--- React Native package declarations ---'
rg -n '"react-native"|react-native' mobile/package.json package.json pnpm-lock.yaml yarn.lock package-lock.json 2>/dev/null | head -40 || true
printf '%s\n' '--- exact indicator accessibility declarations ---'
rg -n -C 2 'accessibilityLabel|accessible' mobile/src/components/AgentSpinner.tsx mobile/src/components/AgentStateDot.tsx mobile/src/components/agent-monitoring-indicators.test.tsRepository: stablyai/orca
Length of output: 5542
🌐 Web query:
React Native accessibility View accessibilityLabel accessible prop documentation
💡 Result:
In React Native, the accessible and accessibilityLabel props are fundamental accessibility controls used to make components discoverable and understandable by assistive technologies like screen readers [1][2]. accessible Prop When set to true, this prop indicates that a view is an accessibility element, making it discoverable by assistive technologies such as screen readers and hardware keyboards [1][3]. - Default Behavior: By default, all touchable elements (such as TouchableOpacity) are accessible [1][4]. - Platform Mapping: On Android, this translates to native focusable; on iOS, it translates to isAccessibilityElement [1][5]. - Important Note: Setting accessible={true} does not guarantee that the element will be focused by VoiceOver or TalkBack, as assistive technologies may override this for various reasons, such as grouping or hierarchy management [1][6]. accessibilityLabel Prop This prop provides a custom string that screen readers will verbalize when the element is selected [1][5]. - Best Practice: It is considered good practice to set an accessibilityLabel on any element marked as accessible to ensure users understand the purpose of the element [1]. - Default Behavior: If no accessibilityLabel is provided, React Native automatically constructs one by traversing the element's children and concatenating all Text node children, separated by spaces [1][3]. Example Usage Press me! In this example, the accessibilityLabel explicitly provides the text "Tap me!" for the screen reader, overriding the default behavior that would have used the text "Press me!" [1][6].
Citations:
- 1: https://reactnative.dev/docs/accessibility
- 2: https://reactnative.dev/docs/view
- 3: https://reactnative.dev/docs/view.md
- 4: https://reactnative.dev/docs/next/view
- 5: https://reactnative.dev/docs/0.83/accessibility
- 6: https://reactnative.dev/docs/0.85/accessibility
Mark monitoring indicators as accessible.
Set accessible={true} on the AgentSpinner monitoring wrapper and accessible={state === 'monitoring'} on the AgentStateDot wrapper. Assert these props in agent-monitoring-indicators.test.ts.
📍 Affects 2 files
mobile/src/components/AgentSpinner.tsx#L50-L57(this comment)mobile/src/components/AgentStateDot.tsx#L50-L56
Source: MCP tools
| case 'monitoring': | ||
| return 'Monitoring background tasks' |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Localize the new monitoring status label with an intent-named translation ID and source string so translated clients can render it correctly.
📍 Affects 2 files
src/renderer/src/components/AgentStateDot.tsx#L41-L42(this comment)src/renderer/src/lib/worktree-status.ts#L32-L32
Source: Learnings
| if ( | ||
| entry.restoredUnconfirmed !== true && | ||
| !isExplicitAgentStatusFresh(entry, now, AGENT_STATUS_STALE_AFTER_MS) | ||
| ) { | ||
| continue |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Exclude restored-unconfirmed entries from pane IDs.
When entry.restoredUnconfirmed === true, this condition is false, so the entry contributes a pane ID even though isExplicitAgentStatusFresh() rejects it. The stale restored status can then affect palette worktree-status resolution. Replace the condition with if (!isExplicitAgentStatusFresh(entry, now, AGENT_STATUS_STALE_AFTER_MS)).
| // The shell exits; the same turn's all-clear must not re-announce. | ||
| coordinator.observeHookStatus( | ||
| hookPayload(listener, { | ||
| hook_event_name: 'PostToolUse', | ||
| tool_name: 'KillShell', | ||
| background_tasks: [] | ||
| }) | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Test the actual all-clear transition.
Line 103 sends PostToolUse, which resolves to working. The test does not verify the later done transition. Send a Stop event with empty background_tasks and session_crons, then assert done and one completion dispatch.
Proposed fix
- hookPayload(listener, {
- hook_event_name: 'PostToolUse',
- tool_name: 'KillShell',
- background_tasks: []
- })
+ const done = hookPayload(listener, {
+ hook_event_name: 'Stop',
+ background_tasks: [],
+ session_crons: []
+ })
+ expect(done.state).toBe('done')
+ coordinator.observeHookStatus(done)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // The shell exits; the same turn's all-clear must not re-announce. | |
| coordinator.observeHookStatus( | |
| hookPayload(listener, { | |
| hook_event_name: 'PostToolUse', | |
| tool_name: 'KillShell', | |
| background_tasks: [] | |
| }) | |
| ) | |
| // The shell exits; the same turn's all-clear must not re-announce. | |
| const done = hookPayload(listener, { | |
| hook_event_name: 'Stop', | |
| background_tasks: [], | |
| session_crons: [] | |
| }) | |
| expect(done.state).toBe('done') | |
| coordinator.observeHookStatus(done) |
| ...(clientOwnsEntry && existing.state === 'working' && entry.state === 'working' | ||
| ? { workingMode: entry.workingMode } | ||
| : {}), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Keep the client-owned working mode in this branch.
This branch retains existing because the client owns the fresh status. Line 1400 instead copies entry.workingMode from the host. If the client reports foreground working and the host reports monitoring, the UI changes to monitoring and hides the foreground spinner. Copy existing.workingMode here.
Proposed fix
...(clientOwnsEntry && existing.state === 'working' && entry.state === 'working'
- ? { workingMode: entry.workingMode }
+ ? { workingMode: existing.workingMode }
: {}),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ...(clientOwnsEntry && existing.state === 'working' && entry.state === 'working' | |
| ? { workingMode: entry.workingMode } | |
| : {}), | |
| ...(clientOwnsEntry && existing.state === 'working' && entry.state === 'working' | |
| ? { workingMode: existing.workingMode } | |
| : {}), |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/agent-completion-coordinator-monitoring-turn-end.test.ts (1)
10-12: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten this test comment.
State the integration purpose in one non-obvious line. The current comment restates the test setup.
As per coding guidelines, “Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code.”
Proposed change
-// Why: STA-4119's second complaint is the missing completion notification. This drives the REAL -// hook listener and feeds its real output into the REAL coordinator, rather than hand-writing a -// payload — the whole question is whether the two layers actually agree about a monitoring turn. +// Exercise listener-to-coordinator monitoring completion integration.Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9b41b133-89d4-4ab3-8ad2-4e010716263a
📥 Commits
Reviewing files that changed from the base of the PR and between 39fc5a7475faace0e18a05a970ea9ad9b356a609 and 76f77bf.
📒 Files selected for processing (1)
src/renderer/src/components/terminal-pane/agent-completion-coordinator-monitoring-turn-end.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.
Brennan chose #14205's original treatment over the turquoise dot, so the visual goes back to nwparker's: lucide Radio in text-yellow-500 across the sidebar, dashboard dot, cmd-j palette and agent-map ring. Reverts only the visual surface. The turn-boundary notification pins stay — the monitoring predicate and the turnCompletedAt stamp share an expression, so a rename can silently drop the stamp and kill a completion that works today with nothing else going red. The --agent-monitoring token is removed with its last consumer rather than left dead in main.css.
Two conflicts, both from siblings that have since merged: - agent-hook-listener.ts: #15202 added the manual-compact restored-roster reap immediately before the resolver call this branch replaced. Kept both — main's block runs, then resolveClaudePaneStatus — and bridged `effectiveState` off `resolvedStatus.stateName` so #15202's downstream guard reads the same value instead of resolving twice. - agent-status-types.ts: a SEMANTIC conflict, not a textual one. #15212 replaced the entry's `WithAgentStatusObservation` intersection with `AgentStatusRowFacets`, and the payload type that used the old name moved into the extracted ipc-payload module — so the import went dead and CI failed TS6196. Dropped it.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/renderer/src/store/slices/agent-status.ts (1)
2402-2410: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winMake smart-sort rank foreground work above monitoring.
smart-attention.tsassigns both modes to Class 3, so monitoring can outrank foreground work by timestamp. AddingworkingModeChangedtosortRelevantChangealone does not fix the ranking.src/renderer/src/lib/recent-workspace-tab-rows.ts (1)
114-120: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftMake focused-group MRU keys host-qualified.
RecentWorkspaceTabRownow supports the sameworktreeIdon multiple hosts.focusedGroupTabKey()still omitsworktreeHostId.If two hosts publish the same
worktreeIdandunifiedTabId,focusedGroupTabRecencystores one ordinal for both rows. One host can then apply the other host's MRU order.Include host identity in this key. Update the recency producers and callers to use the same host-qualified identity. Add a local/SSH regression case with equal worktree and unified-tab IDs.
🧹 Nitpick comments (1)
src/shared/agent-hook-listener.ts (1)
222-240: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReduce the new implementation comments. Keep each comment to the invariant or non-obvious reason that the code cannot express.
src/shared/agent-hook-listener.ts#L222-L240: reduce the cache-claim explanation to one short invariant.src/shared/agent-hook-listener.ts#L2886-L2962: reduce the session-owner explanation and keep only replacement rules.src/main/agent-hooks/server.ts#L2657-L2736: reduce the retained-session and process-reconciliation explanations.src/main/agent-hooks/server.ts#L2936-L3008: reduce the stale-pane reaping explanation.As per coding guidelines, comments must be concise, non-obvious, and brief.
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f36a06ee-5750-453d-b0f2-9cd7de5aab64
📒 Files selected for processing (21)
mobile/src/components/AgentSpinner.tsxmobile/src/components/AgentStateDot.tsxmobile/src/components/agent-monitoring-indicators.test.tssrc/main/agent-hooks/server.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/ssh/ssh-relay-session-agent-hooks.integration.test.tssrc/renderer/src/components/AgentStateDot.test.tssrc/renderer/src/components/AgentStateDot.tsxsrc/renderer/src/components/cmd-j/palette-live-status.test.tsxsrc/renderer/src/components/dashboard-popout/agent-map.csssrc/renderer/src/components/dashboard/DashboardAgentRow.test.tsxsrc/renderer/src/components/sidebar/StatusIndicator.test.tssrc/renderer/src/components/sidebar/StatusIndicator.tsxsrc/renderer/src/components/workspace-cleanup/workspace-cleanup-facets.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/lib/recent-workspace-tab-rows.test.tssrc/renderer/src/lib/recent-workspace-tab-rows.tssrc/renderer/src/store/slices/agent-status.tssrc/shared/agent-hook-listener.tssrc/shared/agent-status-types.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
|
Visual check of agent-status on Sidebar agent rows + tab glyphs (Terminal 1 monitoring, Terminal 2 working, Terminal 3 done): monitoring-shot card close-up — Radio + “Monitoring background tasks”, spinner, emerald check: |
…ablyai#14205) (stablyai#16201) * feat(agents): distinguish Claude background monitoring Adds an optional `workingMode: 'monitoring'` discriminator for a Claude session whose lead turn finished but which still has background shell tasks or session crons registered. The wire state stays `working`, so older peers that never read the field keep rendering Working. (cherry picked from commit d5d54b4) Rebased onto current main (554 commits of drift) by Brennan Benson; conflicts resolved by keeping both sides where main and this branch made independent additions to the same construct. * fix(sidebar): keep monitoring status visible (cherry picked from commit fd6b386) * test(agents): cover Claude monitoring drain (cherry picked from commit ce4d61e) * test(mobile): avoid unresolved renderer test type (cherry picked from commit bbcfa35) * feat(agents): render Claude monitoring as a static turquoise dot Replaces the yellow Radio glyph from stablyai#14205 with a static dot in a new --agent-monitoring token (#8abeb7), defined once for light and once for dark like --workspace-status-done, so the status keeps its identity when the theme flips. Deliberately a fixed UI value: it never reads terminal theme state at runtime. Adds the turn-boundary notification pins. The monitoring predicate and the turnCompletedAt stamp are computed from the same "lead said done but the pane resolves to working" expression, so a rename can silently drop the stamp and kill a completion notification that works today with nothing else going red. * revert(agents): restore the yellow Radio glyph for monitoring Brennan chose stablyai#14205's original treatment over the turquoise dot, so the visual goes back to nwparker's: lucide Radio in text-yellow-500 across the sidebar, dashboard dot, cmd-j palette and agent-map ring. Reverts only the visual surface. The turn-boundary notification pins stay — the monitoring predicate and the turnCompletedAt stamp share an expression, so a rename can silently drop the stamp and kill a completion that works today with nothing else going red. The --agent-monitoring token is removed with its last consumer rather than left dead in main.css. --------- Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com> (cherry picked from commit ec4687c)
…ablyai#14205) (stablyai#16201) * feat(agents): distinguish Claude background monitoring Adds an optional `workingMode: 'monitoring'` discriminator for a Claude session whose lead turn finished but which still has background shell tasks or session crons registered. The wire state stays `working`, so older peers that never read the field keep rendering Working. (cherry picked from commit d5d54b4) Rebased onto current main (554 commits of drift) by Brennan Benson; conflicts resolved by keeping both sides where main and this branch made independent additions to the same construct. * fix(sidebar): keep monitoring status visible (cherry picked from commit fd6b386) * test(agents): cover Claude monitoring drain (cherry picked from commit ce4d61e) * test(mobile): avoid unresolved renderer test type (cherry picked from commit bbcfa35) * feat(agents): render Claude monitoring as a static turquoise dot Replaces the yellow Radio glyph from stablyai#14205 with a static dot in a new --agent-monitoring token (#8abeb7), defined once for light and once for dark like --workspace-status-done, so the status keeps its identity when the theme flips. Deliberately a fixed UI value: it never reads terminal theme state at runtime. Adds the turn-boundary notification pins. The monitoring predicate and the turnCompletedAt stamp are computed from the same "lead said done but the pane resolves to working" expression, so a rename can silently drop the stamp and kill a completion notification that works today with nothing else going red. * revert(agents): restore the yellow Radio glyph for monitoring Brennan chose stablyai#14205's original treatment over the turquoise dot, so the visual goes back to nwparker's: lucide Radio in text-yellow-500 across the sidebar, dashboard dot, cmd-j palette and agent-map ring. Reverts only the visual surface. The turn-boundary notification pins stay — the monitoring predicate and the turnCompletedAt stamp share an expression, so a rename can silently drop the stamp and kill a completion that works today with nothing else going red. The --agent-monitoring token is removed with its last consumer rather than left dead in main.css. --------- Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>
…t, incl. under a working subagent Address two review findings on the provisional-interrupt clear: - Restrict clearing to `eventName === 'Stop'`. A `StopFailure` is an error boundary, not proof of clean completion, so it must not drop a provisional interrupt. Adds a StopFailure regression test. - Clear even while a subagent still holds the pane `working`. A subagent spawned between the Escape and the completion Stop keeps the pane working (that gate ignores `interrupted`), so the old `resolvedStatus.stateName === 'done'` conjunct missed it and the false red returned once the child drained. Gate on `workingMode !== 'monitoring'` instead, which clears on a clean done or a subagent-held working pane while leaving the shell/cron interrupt-suppresses-monitoring behavior (stablyai#16201) intact. Adds a subagent regression test.
…interrupt clear `interruptedInferred` is only ever set alongside `interrupted: true`, so the raw `interrupted` passed to resolveClaudePaneStatus is always true here, which suppresses the monitoring branch. `resolvedStatus.workingMode` can therefore never be `monitoring` at this point, making the conjunct inert. Remove it and correct the comment: stablyai#16201 is preserved by the resolver running with the raw `interrupted`, not by this guard. No behavior change (295 tests green).
…ablyai#14205) (stablyai#16201) * feat(agents): distinguish Claude background monitoring Adds an optional `workingMode: 'monitoring'` discriminator for a Claude session whose lead turn finished but which still has background shell tasks or session crons registered. The wire state stays `working`, so older peers that never read the field keep rendering Working. (cherry picked from commit d5d54b4) Rebased onto current main (554 commits of drift) by Brennan Benson; conflicts resolved by keeping both sides where main and this branch made independent additions to the same construct. * fix(sidebar): keep monitoring status visible (cherry picked from commit fd6b386) * test(agents): cover Claude monitoring drain (cherry picked from commit ce4d61e) * test(mobile): avoid unresolved renderer test type (cherry picked from commit bbcfa35) * feat(agents): render Claude monitoring as a static turquoise dot Replaces the yellow Radio glyph from stablyai#14205 with a static dot in a new --agent-monitoring token (#8abeb7), defined once for light and once for dark like --workspace-status-done, so the status keeps its identity when the theme flips. Deliberately a fixed UI value: it never reads terminal theme state at runtime. Adds the turn-boundary notification pins. The monitoring predicate and the turnCompletedAt stamp are computed from the same "lead said done but the pane resolves to working" expression, so a rename can silently drop the stamp and kill a completion notification that works today with nothing else going red. * revert(agents): restore the yellow Radio glyph for monitoring Brennan chose stablyai#14205's original treatment over the turquoise dot, so the visual goes back to nwparker's: lucide Radio in text-yellow-500 across the sidebar, dashboard dot, cmd-j palette and agent-map ring. Reverts only the visual surface. The turn-boundary notification pins stay — the monitoring predicate and the turnCompletedAt stamp share an expression, so a rename can silently drop the stamp and kill a completion that works today with nothing else going red. The --agent-monitoring token is removed with its last consumer rather than left dead in main.css. --------- Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>




Takes over #14205 by @nwparker. His four commits are preserved with original authorship; my changes sit on top as a separate commit. His branch was 554 commits behind main and touched 88 files (58 of which main had also changed), so this is his work re-applied onto current main, not a merge.
Fixes the STA-4119 spinner complaint: a Claude pane keeps spinning after the lead turn ends because a background shell (typically a dev server) is still registered in Claude's task inventory.
Why not just settle the pane to
doneThis preserves #11838 rather than reverting it. #11838 deliberately made background work hold
working, fixing #10997 where Claude's own footer said1 shell still runningwhile Orca saiddone. Our #15189 was closed for reverting exactly that, and #15041 was closed for guessing intent from command names.#11838's complaint ("
doneis wrong while a shell runs") and STA-4119's ("workingis wrong once the turn is over") are the same observation from opposite sides. Both are true, so any either/or fix reverts the other. The resolution is a third display state.Design
An optional
workingMode: 'monitoring'alongside the existingstate.AGENT_STATUS_STATESstays exactly['working','blocked','waiting','done']. No new enum member.working. An old peer that never readsworkingModerenders Working — fix(agent-status): preserve Claude background work #11838's behavior preserved by construction, not by a compatibility shim.workingModeon any non-working state is dropped.Precedence holds: needs-attention > working > monitoring > done. A permission prompt during monitoring still surfaces as attention; a new turn while a dev server runs still shows the spinner; a live background subagent or teammate still reads
working, because that is real agent work (the roster branch is checked first and deliberately returns noworkingMode).The notification question — measured, not reasoned
STA-4119 had two complaints: the spinner, and that the completion notification never fires. This PR touches zero notification files, so I measured whether that half is still broken.
Measured answer: the notification already fires, and it already follows the turn boundary rather than a
working → donetransition. It was fixed on main by #14580, independently of #14205.agent-hook-listener.tsstampsturnCompletedAtwhen the lead Stop ends a turn whose pane still resolves toworking, andagent-completion-coordinator.tsannounces off that stamp with a synthesizeddonesnapshot andnotifyWithoutLifecycle: true— so the banner fires while the reported row correctly staysworking.Evidence, driving the real listener into the real coordinator (
agent-completion-coordinator-monitoring-turn-end.test.ts): aStopwith a running background shell produces{ state: 'working', workingMode: 'monitoring', turnCompletedAt: <number> }, and the coordinator dispatches exactly one completion withsource: 'hook'andagentStatus.state === 'done', without running pane lifecycle. Main's ownagent-hook-completion-background-turn-notifications.test.tsindependently confirms a banner per background-shell turn.The real risk this creates is a regression, not a gap. The stamp predicate and the monitoring predicate are computed from the same "lead said done but the pane resolves to working" expression, so a careless refactor drops the stamp and silently kills a notification that works today with nothing going red. Mutation-tested: adding
&& resolvedStatus.workingMode !== 'monitoring'to the stamp condition turns 5 tests red across 3 files, including main's own notification tests.Presentation — yellow
RadioglyphMonitoring renders as #14205's original static yellow
Radioglyph (lucide-reactRadiointext-yellow-500) across the sidebarStatusIndicator, theAgentStateDot, the cmd-j palette, the dashboard row, and the agent-map ring stroke.A static turquoise dot (
#8abeb7, an--agent-monitoringtoken) was implemented and then reverted at the owner's request ine407944ff2; the token was removed along with its last consumer rather than left dead inmain.css. The distinction from working is carried by the glyph being static — no spinner — not by hue.It is theme-agnostic by construction — a fixed UI value that never reads terminal-theme state at runtime.
Verified live in the app that the monitoring row renders the static glyph with no spinner class.
Separability verdict vs the emerald done dot: PASS, with one caveat
Both are well above the ~10 "clearly different" threshold. The separation is carried mainly by saturation and lightness (pale desaturated teal vs vivid green) rather than hue alone, which is what makes it survive deuteranopia.
Caveat worth stating: these two are the closest pair in the status palette, since they are the only two in the green family. They are comfortably distinguishable, but the gap is smaller than every other pair.
Live validation (CDP only — no computer-use, no OS automation)
Isolated dev instance: temp
HOME+ORCA_DEV_USER_DATA_PATH, throwaway repo, worktree identity asserted before any mutating step (devRepoRootconfirmed as this worktree). All three states rendered in the real sidebar:agent-working-spinner border-yellow-500(animated)Radioglyph, no spinner class, titleMonitoring background tasksbg-emerald-500Precedence checked live: injecting a permission prompt onto the monitoring pane replaces the monitoring glyph with
Needs permission.Back-compat
statestaysworking, so an old client renders Working. No new enum crosses a version boundary.workingModepresent, so the pane renders ordinary working — the pre-existing behavior.workingModeand keepsstate: 'working'. It does not reject the row.orca worktree ps/ mobile projections (the surface fix(agent-status): preserve Claude background work #11838 called out as lying):RuntimeWorktreeStatusstays the closed 5-member union and monitoring maps to'working'in every host-computed rollup; the distinction rides the optional siblingworkingModeon the summary. Thenext: RuntimeWorktreeStatusparameter type enforces this at compile time, so'monitoring'cannot leak into a rollup an old mobile client buckets on.Module extraction (no lint suppression)
src/shared/agent-status-types.tsbreached the 300-linemax-linescap. Rather than suppress it, the IPC transport envelopes were extracted intosrc/shared/agent-status-ipc-payload.ts(AgentStatusIpcPayload,AgentStatusClearIpcPayload,MigrationUnsupportedPtyEntry) — a type-only split, re-exported fromagent-status-types, so no import site changed and no runtime cycle is introduced.agent-status-types.tsnow sits at 278 effective lines. No suppression added;check:max-lines-ratchetreports no new bypasses.src/main/agent-hooks/server.test.tsis deleted rather than resurrected: main removed it in the #14728 test split, and his branch's modify/delete conflict would have restored a stale 8,861-line monolith that green-lights pre-#14580 behavior. His additions were ported into main's siblingserver-*.test.tsfiles instead. All 71 agent-hooks files / 705 tests pass.Verification
typecheck:node,typecheck:cli,typecheck:web— all cleanoxlintclean,check:max-lines-ratchetclean,oxfmtappliedKnown behavior, called out so reviewers do not have to ask
A pane leaves monitoring only when another hook event updates the background-task set — next prompt, a KillShell PostToolUse, or an interrupt. A dev server that just keeps running emits no hook traffic, so the pane stays in monitoring. That is inherited from today's working-forever rather than new, and monitoring-forever is at least honest where spinner-forever was a lie.
Does not close #14205.