Repository navigation
fix(sessions): preserve user input during restart recovery - #165502
Conversation
Retry invalidated subagent maintenance preparation through the existing bounded reply initialization owner. Keep unanswered external user rows separate from internal continuations and retain actionable input during ordinary orphan repair. Prove transient and exhausted registry churn through reply dispatch and preserve the original user message across repeated continuation attempts.
|
🦞👀 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: needs maintainer review before merge. Reviewed October 5, 2026, 6:31 AM ET / 10:31 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR retries invalidated session preparation, preserves unanswered user input during internal continuations, updates recovery documentation, and reorganizes regression coverage. Merge readiness✅ Ready for maintainer review The PR remains useful and has no identified blocking defect. Source inspection resolves the earlier migration concern: existing transcript rows remain readable, and recovery preserves their original identity without introducing a new durable format. Priority: P1 Review scores
Verification
How this fits togetherReply initialization prepares session state before dispatching incoming instructions to an agent. Transcript recovery combines saved conversation history with new user input or internal subagent announcements before provider submission. flowchart TD
A[Incoming instruction] --> B[Reply initialization]
C[Subagent maintenance facts] --> B
B --> D{Preparation current?}
D -->|No| E[Bounded refresh and retry]
E --> B
D -->|Yes| F[Transcript recovery]
G[Saved unanswered user input] --> F
F --> H[Agent provider input]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +32, Tests +300, Docs +7, Other +3. Total +342 across 21 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep one bounded initialization retry owner and preserve unanswered external input under its original transcript identity through internal continuations. Do we have a high-confidence way to reproduce the issue? Yes, from source: invalidate subagent maintenance facts during reply preparation, then continue a transcript ending in unanswered external input with a subagent announcement. The supplied negative controls cover both failures; this review did not execute them. Is this the best way to solve the issue? Yes. The patch repairs the existing retry and transcript owners without adding competing mechanisms, and existing-state inspection resolves the earlier migration concern. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 583abe2eba27. 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
HistoryReview history (1 earlier review cycle)
|
|
Maintainer note on the "Add data-model compatibility proof" item: the flagged file, |
|
Merged via squash.
|
…165502) Retry invalidated subagent maintenance preparation through the existing bounded reply initialization owner. Keep unanswered external user rows separate from internal continuations and retain actionable input during ordinary orphan repair. Prove transient and exhausted registry churn through reply dispatch and preserve the original user message across repeated continuation attempts.
What Problem This Solves
Fixes: an accepted chat instruction can fail during restart-related subagent registry activity and then be overlooked when a subagent announcement continues the conversation.
User Impact
Incoming replies re-read invalidated maintenance facts within the existing bounded initialization retry budget. If contention exhausts that budget, the visible error asks the user to retry. Saved, unanswered external user input stays actionable on the next run, including an announcement or requester-settle continuation.
Why This Change Was Made
Maintenance capture used an untyped error, bypassing reply initialization's optimistic-conflict handling. It now reports the existing maintenance-conflict type; reply initialization handles that known uncommitted conflict alongside its session-row conflict. Cancellation, admission identity, and uncertain-commit failures retain their existing behavior.
The orphan repair path previously detached the external user leaf and merged it into a synthetic continuation under a “context only” marker. Internal continuations now leave that user row in history with its original provenance. Ordinary user-turn repair identifies earlier unanswered input as actionable; routed inter-session data retains its existing treatment.
No schema, configuration, or durable format changes. Production LOC delta: +32 lines. Growth is required to distinguish external input from synthetic continuations and reuse the existing typed retry contract; no second retry owner or cache is added. The requested stat filter also includes six lines of test-routing inventory (+38 net); production itself is +32.
Evidence
Validation uses provider
blacksmith-testbox, profileopenclaw-check, leasetbx_01m45gbvwhk8qpwmwrr9stzqav(Testbox run). Base:e78e965a55e2d2b121c61d0a93e571c26f6f50f8. The original lease expired at its 65-minute job limit during the broad gate; replacement leasetbx_01m45mttvn8xp02xmmxyc876gd(gate run) checks the same candidate with per-file SHA-256 verification.Subagent maintenance facts changed during preparationerror (Vitest 33.78 s; wrapper 35.93 s). The initial attempt used the thread-hosted test family and failed before reaching the defect; the test now belongs to the existing database-worker family.node scripts/check-changed.mjs --base e78e965a55e2d2b121c61d0a93e571c26f6f50f8: all typechecks and preceding guards passed; the dead-export audit fails on untouchedGoogleMeetJoinResultandMeetingRuntimeOwner. A clean detached checkout of the exact base, with its own frozen install, reproduces both findings (91.6 s command). All 11 remaining planned checks passed separately, including core/extension/script lint, runtime cycles, schema and authority guards (861.6 s command); the failed audit remains recorded, not waived.openclaw/ci-gate, for555d38897f1b3c8808b4ece7700bc6cad671e5ed(CI run, 876 s elapsed). A fresh head check found no pending or failed checks. The reviewed patch rebased cleanly onto4f05baa4f524f436e10514831b80a35ec982d33f;git range-diffreports an identical patch. Testbox results above remain evidence for the original recorded base.Focused commands use
node scripts/run-vitest.mjs <files> --maxWorkers=1. Preparation dispatch coverage took 38.08 s wall / 7.106 s in tests with cold worker compilation; it exercises real reply initialization, SQLite preparation and registry publication, using synthetic final-runner responses, a disabled background maintenance kick, and injected backoff sleeps. Orphan/provider suites took 79.22 s wall across five files. This composition is needed to prove input reaches dispatch and preserves transcript identity; helper-only tests miss both failures.Provider calls are mocked. No live Gateway was restarted or modified for this proof.