Skip to content

Agent status C1: keep child completion separate from the parent turn - #21053

Closed
brennanb2025 wants to merge 7 commits into
mainfrom
brennanb2025/agent-status-c1-turn-ownership
Closed

brennanb2025 wants to merge 7 commits into
mainfrom
brennanb2025/agent-status-c1-turn-ownership

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

When a coding agent launches a child task or leaves a background job running, the child finishing must not make Orca say the whole parent task is finished. This draft adds the shared rules needed to keep the parent turn, finite child tasks, long-running background work, interrupt acknowledgement, and automation completion separate.

This is a foundation only. It is not connected to live agent events or any desktop, CLI, or mobile reader yet, so it does not fix the visible false-completion symptoms on its own.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​654 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​654
Prod 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1744 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1744

User-facing before / after

Before this PR: Orca's status paths have no shared data model that can say “the parent turn ended, but its monitor is still running” or “a child ended, but this automation has not.” A pane-level done report can therefore be mistaken for completion of unrelated work.

After this PR: shared code can represent and test those facts independently. A child completion updates that child; resident background work can outlive the foreground turn; a dispatch needs its own receipt before settlement; lost contact remains unverifiable; and recovery expires or is explicitly abandoned instead of retrying forever.

What users will see now: no standalone UI change. Provider event ingestion and production ownership still need to be connected before the sidebar, notifications, automations, CLI, or mobile app can use this result.

Issue records

No issue is fully fixed or closed by this PR. The reducer directly models the lifecycle distinctions needed by these verified reports, but production wiring and provider-specific acceptance tests remain open:

  • STA-3344 — an interrupt must not discard still-running background work.
  • STA-3524 — replayed completion needs a stable identity so it does not notify again.
  • STA-7259 — a nested or intermediate Grok stop must not finish the parent pane.
  • STA-6158 — a nested codex exec exit must not settle its automation.
  • STA-2108 — an intermediate Codex stop must not become final task completion.
  • STA-6378 — asynchronous Pi children must remain distinct from the parent becoming interactive.
  • STA-2794 — monitors, shells, approvals, and plans can outlive a Claude turn.
  • STA-7205 — unrelated same-pane status must not settle an automation.
  • STA-6161 — a fresh Hermes run needs attributable start and completion evidence.
  • STA-3167 — SSH restart recovery needs complete attributable child state.

These records are related but still require separate work: STA-6666 is a reproduction-first check of structured Claude interrupt behavior; STA-1761 also needs child-row cleanup and navigation; STA-7182 is a future announcement, not a status-engine fix.

Why this mechanism

The reducer keeps facts separate and only combines them when a caller asks a specific question. That is safer than adding another provider-specific “keep working” exception, draining every child before a parent may finish, or extending a timer: those approaches still cannot tell which execution or turn an event belongs to, and they either end unrelated work early or keep completed work alive indefinitely.

Events must name the execution host, run, attachment, and turn they belong to. Missing or incomplete evidence stays unknown. The lifecycle also gives every recovery obligation an exit through new evidence, a deadline, or explicit abandonment. This follows the existing execution-host ownership boundary, but it does not yet prove provider delivery, restart recovery, or remote replication.

Scope, dependencies, and remaining work

  • Implemented and unit-tested here: the shared lifecycle contract, pure reducer, runtime validation, bounded replay/inventory state, snapshots, and deterministic transition tests.
  • Not implemented here: production registration, provider adapters, restart hydration, notification checkpoints, host replication, reader changes, or rendered UI behavior.
  • C2 supplies provider evidence and recovery; C5 binds the committed execution owner; C10 uses that same owner for membership; C7 replicates the host result to readers. C5's earlier foundation overlaps the combined C5/C10 branch, so those two should not be recommended for independent merge without consolidation.
  • Current production call-site search finds no non-test caller of the reducer. This branch is therefore not a shippable vertical slice yet.
  • The first conflict audit used fetched origin/main at 383c543e0f6651a6c2d99ecca5ab43fbedd1bee8. A final merge simulation was also clean after the shared fetched ref advanced to descendant 36cdb34097a7075718abe41c29d559101841166a; no unnecessary merge commit was added.

Validation at this revision

Freshly run at 7c0d9907a1789a536237ca51e7ce2c20fab45010:

  • ORCA_BACKGROUND_LAUNCH=1 pnpm test src/shared/agent-turn-lifecycle-reducer.test.ts — 19 tests passed.
  • ORCA_BACKGROUND_LAUNCH=1 pnpm tc:node — passed.
  • ORCA_BACKGROUND_LAUNCH=1 pnpm run check:code-quality:changed — passed with zero new findings across 13 changed code files.
  • Merge-tree and conflict-marker checks were clean. git diff --check also ran and reports a pre-existing extra blank line at the end of the committed AGENT_STATUS_C1_REVIEW.md; no product conflict markers were found.

