Skip to content

fix: finish yielded tasks and identify failed child sessions - #149261

Merged
steipete merged 2 commits into
mainfrom
codex/fix-yielded-task-lifecycle
Sep 15, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/fix-yielded-task-lifecycle

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Related: #147871, #140137.

What Problem This Solves

A nested subagent could finish its work but remain listed as running when its child completed just as it yielded. The sidebar also labeled an ancestor “Run failed” when only a descendant had failed.

User Impact

Yielded continuations finish the original task and deliver its result to the original requester. Parent warnings identify the failed child, while reading that child clears the inherited attention normally. Existing waits stranded by older versions require an explicit continuation through sessions.send to reconcile their retained results.

Why This Change Was Made

Requester settlement now persists the paused requester together with its child wake batch before dispatch. Gateway admission can therefore adopt the original task even when its predecessor's lifecycle-end event arrives later. Persistence rollback, cancellation, and newer-generation guards remain intact. The sidebar carries the descendant label through its existing attention projection without changing stored error state. A CI follow-up supplies deterministic time and the native cleanup response in a Codex attribution fixture; production deadlines are unchanged.

Evidence

  • The regression fails before the fix through the registered Gateway handler and canonical SQLite task store; afterward the same task succeeds, delivers once, and stays terminal after a late predecessor yield event.
  • Feature validation before the patch-identical rebase passed 1,115 selected tests: 627 Gateway, yield, lifecycle, continuation and cancellation checks; 488 UI checks.
  • Real Chrome synthetic proof covers nested error attribution, the child's own error, roster tooltip, and read dismissal.
  • pnpm build passed, including production UI asset budgets; node scripts/check-changed.mjs passed all typechecks, lint, schema, dependency and import guards.
  • Independent P2 review found no actionable issues.
  • CI exposed pre-existing fixture failures now fixed on main by fix(subagents): resume yielded tasks after slow Gateway admission #149208, test(qa): create child-bundle evidence through the test API #149243, and fix: PR workflow tests fail during repository identity checks #149294. Their relevant local checks passed; the duplicate GitHub fixture commit was dropped when fix: PR workflow tests fail during repository identity checks #149294 landed.
  • The retained Codex attribution fixture repair from fix(ui): clear saved automation timeout overrides #149274 controls test time and supplies the native terminal inventory response. All 29 selected tests and scoped changed-file gates passed, with a fresh clean P2 review. Production deadlines are unchanged.
  • Both retained commits are patch-identical to their reviewed versions after the final rebase. The original Gateway/SQLite race regression and both Codex attribution cases passed again (3 tests). The preceding hosted run passed the formerly failing Codex shard and had no reported failures before supersession.
  • Current-head CI passed, including browser tests against a real Gateway and the complete selected validation matrix.
Before After
Ancestor incorrectly labeled as failed Ancestor identifies the failed child

@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: L maintainer Maintainer-authored PR labels Sep 15, 2026
@steipete
steipete marked this pull request as ready for review September 15, 2026 16:20
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 2:35 PM ET / 18:35 UTC (Revision 6).

ClawSweeper review

What this changes

The PR repairs nested task completion during yield, identifies failed child sessions in sidebar warnings, documents recovery, and stabilizes a Codex attribution test.

Merge readiness

✅ Ready for maintainer review

This remains a useful, distinct repair absent from the fetched main revision. No actionable introduced defect was found, and the related merged fixes do not supersede it.

Priority: P2
Reviewed head: 41ebfb36e7d519354dd4b7dc8e45c6b510ee37ea

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with directly visible UI proof and meaningful race coverage; no blocking defect was identified.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected Chrome before/after screenshots directly demonstrate the changed sidebar attribution. The reported Gateway/SQLite race regression exercises admission and task completion with synthetic execution and delivery; it is supplemental lifecycle evidence, not live-channel proof, and the maintainer-authored PR has no additional external-contributor proof gate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected Chrome before/after screenshots directly demonstrate the changed sidebar attribution. The reported Gateway/SQLite race regression exercises admission and task completion with synthetic execution and delivery; it is supplemental lifecycle evidence, not live-channel proof, and the maintainer-authored PR has no additional external-contributor proof gate.
Evidence reviewed 10 items Pause precedes wake scheduling: Settlement snapshots the matching running requester, excludes cancellation and newer generations, persists its pause with the child batch, and restores the snapshot if persistence fails.
Existing transactional storage and adoption: The existing SQLite writer commits named registry rows in one transaction. Gateway task tracking recognizes a paused settlement requester, and existing adoption preserves the original task and audience; the patch adds no persisted format or public API.
Race regression at Gateway admission: The added regression dispatches through the registered agent handler with canonical SQLite task storage and asserts original task identity, successful completion, one announcement, and terminal state after a late predecessor event. Model execution and announcement transport are synthetic; the reported passing runs were not rerun during this read-only review.
Findings None None.
Security None None.

How this fits together

The subagent registry carries delegated tasks across paused execution and asks the Gateway to admit their continuations. The Control UI projects session outcomes into sidebar warnings for users.

flowchart TD
  A[Child finishes] --> B[Requester yields]
  B --> C[Persist pause and child batch]
  C --> D[Gateway admits continuation]
  D --> E[Original task completes]
  F[Session outcomes] --> G[Sidebar attributes child failure]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +45, Tests +350, Docs +16. Total +411 across 21 files.

View PR surface stats
Area Files Added Removed Net
Source 9 132 87 +45
Tests 9 369 19 +350
Docs 3 16 0 +16
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 21 517 106 +411

Review metrics

Metric Value Why it matters
Production versus test growth Production +45 net lines; tests and test support +350 net lines Production growth connects existing lifecycle and presentation owners; most growth covers the timing race, rollback, attribution, and timeout behavior.

Technical review

Best possible solution:

Keep one durable task across yield and continuation, preserve cancellation and original-requester delivery, and attribute inherited warnings through the existing sidebar projection.

Do we have a high-confidence way to reproduce the issue?

Yes: source and the focused Gateway regression establish the completed-child-before-yield-end ordering that misses paused-task adoption. This review inspected that path without executing it.

Is this the best way to solve the issue?

Yes: moving the existing pause operation into the batch's durable settlement fixes the ordering at its owner, while sidebar attribution remains a derived presentation fact.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d363685cab9f.

Labels

Label justifications:

  • P2: This repairs a bounded nested-task timing failure and misleading child-error attribution without changing configuration or defaults.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected Chrome before/after screenshots directly demonstrate the changed sidebar attribution. The reported Gateway/SQLite race regression exercises admission and task completion with synthetic execution and delivery; it is supplemental lifecycle evidence, not live-channel proof, and the maintainer-authored PR has no additional external-contributor proof gate.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected Chrome before/after screenshots directly demonstrate the changed sidebar attribution. The reported Gateway/SQLite race regression exercises admission and task completion with synthetic execution and delivery; it is supplemental lifecycle evidence, not live-channel proof, and the maintainer-authored PR has no additional external-contributor proof gate.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected Chrome before/after screenshots directly demonstrate the changed sidebar attribution. The reported Gateway/SQLite race regression exercises admission and task completion with synthetic execution and delivery; it is supplemental lifecycle evidence, not live-channel proof, and the maintainer-authored PR has no additional external-contributor proof gate.

Evidence

What I checked:

  • Pause precedes wake scheduling: Settlement snapshots the matching running requester, excludes cancellation and newer generations, persists its pause with the child batch, and restores the snapshot if persistence fails. (src/agents/subagents/registry/subagent-registry-requester-yield.ts:115, 41ebfb36e7d5)
  • Existing transactional storage and adoption: The existing SQLite writer commits named registry rows in one transaction. Gateway task tracking recognizes a paused settlement requester, and existing adoption preserves the original task and audience; the patch adds no persisted format or public API. (src/agents/subagents/registry/subagent-registry.store.sqlite.ts:205, 41ebfb36e7d5)
  • Race regression at Gateway admission: The added regression dispatches through the registered agent handler with canonical SQLite task storage and asserts original task identity, successful completion, one announcement, and terminal state after a late predecessor event. Model execution and announcement transport are synthetic; the reported passing runs were not rerun during this read-only review. (src/gateway/server-methods/agent.sessions-and-models.test-utils.ts:555, 41ebfb36e7d5)
  • Inspected before and after UI proof: Opened both prepared images linked in the captured PR body. Before, both ancestors say “Run failed”; afterward, both identify “Source review” as the failed child while that child's own failure remains. The images directly support the presentation change, not backend lifecycle execution. Source snapshot identity: 7cc3ed274bbcf406d47e192bc709ee35961588537e3174e88fccfe10629580cb. (ui/src/components/app-sidebar-session-tree.ts:17, 41ebfb36e7d5)
  • Central fixes remain absent from main: The fetched main and pinned base have identical requester-settlement and sidebar-tree implementations. The reviewed branch adds the missing ordering and attribution behavior. The supplied latest release is v2026.9.4; no release inclusion is claimed for this unmerged repair. (src/agents/subagents/registry/subagent-registry-requester-yield.ts:110, d363685cab9f)
  • Dependency contract applies to the test repair: The changed registered Codex harness test explicitly simulates turn/interrupt, turn/completed, and thread/backgroundTerminals/list, establishing a concrete dependency-protocol signal. Its timeout case asserts the canonical timeout result without changing production deadlines. (extensions/codex/src/app-server/run-attempt.model-attribution.test.ts:157, 41ebfb36e7d5)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Erick Kinnee: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (5 earlier review cycles)
  • reviewed 2026-09-15T16:26:17.426Z sha 8428bde :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T16:46:51.912Z sha 61441c5 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T17:25:22.300Z sha c5b133b :: blocked before merge. :: none
  • reviewed 2026-09-15T17:48:21.601Z sha eb02a1deb5a690b247925a2fa29c317c15c92ded :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T18:16:04.474Z sha 41ebfb3 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/fix-yielded-task-lifecycle branch from 8428bde to 61441c5 Compare September 15, 2026 16:38
Adopt the test-only cleanup repair from #149274 and assert the canonical timeout result. Production deadlines and cleanup behavior are unchanged.
@steipete
steipete force-pushed the codex/fix-yielded-task-lifecycle branch from eb02a1d to 41ebfb3 Compare September 15, 2026 18:07
@steipete
steipete merged commit 3d3386a into main Sep 15, 2026
220 checks passed
@steipete
steipete deleted the codex/fix-yielded-task-lifecycle branch September 15, 2026 18:52
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 15, 2026
Adopt the complete fixture from #149349 and #149261 so merging the inventory branch retains one terminal-list response. Preserve the controlled completion/timeout cases and the original runtime budget.
steipete added a commit that referenced this pull request Sep 16, 2026
…48988)

* fix: keep environment inventory responsive during pairing cleanup

* test: include pairing snapshot in isolated gateway expectations

* fix: let profiler help drain pending cleanup

* test: preserve process events in runtime identity fixtures

* test: avoid loading QA runtime in receipt producers

* fix: repair native PR repository identity fixtures (#149294)

(cherry picked from commit 7dc8a1e)

* fix: keep Codex model attribution fixture focused (#149301)

(cherry picked from commit 273b6c5)

* test: align canonical model attribution fixture

Adopt the complete fixture from #149349 and #149261 so merging the inventory branch retains one terminal-list response. Preserve the controlled completion/timeout cases and the original runtime budget.

* test: provide dependencies for PR alias fixtures

Keep alias delegation cases on their intended supervisor boundary after code-only linked checkouts gained dependency materialization. Preserve exact arguments, exit status, and trust refusals; retain separate materializer coverage.

* test: retire superseded PR alias fixture setup

Canonical main already owns linked dependency setup before checkout. Remove the branch-local later setup so the merged fixture matches #149477 exactly, without changing the inventory or lifecycle implementation.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
…w#149261)

* fix: finish yielded tasks and attribute child failures

* test(codex): control model attribution timeout and cleanup

Adopt the test-only cleanup repair from openclaw#149274 and assert the canonical timeout result. Production deadlines and cleanup behavior are unchanged.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
…enclaw#148988)

* fix: keep environment inventory responsive during pairing cleanup

* test: include pairing snapshot in isolated gateway expectations

* fix: let profiler help drain pending cleanup

* test: preserve process events in runtime identity fixtures

* test: avoid loading QA runtime in receipt producers

* fix: repair native PR repository identity fixtures (openclaw#149294)

(cherry picked from commit 3df0afa)

* fix: keep Codex model attribution fixture focused (openclaw#149301)

(cherry picked from commit f778132)

* test: align canonical model attribution fixture

Adopt the complete fixture from openclaw#149349 and openclaw#149261 so merging the inventory branch retains one terminal-list response. Preserve the controlled completion/timeout cases and the original runtime budget.

* test: provide dependencies for PR alias fixtures

Keep alias delegation cases on their intended supervisor boundary after code-only linked checkouts gained dependency materialization. Preserve exact arguments, exit status, and trust refusals; retain separate materializer coverage.

* test: retire superseded PR alias fixture setup

Canonical main already owns linked dependency setup before checkout. Remove the branch-local later setup so the merged fixture matches openclaw#149477 exactly, without changing the inventory or lifecycle implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation extensions: codex gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant