Repository navigation
refactor(sessions): compare submitted inputs and recover dedupe through workers - #164313
Conversation
…gh workers Read bounded submitted sources through the existing history worker, preserve current-owner single-use recovery, and recheck retry evidence at admission. Keep the released asynchronous completion contract and document unchanged storage/update behavior.
|
🦞👀 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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 9:48 AM ET / 13:48 UTC (Revision 2). ClawSweeper reviewWhat this changesMove stored-input comparisons and recovered inbound deduplication reads into database workers while preserving retry decisions and current-owner checks. Merge readiness✅ Ready for maintainer review The worker migration remains necessary on current main. The previous missed-await finding is resolved, and this review found no remaining actionable patch defect. Priority: P2 Review scores
Verification
How this fits togetherSession storage retains submitted messages used to recognize retries and recover interrupted input. Gateway chat admission, inbound dispatch, and harness completion delivery consume that evidence before deciding whether work may proceed. flowchart TD
A[Chat retries and recovered input] --> B[Capture physical session store]
B --> C[Database history worker]
D[Pending input and transcript] --> C
C --> E[Original submitted evidence]
E --> F[Current host owner checks]
F --> G[Replay or admit work]
F --> H[Reject stale or conflicting work]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +381, Tests +435, Docs +10. Total +826 across 30 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep bounded source reads in the existing history worker and leave replay, recovery, and final effects under their current host owners. Do we have a high-confidence way to reproduce the issue? Not applicable to a standalone bug reproduction: current-main source establishes the synchronous reads being migrated, and this review did not execute target code. Is this the best way to solve the issue? Yes. Extending the existing worker owner preserves the source-comparison boundary without introducing another storage owner or changing the released asynchronous SDK contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bee5d85d423c. LabelsLabel 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)
|
Merge main after the pending-input staging prerequisite landed, preserving its Goal preparation and abort settlement fixes. Await the remaining completion-custody integration assertions, and keep admission failure responses in the existing work-admission owner.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…gh workers (openclaw#164313) * refactor(sessions): stage and settle pending inputs in workers * refactor(sessions): compare submitted inputs and recover dedupe through workers Read bounded submitted sources through the existing history worker, preserve current-owner single-use recovery, and recheck retry evidence at admission. Keep the released asynchronous completion contract and document unchanged storage/update behavior.
What Problem This Solves
Chat retries without an in-memory identity, harness completion delivery, and recovered inbound deduplication still read submitted input through caller-thread SQLite.
User Impact
These durable reads move off the Gateway thread while preserving original submitted bytes, retry decisions, and current-owner recovery checks. No schema, stored-format, retention, durability, configuration, or update migration changes. Process-held incognito storage retains its existing owner.
Why This Change Was Made
Extend the existing pending-input operation family and history reader with bounded source reads. Capture the physical store before yielding, preserve original collected-source bytes, and refuse stale transcript projections without rebuilding them. Source bytes remain comparison evidence; the host owner still controls replay and single-use recovered dedupe.
Chat admission prepares fresh evidence under its existing lifecycle writer barrier, excluding only its own exact pending reservation from retry discovery. Completion delivery awaits the read and rechecks its requester. Accepted reads retain the existing reader lifecycle and cleanup.
This follows merged #164284. Main was merged without rebasing, preserving its Goal-preparation and abort-settlement fixes. Scope overlap with #156941 and design draft #162433 remains informational; neither is changed here.
Evidence
node scripts/check-changed.mjs --staged --base d6c1b1f9e14aa06443c685d81414911628e18914on the final candidate. The frozen workspace install restored the QA Lab dependency link. Core production types, all 27 core test type graphs, extension production/test types, lint, all three dead-export scans, SDK/package boundaries, SQLite and line-count ratchets, and the final guards passed. Existing max-lines warnings in unrelated voice-call and Crabbox files remain unchanged.pnpm test <12 explicit files> --maxWorkers=1; wall time 887.26 s, including preparation.chat-send-pending-inputs.test.ts,chat-send-pre-admission.test.ts,chat-send-admission.reads.test.ts, anddelivery.custody.integration.test.ts. Command:pnpm test <these four files> --maxWorkers=1; wall time 463.94 s, including preparation. The exact-head CI run succeeded with zero failed/cancelled/timed-out jobs; aggregate job time was 9,343 seconds.expected Promise to be 'pending'; all three calls now await reconciliation, and the complete 21-case owning suite passes. The existing admission-failure response block moved to the existing work-admission module after main integration exceeded the line-count ratchet; the ratchet now passes.test/scripts/runtime-process-build-graph.test.ts,src/auto-reply/reply/get-reply.imports.test.ts, andsrc/worker/worker.runtime-imports.test.ts: 14 passed. No new wrapper dependency-inventory entry is needed.7861578a1dbbcc7efb626019f80dd773ddbd07dbwith no actionable findings. Codex autoreview through P2: scoped-clean on the final candidate.git diff --checkpassed. No newOPENCLAW_*names.v2026.9.8already declaresdeliverAgentHarnessCompletionas returningPromise<AgentHarnessCompletionDelivery>. The changed synchronous helpers are internal, not exported through released SDK subpaths orapi.runtime.*; no released signature changes or compatibility companion is required.The longer suites retain real SQLite/worker custody fixtures because mocks cannot establish their source, transaction, and settlement boundaries. Existing other-owner metadata/authority reads remain follow-up debt:
chat-send-work-admission.ts:85,92, the recovery commit guard atchat-send-pre-admission.ts:609, andagent-harness-completion-delivery.ts:34. Zero-SQL assertions cover the migrated submitted-source operations, not those surrounding owners or the separate cold completion-input guard.