These checks support functional correctness of the reducer itself. They are not independent review, production integration proof, remote mixed-version validation, or Electron/mobile QA. The existing root-directory CI guard is still failing, and the final production-integrated head still needs independent review plus background/hidden Electron QA if it introduces a rendered flow.

Draft status

Draft / not merge-ready. The reducer-level review findings were fixed, but production ownership, delivery, lifecycle cleanup, restart recovery, remote compatibility, and reader integration remain open. Opening and updating this PR does not mark the C1 issue group complete.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review and validation handoff — 2026-09-16

Draft / not merge-ready. Published at the user's request before review/QA completion. Published head: 7c0d9907a1789a536237ca51e7ce2c20fab45010.

What has been done

Independent review-and-fix reported lifecycle reducer corrections and 19 conformance tests, node typecheck and changed-code quality passing at implementation be012b9. This validates the reducer seam, not full production integration.

These are recorded worker/reviewer results from the stated revisions, not a fresh coordinator rerun, CI result, or blanket approval of today's PR head. Recovery/review workers used GPT-5.6 Sol xhigh; provider interruptions prevented some follow-up stages from finishing.

What still needs to be done

Production owner admission, provider ingress, restart/replay recovery and host replication remain unwired or dependent on other batches. Reconcile the C1/C2 shared reducer variants and latest main; finish integration, independent final-head review and fresh Electron QA.

Before marking ready: address proven findings, reconcile current main and cross-batch overlap, complete independent review of the final diff, rerun relevant tests/typechecks/quality, and perform fresh manual Electron QA against that exact head. Use background/hidden CDP validation; unavailable auth/platform scenarios remain explicitly unverified. No successful final-head review or QA should be inferred from old report filenames or task completion labels.

Related batch PRs

C1: #21053 · C10: #21054 · C2: #21056 · C3: #21055 · C4: #21057 · C5: #21058 · C6: #21059 · C7: #21060

The remaining full-batch work stays open; opening this draft does not mark those requirements complete.

@brennanb2025

brennanb2025 commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Conflict/description update: head remains 7c0d9907a1789a536237ca51e7ce2c20fab45010; the first fetched integration baseline was origin/main at 383c543e0f6651a6c2d99ecca5ab43fbedd1bee8.

GitHub reports this PR mergeable, and local merge-tree checks were clean at that baseline and after the shared fetched ref advanced to descendant 36cdb34097a7075718abe41c29d559101841166a. There were no conflict files or resolution commits, so I did not add an unnecessary merge from main. I rewrote the title/body in plain language, linked the verified C1 issue roster, separated foundation coverage from unresolved user-visible fixes, and preserved draft status.

Fresh checks: focused lifecycle reducer test (19 passed), pnpm tc:node, changed-file code quality (0 new findings), git diff --check, and conflict-marker scan. The merge and marker checks were clean; git diff --check reported a pre-existing extra blank line at the end of the committed AGENT_STATUS_C1_REVIEW.md. Remaining blockers: no production caller yet; provider/owner/restart/replication and reader wiring remain; root-directory CI guard is failing; final integrated head still needs independent review and any applicable hidden/background Electron QA.

The root directory guard blocks new top-level entries. These two files are
worker/review reports, not shipped artifacts; they stay as local untracked
evidence instead.
…and latch integrity on the turn

A recovery custody could only be released by an explicit expiry event from the
producer that opened it. If that producer died, the turn stayed 'recovering' and
every dispatch on it stayed 'unresolved' for the life of the process. The
deadline is now re-derived on each event, so the obligation can die on its own.

Settlement also consulted the integrity-issue ring, which is a bounded
diagnostic collection that evicts its oldest entries. A correctness gate cannot
live in an evictable ring, so the breach is now latched on the turn record and
the ring stays purely diagnostic.

Also stop stamping a new timestamp onto prior evidence when marking work
unresolved: that produced a producer/event/time tuple that never occurred.
Unresolved marking now carries the evidence that caused it.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing this draft from the September 14 agent-status plan. That plan was re-examined against current main and replaced.

This branch conflicts with main, and its central work duplicated contracts that had already merged (the canonical status store and the child-work contract landed on 15–16 September). The replacement work is being done as smaller root-cause PRs, each planned, challenged and reviewed first.

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.

1 participant