Skip to content

feat(agents): distinguish Claude background monitoring (takes over #14205) - #16201

Merged
brennanb2025 merged 7 commits into
mainfrom
brennanb2025/takeover-14205
Aug 24, 2026
Merged

brennanb2025 merged 7 commits into
mainfrom
brennanb2025/takeover-14205

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 42 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1390 $\color{#cf222e}{\Huge{\mathbf{−}}}$​30 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1360
Prod 48 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​675 $\color{#cf222e}{\Huge{\mathbf{−}}}$​203 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​472

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 done

This preserves #11838 rather than reverting it. #11838 deliberately made background work hold working, fixing #10997 where Claude's own footer said 1 shell still running while Orca said done. Our #15189 was closed for reverting exactly that, and #15041 was closed for guessing intent from command names.

#11838's complaint ("done is wrong while a shell runs") and STA-4119's ("working is 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 existing state.

  • AGENT_STATUS_STATES stays exactly ['working','blocked','waiting','done']. No new enum member.
  • The wire state for a monitoring pane remains working. An old peer that never reads workingMode renders Working — fix(agent-status): preserve Claude background work #11838's behavior preserved by construction, not by a compatibility shim.
  • The normalizer clamps it: workingMode on 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 no workingMode).

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 → done transition. It was fixed on main by #14580, independently of #14205.

agent-hook-listener.ts stamps turnCompletedAt when the lead Stop ends a turn whose pane still resolves to working, and agent-completion-coordinator.ts announces off that stamp with a synthesized done snapshot and notifyWithoutLifecycle: true — so the banner fires while the reported row correctly stays working.

Evidence, driving the real listener into the real coordinator (agent-completion-coordinator-monitoring-turn-end.test.ts): a Stop with a running background shell produces { state: 'working', workingMode: 'monitoring', turnCompletedAt: <number> }, and the coordinator dispatches exactly one completion with source: 'hook' and agentStatus.state === 'done', without running pane lifecycle. Main's own agent-hook-completion-background-turn-notifications.test.ts independently 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 Radio glyph

Monitoring renders as #14205's original static yellow Radio glyph (lucide-react Radio in text-yellow-500) across the sidebar StatusIndicator, the AgentStateDot, the cmd-j palette, the dashboard row, and the agent-map ring stroke.

A static turquoise dot (#8abeb7, an --agent-monitoring token) was implemented and then reverted at the owner's request in e407944ff2; the token was removed along with its last consumer rather than left dead in main.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

pair ΔE76
monitoring vs emerald-500 39.6
monitoring vs working-yellow 83.8
monitoring vs emerald under deuteranopia sim 20.2

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 (devRepoRoot confirmed as this worktree). All three states rendered in the real sidebar:

  • working → agent-working-spinner border-yellow-500 (animated)
  • monitoring → static yellow Radio glyph, no spinner class, title Monitoring background tasks
  • done → bg-emerald-500

Precedence checked live: injecting a permission prompt onto the monitoring pane replaces the monitoring glyph with Needs permission.

Back-compat

  • New host → old client: the wire state stays working, so an old client renders Working. No new enum crosses a version boundary.
  • Old host → new client: no workingMode present, so the pane renders ordinary working — the pre-existing behavior.
  • Persisted row rehydrated by an older Orca: the payload normalizer is field-enumerating — it builds a fresh object from known keys and ignores unknown ones — so an older Orca drops workingMode and keeps state: '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): RuntimeWorktreeStatus stays the closed 5-member union and monitoring maps to 'working' in every host-computed rollup; the distinction rides the optional sibling workingMode on the summary. The next: RuntimeWorktreeStatus parameter 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.ts breached the 300-line max-lines cap. Rather than suppress it, the IPC transport envelopes were extracted into src/shared/agent-status-ipc-payload.ts (AgentStatusIpcPayload, AgentStatusClearIpcPayload, MigrationUnsupportedPtyEntry) — a type-only split, re-exported from agent-status-types, so no import site changed and no runtime cycle is introduced. agent-status-types.ts now sits at 278 effective lines. No suppression added; check:max-lines-ratchet reports no new bypasses.

src/main/agent-hooks/server.test.ts is 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 sibling server-*.test.ts files instead. All 71 agent-hooks files / 705 tests pass.

Verification

  • typecheck:node, typecheck:cli, typecheck:web — all clean
  • oxlint clean, check:max-lines-ratchet clean, oxfmt applied
  • agent-hooks: 71 files / 705 passed; shared status: 113 passed; renderer + notification suites: 84 passed; mobile monitoring indicators: 4 passed
  • Every new assertion mutation-tested. Dropping the monitoring stamp kills 5 tests across 3 files, including main's own notification tests.

Known 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.

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.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Live CDP evidence — all three states

Isolated dev instance (temp HOME + ORCA_DEV_USER_DATA_PATH, throwaway repo, worktree identity asserted). CDP only — no computer-use, no OS automation.

Real Orca sidebar, three workspaces driven to working / monitoring / done:

mon14205-three-states.png

Separability: #8abeb7 vs emerald done, magnified 4x

Top to bottom: emerald done, turquoise monitoring, yellow working spinner. These are the real rendered dots, not a mockup.

mon14205-dots-zoom.png

Verdict: PASS. ΔE76 = 39.6 vs emerald (well above the ~10 "clearly different" threshold) and 20.2 under a deuteranopia simulation, because the separation is carried by saturation and lightness rather than hue alone.

Caveat: these two are the closest pair in the status palette — the only two in the green family. Comfortably distinguishable, but the smallest gap in the set. Flagging rather than silently re-picking.

Computed values from the running app:

  • monitoring → rgb(138, 190, 183) (static span, no spinner class)
  • done → bg-emerald-500
  • working → agent-working-spinner border-yellow-500 (animated)

Precedence checked live: injecting a permission prompt onto the monitoring pane replaces the turquoise dot with Needs permission.

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.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/takeover-14205 branch from 39fc5a7 to 76f77bf Compare August 24, 2026 01:58
@coderabbitai

coderabbitai Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds workingMode: 'monitoring' to agent status contracts and propagates it through hooks, terminal reconciliation, runtime aggregation, synchronization, snapshots, and relays. Monitoring status takes precedence below foreground work and permission states. Desktop and mobile interfaces render monitoring with static radio indicators, suppress foreground animations and previews, and preserve monitoring-specific labels. Tests cover parsing, lifecycle transitions, precedence, persistence, synchronization, and rendering.

Merge Risk: 🟡 Moderate · up to 082b8

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 18 files. (3 skipped: 1 unsupported, 2 too large.) Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: distinguishing Claude background monitoring from active work.
Description check ✅ Passed The description provides detailed scope, rationale, linked issue context, visual validation, testing, compatibility, and review notes.
Linked Issues check ✅ Passed The changes implement issue #14205 across status handling, propagation, rendering, compatibility, precedence, draining, and regression coverage.
Out of Scope Changes check ✅ Passed The changes remain focused on monitoring status support, its propagation and presentation, related compatibility, and supporting type extraction.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (1)
src/shared/claude-background-task-status.test.ts (1)

148-153: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shorten 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 asserting turnCompletedAt.
  • 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.tsx
  • mobile/src/components/AgentStateDot.tsx
  • mobile/src/components/WorktreeListRow.test.ts
  • mobile/src/components/WorktreeListRow.tsx
  • mobile/src/components/agent-monitoring-indicators.test.ts
  • mobile/src/session/use-mobile-native-chat-controller.test.ts
  • mobile/src/session/use-mobile-native-chat-controller.ts
  • mobile/src/worktree/agent-row-display.test.ts
  • mobile/src/worktree/agent-row-display.ts
  • mobile/src/worktree/workspace-list-types.ts
  • mobile/src/worktree/worktree-list-snapshot.test.ts
  • mobile/src/worktree/worktree-list-snapshot.ts
  • src/main/agent-hooks/hook-status-session-tabs-invalidation.test.ts
  • src/main/agent-hooks/hook-status-session-tabs-invalidation.ts
  • src/main/agent-hooks/server-ingest-terminal-status.test.ts
  • src/main/agent-hooks/server-interrupt-inference-guards.test.ts
  • src/main/agent-hooks/server-last-status-write.test.ts
  • src/main/agent-hooks/server.ts
  • src/main/ipc/dashboard-payload-validation.test.ts
  • src/main/ipc/dashboard-payload-validation.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/ssh/ssh-relay-session-agent-hooks.integration.test.ts
  • src/relay/agent-hook-server.test.ts
  • src/renderer/src/assets/main.css
  • src/renderer/src/components/AgentStateDot.test.ts
  • src/renderer/src/components/AgentStateDot.tsx
  • src/renderer/src/components/activity/ActivityPrototypePage.test.ts
  • src/renderer/src/components/activity/ActivityPrototypePage.tsx
  • src/renderer/src/components/cmd-j/palette-live-status.test.tsx
  • src/renderer/src/components/cmd-j/palette-live-status.tsx
  • src/renderer/src/components/dashboard-popout/AgentKanbanCard.test.tsx
  • src/renderer/src/components/dashboard-popout/AgentKanbanCard.tsx
  • src/renderer/src/components/dashboard-popout/AgentMapProjectLabel.test.tsx
  • src/renderer/src/components/dashboard-popout/AgentMapWorktreeRingNode.tsx
  • src/renderer/src/components/dashboard-popout/agent-map-filter.ts
  • src/renderer/src/components/dashboard-popout/agent-map-label-declutter.ts
  • src/renderer/src/components/dashboard-popout/agent-map-layout.test.ts
  • src/renderer/src/components/dashboard-popout/agent-map-node-metadata.ts
  • src/renderer/src/components/dashboard-popout/agent-map-worktree-active-status.test.ts
  • src/renderer/src/components/dashboard-popout/agent-map.css
  • src/renderer/src/components/dashboard-popout/dashboard-agent-status-patch.test.ts
  • src/renderer/src/components/dashboard-popout/dashboard-agent-status-patch.ts
  • src/renderer/src/components/dashboard-popout/useDashboardSnapshot.test.tsx
  • src/renderer/src/components/dashboard/DashboardAgentRow.test.tsx
  • src/renderer/src/components/dashboard/DashboardAgentRow.tsx
  • src/renderer/src/components/dashboard/build-dashboard-snapshot.test.ts
  • src/renderer/src/components/dashboard/build-dashboard-snapshot.ts
  • src/renderer/src/components/dashboard/dashboard-card-bucket.ts
  • src/renderer/src/components/editor/ReviewNotesSendMenuContent.tsx
  • src/renderer/src/components/native-chat/use-native-chat-hook-status.ts
  • src/renderer/src/components/native-chat/use-native-chat-live-session.test.ts
  • src/renderer/src/components/pet/pet-agent-state.test.ts
  • src/renderer/src/components/pet/pet-agent-state.ts
  • src/renderer/src/components/sidebar/StatusIndicator.test.ts
  • src/renderer/src/components/sidebar/StatusIndicator.tsx
  • src/renderer/src/components/sidebar/use-worktree-activity-status.ts
  • src/renderer/src/components/sidebar/use-worktree-activity-statuses.ts
  • src/renderer/src/components/sidebar/worktree-agent-activity-summary.test.ts
  • src/renderer/src/components/sidebar/worktree-agent-activity-summary.ts
  • src/renderer/src/components/sidebar/worktree-card-agent-summary.test.ts
  • src/renderer/src/components/sidebar/worktree-card-agent-summary.ts
  • src/renderer/src/components/sidebar/worktree-card-compact-agent-row.tsx
  • src/renderer/src/components/tab-bar/terminal-tab-activity-status.test.ts
  • src/renderer/src/components/tab-bar/terminal-tab-activity-status.ts
  • src/renderer/src/components/terminal-pane/agent-completion-coordinator-monitoring-turn-end.test.ts
  • src/renderer/src/components/workspace-cleanup/workspace-cleanup-facets.ts
  • src/renderer/src/hooks/useIpcEvents-agent-status-snapshot-hydration.test.ts
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/lib/recent-workspace-tab-rows.test.ts
  • src/renderer/src/lib/recent-workspace-tab-rows.ts
  • src/renderer/src/lib/worktree-activity-state.test.ts
  • src/renderer/src/lib/worktree-activity-state.ts
  • src/renderer/src/lib/worktree-status.test.ts
  • src/renderer/src/lib/worktree-status.ts
  • src/renderer/src/runtime/sync-runtime-graph-agent-status-projection.test.ts
  • src/renderer/src/runtime/sync-runtime-graph.ts
  • src/renderer/src/runtime/web-session-tabs-sync-remote-status-title-flap.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync.ts
  • src/renderer/src/store/slices/agent-status-tool-assistant-fields.test.ts
  • src/renderer/src/store/slices/agent-status.ts
  • src/shared/agent-hook-listener.ts
  • src/shared/agent-hook-relay.test.ts
  • src/shared/agent-status-ipc-payload.ts
  • src/shared/agent-status-types.test.ts
  • src/shared/agent-status-types.ts
  • src/shared/agent-terminal-status-equivalence.test.ts
  • src/shared/agent-terminal-status-equivalence.ts
  • src/shared/claude-background-task-status.test.ts
  • src/shared/dashboard-snapshot.ts
  • src/shared/runtime-types.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Comment on lines +50 to +57
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>
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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 || true

Repository: 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.ts

Repository: 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:


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

Comment on lines +41 to +42
case 'monitoring':
return 'Monitoring background tasks'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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

Comment on lines +144 to +148
if (
entry.restoredUnconfirmed !== true &&
!isExplicitAgentStatusFresh(entry, now, AGENT_STATUS_STALE_AFTER_MS)
) {
continue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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)).

Comment on lines +103 to +110
// 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: []
})
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Suggested change
// 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)

