Repository navigation
fix(sessions): avoid blocking completion recovery on archive metadata - #160238
Conversation
Move durable archive registration and source discovery into the existing history worker. Capture source custody before waiting, preserve the empty archive fast path, and keep incognito preflight with its native owner. Cover source replacement, owner retirement, archive integrity, and the registered requester yield/resume flow without changing stored data.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 28, 2026, 5:39 AM ET / 09:39 UTC (Revision 3). ClawSweeper reviewWhat this changesMoves durable archive discovery and registration checks into the session history worker, binds the final read to the selected database, and adds regression coverage. Merge readiness⛔ Blocked before merge - 2 items remain Keep open. Current main still reads archive metadata synchronously during completed-child answer recovery. This PR addresses that path, and the review found no discrete patch defect. Priority: P2 Review scores
Verification
How this fits togetherWhen a child agent finishes, OpenClaw may recover its final answer from an archived transcript. The session archive accessor selects the agent database, checks for an archive, and passes the read result back to completion handling. flowchart LR
A[Child completion] --> B[Archive lookup]
B --> C[Store selection]
C --> D{History worker finds archive?}
D -- No --> E[No archived answer]
D -- Yes --> F[Archive reader]
F --> G[Parent answer]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +201, Tests +148, Docs +8. Total +357 across 9 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the worker-owned archive preflight once native admission accepts the inherited CI failure, preserving the incognito owner and physical database identity checks. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main synchronously queries archive registration in the completed-child lookup, and the PR reports measured host SQL calls before and after the change. This review did not execute the scenario. Is this the best way to solve the issue? Yes. The patch uses the existing history worker and archive selector, preserves process-owned incognito reads, and checks database identity and retirement before using a result. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4dbabc40f6fd. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…openclaw#160238) Move durable archive registration and source discovery into the existing history worker. Capture source custody before waiting, preserve the empty archive fast path, and keep incognito preflight with its native owner. Cover source replacement, owner retirement, archive integrity, and the registered requester yield/resume flow without changing stored data.
Related: #149506
What Problem This Solves
Completed-child answer recovery still reads archive registration and physical store ownership synchronously on the Gateway thread before scanning an archived transcript.
User Impact
Durable archive preflight now runs in the existing history worker. Missing and empty archives still skip archive-reader startup. Positive reads retain their original physical database and logical session through discovery, metadata reads, integrity verification, and cleanup. Stored data, schemas, retention, and update behavior are unchanged. Incognito preflight continues through its existing process-owned native owner.
Why This Change Was Made
The async facade captures filesystem candidates and identities before its first wait, then reuses the canonical archive selector in the history worker. The final archive reader receives that same identity. A same-content database replacement cannot become the lookup's source, and a result held after real metadata acknowledgement cannot escape owner retirement. The existing empty-archive behavior is preserved.
Evidence
prepare,exec,get,all,run, anditerate, excluding fixture setup and cleanup.sessions.sendyield/resume regression passes with no archive-reader dispatch: 1.912s test time, 31.443s command wall time.node scripts/check-changed.mjs --base 45b00bdd13c17000884d362f6aaef3a5a7de32eapasses, including core plus all 25 test type graphs, lint, export checks, and runtime import-cycle checks.pnpm buildpasses. Independent review found no actionable P0–P2 findings.Runtime and build proof used an independent Linux/Node 24.19 checkout with a frozen pnpm 12.5.1 installation and source hashes verified between phases. A local Mac Gateway attempt stalled before fixtures; the isolated Linux run completed without changing test timeouts.
Exact-head CI attempt 1 failed four existing daemon retained-custody cases. The original 18-file CI group reproduces exactly those four failures on its unchanged main baseline (
c136ec63146424aafdbeccd48d2f4f9c59fbaa22): 876 passed, 4 failed, 29 skipped. The failure inputs are identical in the tested merge. Fail-fast cancelled sibling coverage; the subsequent missing-proof upload failure is explicitly retained in the native evidence packet: its producer was skipped and neither declared output existed. The maintained native route revalidates this cancellation qualification, security, and required reviews before admission. CI is not green, and no cancelled coverage is claimed as passing.