Skip to content

fix(notifications): hold "finished" until background subagents and worker waits are done - #36992

Merged
AmoabaKelvin merged 1 commit into
mainfrom
notify-settled-completion
Nov 1, 2026
Merged

AmoabaKelvin merged 1 commit into
mainfrom
notify-settled-completion

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​488 $\color{#cf222e}{\Huge{\mathbf{−}}}$​107 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​381
Prod 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​403 $\color{#cf222e}{\Huge{\mathbf{−}}}$​104 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​299

ELI5

Orca told you "Claude finished" every time the agent stopped talking, even when it had left helpers running in the background and was about to wake itself up again. A coordinator waiting on workers got one "finished" per worker message. Now "finished" goes out once, when the agent and its helpers are actually done. Questions and permission prompts still alert straight away, and a dev server left running doesn't keep a turn you asked for from alerting.

What Changed

Before: a turn that ended while a background subagent or a background orca orchestration check --wait was still running raised "finished". Every turn the agent started by itself (a subagent or command reporting back) raised another. In Kelvin's three busiest coordinators, 158 of 220 turns were self-started, and each alerted.

After: "finished" fires when the combined status row is done. The exceptions:

  • A turn the user started still alerts if only monitoring work is left (dev servers, watch loops, Monitor tool, crons).
  • A failed turn alerts immediately.
  • A turn the agent started itself that ends with only a monitor still running stays quiet, because that monitor will wake it again.

Live subagents and a background orca orchestration check --wait hold the alert. Permission and question prompts are unchanged.

Mechanism, terminal lane (Claude hooks, OSC 7501 agents):

  • One shared predicate, heldTurnCountsAsFinished (agent-lead-status-fold.ts), decides whether a turn held open by live work counts as finished.
  • claude-events.ts stamps turnCompletedAt (the "announce now" stamp every consumer reads) only when that predicate says so, and the OSC 7501 projector does the same. Subagent-held turns therefore announce on the ordinary all-clear done, after the wake-up turn that consumes the last result. The existing owed-notification debt already keeps the row working until then.
  • A background orca orchestration check --wait is tagged on Claude's launch record, from PostToolUse tool_input.command or, after a listener restart, from Stop's background_tasks[].command. It counts as agent work, not monitoring.
  • External-conversation connectors still relay every lead turn's reply. TerminalAgentTurnNews gets an everyLeadTurn option that reads the row's own mainAgent done instead of the notification stamp.

Mechanism, chat lane (Claude SDK, Codex app-server):

  • The host completion feed holds a successful settled request while the same predicate says it isn't finished, using the status feed's child work. It re-checks whenever child work is published, so a Codex parent, which has no wake-up turns, is announced once when its children drain.
  • Claude chat opens the lead's wake-up turn at the task_notification of a task the lead launched, instead of seconds later at its first output. A subagent's ending is taken from that notification, not the task_updated a millisecond before it. A task's ending wakes the subagent that launched it, resolved through the translator's existing child-tool owner registry.
  • A background orca orchestration check --wait is reported with the canonical operation orca orchestration check --wait, which the shared liveness counts as agent work.

Why

Root cause: both completion owners announced the lead's turn end instead of the combined row.

  • Terminal: since fix(agent-status): announce Claude turn complete while background work runs #14580, claude-events.ts stamped any Stop held open by running child work, and each self-started wake turn ended in a fresh done.
  • Chat: the host feed announced every settled request without reading child work, and Claude chat only opened the wake turn at the lead's first output.
  • In both lanes, a background check --wait was classified as a plain shell (monitoring).

Design note (from a design challenge with Codex as blind designer and attacker, two rounds, then four review rounds):

  • Chosen: fix it at each owner of the "announce now" decision, the hook listener and OSC projector stamp, and the host chat feed. Notification consumers (renderer, headless phone push) need no change. One shared predicate keeps the lanes from drifting.
  • Ruled out:
    • Consumer-side suppression of stamps: misses the headless phone push and connectors, and leaves producers advertising "announce now".
    • Recognising the wait through the runtime's mailbox waiter: the CLI registers its waiter after the process starts, so it races the turn end.
    • A new persisted child-work field for the wait: the existing operation carries it.
    • A user setting: Kelvin decided the new default with no setting.
  • [Bug]: A finished Claude turn stays unannounced while unrelated background work is alive — the working→done edge is deferred by the background agent's lifetime, and lost entirely for background shells #13245, a plain-text question behind a background agent: that turn now waits for the agent to drain and the agent's wake-up turn. Nothing non-heuristic marks prose as a question. Real question and permission prompts still alert immediately. The shell half of [Bug]: A finished Claude turn stays unannounced while unrelated background work is alive — the working→done edge is deferred by the background agent's lifetime, and lost entirely for background shells #13245 stays fixed: monitoring-only work never holds a user-started turn.
  • Wake-up-turn duplicate: settled by opening Claude chat's wake turn at the notification frame, ending children at their notification, and waking a subagent when a task it launched ends. Verified with real Claude chat, including a subagent that backgrounds its own shell.
  • Known edges (accepted):
    • A self-started final wake that ends with only an unrelated long-lived watcher still running stays silent until that watcher ends.
    • An old remote host paired with a new client keeps today's behaviour.
    • In Claude chat, a background subagent whose spawn call was evicted from the 512-entry tool registry, because the lead made 512 more top-level tool calls while it ran, can still alert twice.
  • Follow-ups (not here):
    • A terminal user turn held by an agent-teams teammate that then becomes monitoring-only with no new turn.
    • Codex goal turns are not marked self-started.
    • Mail-pointer-only terminal coordinators (out of scope by decision).

Linked Issue

Fixes #25663

Linear: STA-9570. Related: #13245, #26329. Supersedes the open community PRs for these issues.

Visual Proof

N/A: nothing on screen changes; the change is when desktop and phone notifications fire. I counted real notifications in a hidden dev build of this branch, reading every alert recorded in mobile-notification-dismissals.json:

Scenario (real agent) Turn ends "finished" alerts
Claude terminal: background subagent 3 (LAUNCHED, mid-run wake, SUBAGENT DONE) 1, after SUBAGENT DONE
Claude terminal: coordinator, background check --wait ×2 3 1, at ALL WORKERS DONE
Claude terminal: background dev server 1 1, at turn end
Claude terminal: question with a subagent running n/a needs-input alert at +9 s
Claude chat: background subagent 2 1, at SUBAGENT DONE
Claude chat: subagent that backgrounds its own shell 3 1, at SUBAGENT DONE
Claude chat: coordinator, background check --wait ×2 3 1, at ALL WORKERS DONE
Claude chat: background dev server 1 1, at turn end
Claude chat: question with a subagent running n/a prompt alert at +5 s
Codex chat: subagent outlives the parent turn 1 1, when the subagent finished
Codex terminal: subagent 1 1, after the subagent finished

Before, on main, replaying the real Claude 2.1.287 hook captures through the listener and the renderer's notification path: one subagent gave 2 alerts, a coordinator with 2 wakes gave 3, and the Monitor capture gave 5. The same replays now give 1, 1 and 2. In the Monitor case, the user turn that left the monitor running alerts, and so does the final turn after it ended.

Testing

  • Real runs above: Claude Code 2.1.316 and Codex 0.166 in a hidden (ORCA_BACKGROUND_LAUNCH=1) dev build on macOS, driven with orca agent launch. A stand-in orca script that blocks like check --wait kept the coordinator runs off any real mailbox.

  • Regression tests at the owners:

    • The listener stamp rule (agent hold, failure, coordinator wait including after a listener restart, wake turn left with a monitor).
    • Renderer notification replays of five real Claude captures plus a coordinator flow.
    • A host-level replay of the captured "subagent wakes after its own shell" frames through the real Claude adapter, translator and feed.
    • The chat feed hold (Codex-style drain, wait, failure, dev server, steer).
    • The decoder's notification-timed ending and wait tagging.
    • The OSC failure stamp.
    • The connector relaying a held turn's reply.
  • Focused suites and every dependent test of the changed modules pass (899 tests). check:code-quality:changed and check:react-doctor:changed are clean. CI covers the full suite, typecheck and Linux/Windows.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: no new inputs trusted. Wait recognition parses command text Orca already reads, and only Orca's own CLI name matches.
  • Cross-platform: no platform code. The launcher matcher reuses the browser command scanner, which accepts orca, orca-dev, orca-ide, .cmd and .exe.
  • Remote SSH and mixed versions: terminal status is decided on the host that runs the hooks, and chat completion on the chat host. No wire field is added or required. An old host with a new client keeps today's alerts, and a new host with an old client gets the new timing.
  • Mobile: phone pushes come from the same host decisions (chat feed, headless turn news), so they follow automatically.
  • Folder workspaces: unaffected.
  • Performance: the wait check returns early unless a command contains orchestration. The chat feed re-check on child-work publishes reads cached projections.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f96422bf-60e5-4efb-a4f5-c1caaabdf523
Commits

Reviewing files that changed from the base of the PR and between dce226f and 72f67cb.

Files selected for processing: 6
  • src/main/claude/claude-agent-wait-calls.ts
  • src/main/claude/structured/claude-structured-event-delivery.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-claude-subagent-row.test.ts
  • src/main/runtime/structured-agent-session-mobile-retirement.test.ts
  • tests/e2e/structured-attention-host-read-retirement.unit.test.ts
  • tests/e2e/structured-attention-read-retirement.test-fixture.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Walkthrough

The changes recognize Orca orchestration-wait commands and track background task state, including tasks that wait on worker agents. Claude child-work tracking defers some agent completion updates until task notifications and can wake a launcher after successful worker completion. Held-turn rules and structured completion feeds use live child-work state when deciding whether to announce a turn. Terminal turn news can also derive lead-turn completion timestamps when configured to report every lead turn.

Severity of issue fixed: Low

Merge Risk: Moderate · previous review 72f67

Completion notifications may arrive early, be suppressed, or leave a turn open. Resolve the remaining lifecycle concerns before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 60.87% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: delaying finished notifications until background subagents and worker waits complete.
Description check Passed The description is complete and directly addresses the template. It includes the user impact, implementation details, rationale, linked issue, visual proof, testing evidence, AI disclosure section, co…
Linked Issues check Passed Issue [#25663] requires Claude chat to withhold the "finished" notification while launched subagents remain active. StructuredAgentSessionTurnCompletionFeed reads child-work liveness and does not ac…
Out of Scope Changes check Passed The changes remain connected to completion-notification timing. Terminal stamp and OSC projection changes apply the same shared heldTurnCountsAsFinished policy to the other notification owner. Wait …
Full details: Description check

Explanation

The description is complete and directly addresses the template. It includes the user impact, implementation details, rationale, linked issue, visual proof, testing evidence, AI disclosure section, compatibility notes, and checklist status. It also explains that full lint, typecheck, test, and build checks are delegated to CI.

Full details: Linked Issues check

Explanation

Issue [#25663] requires Claude chat to withhold the "finished" notification while launched subagents remain active. StructuredAgentSessionTurnCompletionFeed reads child-work liveness and does not account for a successful settled request while heldTurnCountsAsFinished returns false. Child-work publication triggers another observation, so the completion is announced after the child work drains. ClaudeChildWorkDecoder ends background agents at task_notification, not the earlier terminal update, and the Claude chat row opens the wake-up turn at that notification. Tests cover live subagents and one final completion announcement.

Full details: Out of Scope Changes check

Explanation

The changes remain connected to completion-notification timing. Terminal stamp and OSC projection changes apply the same shared heldTurnCountsAsFinished policy to the other notification owner. Wait recognition classifies orca orchestration check --wait as agent work so the combined row remains held. Connector changes preserve each lead reply while suppressing duplicate finish announcements. Decoder, status, and fixture tests verify these paths. The reviewed evidence shows no unrelated product change.

Full details: Docstring Coverage

Explanation

Docstring coverage is 60.87% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 23 functions across 37 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@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: 2


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ed005e36-26bd-4723-a356-04f989d3924e
Commits

Reviewing files that changed from the base of the PR and between 6b56ba5 and 7b21843.

Files selected for processing: 31
  • src/main/claude/claude-background-stop-records.test.ts
  • src/main/claude/claude-child-work-decoder.test.ts
  • src/main/claude/claude-child-work-decoder.ts
  • src/main/claude/claude-structured-event-delivery.ts
  • src/main/claude/claude-structured-journal-translation.ts
  • src/main/external-conversations/external-conversation-events.ts
  • src/main/external-conversations/external-conversation-prompts.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-claude-subagent-row.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-client-delivery.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-recovered-turn-clock.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-turn-completion-child-work.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-turn-completion-feed.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-turn-completion-feed.ts
  • src/main/runtime/structured-agent-session-mobile-retirement.test.ts
  • src/main/runtime/terminal-agent-turn-news.ts
  • src/renderer/src/hooks/agent-hook-completion-background-turn-notifications.test.ts
  • src/shared/agent-hook-listener-claude-subagents.test.ts
  • src/shared/agent-hook-listener-claude-task-notification.test.ts
  • src/shared/agent-hook-listener/providers/claude-events.ts
  • src/shared/agent-hook-listener/providers/claude-pane-hold-evidence.ts
  • src/shared/agent-hook-listener/providers/claude-task-notification-delivery.ts
  • src/shared/agent-lead-status-fold.ts
  • src/shared/agent-session/requests/structured-agent-session-latest-request.ts
  • src/shared/agent-status-child-work-liveness.ts
  • src/shared/claude-background-task-inventory.ts
  • src/shared/claude-background-task-status.test.ts
  • src/shared/claude-owed-task-notifications.ts
  • src/shared/orca-browser-cli-commands.ts
  • src/shared/orca-cli-invocations.ts
  • src/shared/program-status/agent-status-projector.test.ts
  • src/shared/program-status/agent-status-projector.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Comment on lines +237 to +247
const notifiedToolUseId =
event.message.type === 'system' && event.message.subtype === 'task_notification'
? claudeText(event.message.tool_use_id)
: null
if (notifiedToolUseId && toolOrigins.has(notifiedToolUseId)) {
turn.ensureOpen(
event.message,
claudeStreamTurnSource(event.message),
event.observedAt ?? Date.now()
)
}

@coderabbitai coderabbitai Bot Nov 1, 2026 •

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.

Minor · Stability & Availability · Quick win

Supported by static analysis

Script executed:

#!/bin/bash
# Compare captured task_notification frames with and without a following lead wake.
rg -n -C4 "status: '(killed|stopped)'" src/main/claude --glob '*fixture*' --glob '*.test.ts'
rg -n -C3 "claudeChildWorkOutcome" src/main/claude

Repository: stablyai/orca

Length of output: 16352


Script executed:

set -eu
printf '%s\n' '--- translator ---'
nl -ba src/main/claude/claude-structured-journal-translation.ts | sed -n '190,275p'
printf '%s\n' '--- outcome mapping ---'
nl -ba src/main/claude/claude-child-work-evidence.ts | sed -n '1,65p'
printf '%s\n' '--- decoder end ---'
nl -ba src/main/claude/claude-child-work-decoder.ts | sed -n '285,355p'
printf '%s\n' '--- translator tests around task notifications ---'
rg -n -C8 --glob '*translation*.test.ts' -e 'task_notification' -e 'ensureOpen' src/main/claude || test "$?" -eq 1
printf '%s\n' '--- decoder tests around stopped/killed wake behavior ---'
nl -ba src/main/claude/claude-child-work-decoder.test.ts | sed -n '205,255p'

Repository: stablyai/orca

Length of output: 41880


Script executed:

set -eu
printf '%s\n' '--- decoder wakeOwner and notification path ---'
rg -n -C8 -F -- 'wakeOwner' src/main/claude
rg -n -C12 -F -- "subtype === 'task_notification'" src/main/claude/claude-child-work-decoder.ts
printf '%s\n' '--- turn API and settlement ---'
rg -n -C8 -e 'ensureOpen' -e 'class .*Turn' -e 'settle\\(' src/main/claude src/shared | head -240
printf '%s\n' '--- session end predicate ---'
rg -n -C8 -F -- 'claudeSessionStateEndsTurn' src/main/claude

Repository: stablyai/orca

Length of output: 3216


Script executed:

printf '%s\n' '--- ensureOpen and settle definitions ---'
rg -n -C8 -e 'ensureOpen' -e 'settle\\(' src/main/claude src/shared || test "$?" -eq 1
printf '%s\n' '--- session end predicate ---'
rg -n -C12 -F -- 'claudeSessionStateEndsTurn' src/main/claude || test "$?" -eq 1
printf '%s\n' '--- decoder observation calls ---'
nl -ba src/main/claude/claude-child-work-decoder.ts | sed -n '120,240p'

Repository: stablyai/orca

Length of output: 21837


Script executed:

rg -n -F -- 'ensureOpen' src/main/claude src/shared || test "$?" -eq 1
rg -n -F -- 'class ClaudeOpenTurn' src/main/claude src/shared || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 1046


Script executed:

nl -ba src/main/claude/claude-open-turn.ts | sed -n '1,235p'

Repository: stablyai/orca

Length of output: 9101


Do not open a turn for cancelled task notifications.

claudeChildWorkOutcome classifies killed and stopped notifications as cancelled. ClaudeChildWorkDecoder.end skips the owner wake for that outcome, but the translator still calls turn.ensureOpen for every known-origin task_notification. This can leave the turn open until a later settlement event.

Reuse claudeChildWorkOutcome(status) !== 'cancelled' before calling ensureOpen.

Suggested fix
 import { claudeSessionStateEndsTurn } from './claude-session-state-turn-over'
+import { claudeChildWorkOutcome } from './claude-child-work-evidence'
         const notifiedToolUseId =
           event.message.type === 'system' && event.message.subtype === 'task_notification'
             ? claudeText(event.message.tool_use_id)
             : null
-        if (notifiedToolUseId && toolOrigins.has(notifiedToolUseId)) {
+        const notifiedStatus =
+          event.message.type === 'system' && event.message.subtype === 'task_notification'
+            ? event.message.status
+            : null
+        if (
+          notifiedToolUseId &&
+          toolOrigins.has(notifiedToolUseId) &&
+          claudeChildWorkOutcome(notifiedStatus) !== 'cancelled'
+        ) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

+import { claudeChildWorkOutcome } from './claude-child-work-evidence'
const notifiedToolUseId =
event.message.type === 'system' && event.message.subtype === 'task_notification'
? claudeText(event.message.tool_use_id)
: null

  •    if (notifiedToolUseId && toolOrigins.has(notifiedToolUseId)) {
    
  •    const notifiedStatus =
    
  •      event.message.type === 'system' && event.message.subtype === 'task_notification'
    
  •        ? event.message.status
    
  •        : null
    
  •    if (
    
  •      notifiedToolUseId &&
    
  •      toolOrigins.has(notifiedToolUseId) &&
    
  •      claudeChildWorkOutcome(notifiedStatus) !== 'cancelled'
    
  •    ) {
    

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.

@MetrixAiforAll The proposed guard addresses the concern. It prevents killed and stopped notifications from opening a turn because claudeChildWorkOutcome maps both to cancelled. Other outcomes retain the existing known-origin check.

I have not verified that this patch is applied to the PR branch.

You are interacting with an AI system.

Comment on lines +84 to +86
...(turn.userItemId === item.itemId && !steeredInto(submissions, item.itemId)
? { selfStarted: true as const }
: {})

@coderabbitai coderabbitai Bot Nov 1, 2026 •

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.

Minor · Functional Correctness · Quick win

Supported by static analysis

Script executed:

#!/bin/bash
rg -n -C4 "answeredInTurn" src --glob '!**/*.test.ts'
rg -n -C3 "via: 'steer'|via === 'steer'" src --glob '!**/*.test.ts'

Repository: stablyai/orca

Length of output: 41967


Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- latest request ---'
nl -ba src/shared/agent-session/requests/structured-agent-session-latest-request.ts | sed -n '1,155p'
printf '%s\n' '--- submission type ---'
nl -ba src/shared/agent-session/journal/agent-session-journal-types.ts | sed -n '390,435p'
printf '%s\n' '--- steer producer and callers ---'
nl -ba src/main/codex/codex-structured-turn-start.ts | sed -n '70,125p'
rg -n -C6 --glob '!**/*.test.ts' -e 'startCodexStructuredTurn' -e 'codexStructuredTurnStart' -e 'via: .*steer' -e 'answeredInTurn' src/main src/shared
printf '%s\n' '--- settlement contracts ---'
nl -ba src/main/native-chat/agent-session-wire/structured-agent-session-operation-settlement.ts | sed -n '110,175p'
nl -ba src/main/native-chat/agent-session-journal/journal-row-builders.ts | sed -n '120,165p'

Repository: stablyai/orca

Length of output: 41759


Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- remaining Codex turn start ---'
nl -ba src/main/codex/codex-structured-turn-start.ts | sed -n '112,230p'
printf '%s\n' '--- selfStarted consumers ---'
rg -n -C8 --glob '!**/*.test.ts' -F 'selfStarted' src
printf '%s\n' '--- accepted outcome construction ---'
rg -n -C8 --glob '!**/*.test.ts' -e "state: 'accepted'" -e 'providerIdentity' src/main/codex src/main/native-chat src/shared/agent-session

Repository: stablyai/orca

Length of output: 41530


Persist steer linkage on accepted dispatches.

A successful steer returns via: 'steer', but accepted dispatches cannot carry answeredInTurn, and journal rows store that field only for rejected dispatches. An accepted steer can therefore leave selfStarted: true. Completion handling then waits for monitoring work instead of treating the user-steered turn as finished. Store the steer linkage on accepted submissions or derive it from another persisted user-message signal. An accepted test fixture that includes answeredInTurn does not match the accepted dispatch contract.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

successful steer returns via: 'steer', but accepted dispatches cannot carry answeredInTurn, and journal rows store that field only for rejected dispatches. An accepted steer can therefore leave selfStarted: true. Completion handling then waits for monitoring work instead of treating the user-steered turn as finished. Store the steer linkage on accepted submissions or derive it from another persisted user-message signal. An accepted test fixture that includes answeredInTurn does not match the accepted dispatch contract.

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.

@MetrixAiforAll Would you like me to implement the steer-linkage fix, recheck the finding, or explain the failure path?

You are interacting with an AI system.

@AmoabaKelvin
AmoabaKelvin force-pushed the notify-settled-completion branch from 7b21843 to 8ee5182 Compare November 1, 2026 10:51

@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: 3


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0f6e5fb9-ab59-4a17-9963-8311c6fc7933
Commits

Reviewing files that changed from the base of the PR and between 7b21843 and 8ee5182.

Files selected for processing: 7
  • src/main/agent-hooks/server-last-status-lead-boundary.test.ts
  • src/main/claude/claude-agent-wait-calls.ts
  • src/main/claude/claude-background-task-rows.ts
  • src/main/claude/claude-child-work-decoder.ts
  • tests/e2e/structured-attention-host-read-retirement.unit.test.ts
  • tests/e2e/structured-attention-read-retirement.test-fixture.tsx
  • tests/e2e/structured-attention-read-retirement.unit.test.ts

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

@AmoabaKelvin
AmoabaKelvin force-pushed the notify-settled-completion branch 3 times, most recently from dce226f to 72f67cb Compare November 1, 2026 15:29
@AmoabaKelvin
AmoabaKelvin force-pushed the notify-settled-completion branch from 72f67cb to dc095a9 Compare November 1, 2026 15:51
@AmoabaKelvin
AmoabaKelvin merged commit d95e232 into main Nov 1, 2026
57 checks passed
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 2, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 3, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pawel-kotowski added a commit to pawel-kotowski/orca that referenced this pull request Nov 4, 2026
…h as running work

Publishing or watching a claude.ai artifact arms a live-updates watch that
Claude lists in background_tasks as a running monitor until the session
exits. Orca counted it as live work, so the pane sat in "monitoring" for
the rest of the session. The inventory now skips it, as Claude's own task
footer does (stablyai#26192).

The other half of the earlier local fix (announce a turn only when it is
not waiting on its own work) is dropped: upstream stablyai#36992 replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.

[Bug]: Finish notification should not be sent while subagents are active

2 participants