Comment on lines +1399 to +1401
...(clientOwnsEntry && existing.state === 'working' && entry.state === 'working'
? { workingMode: entry.workingMode }
: {}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Suggested change
...(clientOwnsEntry && existing.state === 'working' && entry.state === 'working'
? { workingMode: entry.workingMode }
: {}),
...(clientOwnsEntry && existing.state === 'working' && entry.state === 'working'
? { workingMode: existing.workingMode }
: {}),

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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 win

Shorten 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.
@brennanb2025 brennanb2025 changed the title feat(agents): distinguish Claude background monitoring with a static turquoise dot feat(agents): distinguish Claude background monitoring (takes over #14205) Aug 24, 2026
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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Make smart-sort rank foreground work above monitoring. smart-attention.ts assigns both modes to Class 3, so monitoring can outrank foreground work by timestamp. Adding workingModeChanged to sortRelevantChange alone does not fix the ranking.

src/renderer/src/lib/recent-workspace-tab-rows.ts (1)

114-120: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Make focused-group MRU keys host-qualified.

RecentWorkspaceTabRow now supports the same worktreeId on multiple hosts. focusedGroupTabKey() still omits worktreeHostId.

If two hosts publish the same worktreeId and unifiedTabId, focusedGroupTabRecency stores 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 win

Reduce 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

📥 Commits

Reviewing files that changed from the base of the PR and between 76f77bf and 082b857.

📒 Files selected for processing (21)
  • mobile/src/components/AgentSpinner.tsx
  • mobile/src/components/AgentStateDot.tsx
  • mobile/src/components/agent-monitoring-indicators.test.ts
  • src/main/agent-hooks/server.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/ssh/ssh-relay-session-agent-hooks.integration.test.ts
  • src/renderer/src/components/AgentStateDot.test.ts
  • src/renderer/src/components/AgentStateDot.tsx
  • src/renderer/src/components/cmd-j/palette-live-status.test.tsx
  • src/renderer/src/components/dashboard-popout/agent-map.css
  • src/renderer/src/components/dashboard/DashboardAgentRow.test.tsx
  • src/renderer/src/components/sidebar/StatusIndicator.test.ts
  • src/renderer/src/components/sidebar/StatusIndicator.tsx
  • src/renderer/src/components/workspace-cleanup/workspace-cleanup-facets.ts
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/lib/recent-workspace-tab-rows.test.ts
  • src/renderer/src/lib/recent-workspace-tab-rows.ts
  • src/renderer/src/store/slices/agent-status.ts
  • src/shared/agent-hook-listener.ts
  • src/shared/agent-status-types.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Visual check of agent-status on 082b857570. Working is the animated spinner; monitoring is a static yellow Radio (not a spinner); done is the emerald check.

Sidebar agent rows + tab glyphs (Terminal 1 monitoring, Terminal 2 working, Terminal 3 done):

working / monitoring / done in one frame

monitoring-shot card close-up — Radio + “Monitoring background tasks”, spinner, emerald check:

sidebar close-up

@brennanb2025
brennanb2025 merged commit ec4687c into main Aug 24, 2026
51 checks passed
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 25, 2026
…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)
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
…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>
cjs0131 added a commit to cjs0131/orca that referenced this pull request Sep 7, 2026
…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.
cjs0131 added a commit to cjs0131/orca that referenced this pull request Sep 17, 2026
…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).
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants