Skip to content

fix(sessions): skip archive workers when no archive exists - #149506

Merged
steipete merged 1 commit into
mainfrom
fix/yield-resume-residual-registry-root
Sep 16, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/yield-resume-residual-registry-root

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Related: #149223

What Problem This Solves

Fixes intermittent yield/resume settlement failures when a child session has no registered transcript archive.

Fixes the main CI failure in run 35028916689: resumes a yielded child through sessions.send and wakes its original parent failed with AssertionError: residual registry roots: expected 1 to be +0 at head 891d3732136.

User Impact

Session completion and parent wake-up avoid unnecessary archive-reader startup when no archive exists. Reads for sessions with registered archives retain their existing behavior. No configuration changes or migration are required.

Why This Change Was Made

Regression introduced by #149223 (31172cf5446). Requester settlement began awaiting exact-run answers, whose result lookup can fall back to transcript-archive reads. With no registered archive, that fallback still started archive read Workers—six observed in this fixture—holding completion and wake roots past the test-support's one-second vi.waitFor deadline on slower hosts.

Check the registered archive metadata in the agent database before starting a Worker and return undefined when none exists. The existing yield/resume regression also asserts that this empty-archive flow performs zero archive-worker reads.

The test-side settlement stabilization landed separately in #149558. This PR preserves that stabilization, removes the root cause by avoiding archive Worker startup when no archive exists, and asserts that no worker is started.

Evidence

  • The yield/resume regression in src/gateway/server-methods/sessions.send-yield-resume.test.ts reproduced the residual-root failure in 1 of 5 runs on clean main and passes 5 of 5 runs with the fix.
  • The archive-read suite passes all 3 tests, covering the existing archive behavior.
  • node scripts/check-changed.mjs exited 0.
  • Codex autoreview: scoped-clean.

After resolving the test conflict with #149558, the yield/resume regression passed 5 of 5 fresh runs and node scripts/check-changed.mjs exited 0 on head a33bcfaeb8b1162f9d41dac63967e19849e0236d. Fresh Codex autoreview of the resolved integration returned scoped-clean.

Exact-head CI run 35051123429, attempt 1, completed successfully on a33bcfaeb8b1162f9d41dac63967e19849e0236d; the native CI watcher returned GREEN.

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

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. 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, 11:23 PM ET / September 16, 2026, 03:23 UTC (Revision 3).

ClawSweeper review

What this changes

Checks registered transcript metadata before starting an archive reader and extends the session-resume regression to verify that missing archives trigger no worker reads.

Merge readiness

✅ Ready for maintainer review

Keep open: the optimization remains absent from current main, and the resolved integration preserves the merged settlement-test improvements. No blocking correctness or security findings remain; the previous merge-conflict blocker is resolved.

Priority: P2
Reviewed head: a33bcfaeb8b1162f9d41dac63967e19849e0236d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with relevant regression coverage, preserved integration assertions, and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies this as maintainer-authored, so the external-contributor proof gate does not apply. Reported focused tests cover empty archive dispatch and positive archive reads; no live runtime execution was performed in this review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies this as maintainer-authored, so the external-contributor proof gate does not apply. Reported focused tests cover empty archive dispatch and positive archive reads; no live runtime execution was performed in this review.
Evidence reviewed 9 items Introduced change verified: The pinned merge-base-to-head diff contains only the metadata precheck and the archive-worker assertion added to the existing resume test.
Matching lookup and preserved integrity: The precheck uses the worker’s existing selector and logical-agent filter. Positive reads still obtain a worker read snapshot, verify the registered hash and session header, and select the requested run’s visible answer.
Committed metadata and lifecycle preserved: The read-only database owner reads committed rows without creating or migrating a writable store. The new lookup remains inside the existing archive-session lifetime, and positive worker dispatch retains its current-owner checks.
Findings None None.
Security None None.

How this fits together

Subagent completion reads the selected run’s answer from its transcript, falling back to retained archives. The archive reader feeds that answer into parent settlement and wake-up.

flowchart TD
  A[Child run completes] --> B[Read live transcript]
  B -->|Answer missing| C[Check registered archive metadata]
  C -->|Absent| D[Return existing retained-result fallback]
  C -->|Present| E[Worker reads and validates archive]
  E --> F[Parent settlement and wake-up]
  D --> F
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +18, Tests +3. Total +21 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 18 0 +18
Tests 1 3 0 +3
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 21 0 +21

Review metrics

None.

Technical review

Best possible solution:

Keep archive existence checks in the existing session-history owner while retaining worker-based decoding and integrity validation for registered archives.

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

Yes for unnecessary worker dispatch: current-main source unconditionally enters the worker path when an exact-run lookup falls back to an absent archive. The intermittent settlement timeout was reported in the supplied validation, not independently reproduced here.

Is this the best way to solve the issue?

Yes. Reusing the existing metadata query avoids empty worker startup without adding a cache, changing persisted data, or replacing the positive-read path.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: Avoids unnecessary archive-worker startup during child completion with a narrow session-lifecycle improvement.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies this as maintainer-authored, so the external-contributor proof gate does not apply. Reported focused tests cover empty archive dispatch and positive archive reads; no live runtime execution was performed in this review.

Evidence

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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 (2 earlier review cycles)
  • reviewed 2026-09-15T23:32:25.842Z sha ff401c7a5e95bc941def1ff11fbe0224c2892a91 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-16T03:10:36.149Z sha 71524e8d23ea60b4f71feeb0f9cdb2702993f247 :: blocked before merge. :: none

Check committed archive identities before dispatching the archive reader,
while retaining the captured archive session and positive-read integrity
checks. Missing child transcripts no longer start cold workers that keep
subagent cleanup and requester-wake roots alive unnecessarily.

The exact-run answer reads added by 31172cf exposed this timing race.
The existing sessions.send yield/resume regression reproduced the residual
root assertion on one of five clean-main runs; it now also asserts that
this empty-archive flow never dispatches an archive reader.

Validation: yield/resume test 5/5; archive-read suite 3/3;
node scripts/check-changed.mjs; independent review clean through P2.
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 16, 2026
@steipete
steipete force-pushed the fix/yield-resume-residual-registry-root branch from 71524e8 to a33bcfa Compare September 16, 2026 03:15
@steipete
steipete merged commit a0bd4fb into main Sep 16, 2026
200 of 201 checks passed
@steipete
steipete deleted the fix/yield-resume-residual-registry-root branch September 16, 2026 03:51
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
…149506)

Check committed archive identities before dispatching the archive reader,
while retaining the captured archive session and positive-read integrity
checks. Missing child transcripts no longer start cold workers that keep
subagent cleanup and requester-wake roots alive unnecessarily.

The exact-run answer reads added by bca4493 exposed this timing race.
The existing sessions.send yield/resume regression reproduced the residual
root assertion on one of five clean-main runs; it now also asserts that
this empty-archive flow never dispatches an archive reader.

Validation: yield/resume test 5/5; archive-read suite 3/3;
node scripts/check-changed.mjs; independent review clean through P2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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