Repository navigation
fix: preserve unfinished output when an agent turn times out - #142236
destire-mio wants to merge 14 commits into
Conversation
|
🦞👀 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. |
7c86f83 to
8142928
Compare
|
Codex review: blocked before merge. What this changesThe PR retains bounded, redacted unfinished assistant output in timeout reports and waits for those reports before admitting subsequent turns. Example: A turn streams "I updated config.json. Validation is unfinished." before its Gateway deadline expires.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains This PR addresses a remaining timeout-history gap with useful production-boundary evidence; acceptance of its durable-output and failed-save behavior still requires a storage-owner decision. Priority: P2 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherGateway deadline cancellation captures streamed output, the lifecycle owner persists its terminal report in SQLite, and history readers supply that report to clients and subsequent provider requests. flowchart TD
A[Provider stream] --> B[Gateway output buffer]
B --> C[Deadline cancellation]
C --> D[Lifecycle persistence owner]
D --> E[SQLite transcript report]
D --> F[Successor admission wait]
E --> G[History and provider context]
F --> G
Technical reviewBest possible solution: Retain unfinished output through the existing terminal report owner under an explicitly accepted storage and failed-save contract. Do we have a high-confidence way to reproduce the issue? Current-main source shows that buffered timeout output is not passed into the durable report, and the supplied Gateway captures demonstrate the affected replay and admission paths; no target code was executed during this review. Is this the best way to solve the issue? Using one existing custom report and its persistence owner is a focused solution that preserves current transcript readers, deduplication, and authority checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cae016bcc124. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +97, Tests +1116, Docs +12. Total +1225 across 24 files. Added test files: 1. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (18 earlier review cycles; latest 8 shown)
Reviewed October 13, 2026, 3:05 PM ET / 19:05 UTC (Revision 19). |
8142928 to
67ff6dc
Compare
Merge main at 2d94121. Capture unfinished timeout output on the run owner before cancellation, preserve terminal persistence authority, and retain successor admission waits outside the session writer. Validation: formatting and non-type-aware lint passed for the 12 PR files. Full typecheck, build, and runtime regression tests were not run in this sparse checkout.
… the worktree reader (openclaw#164685) * perf(state): carry admitted schema facts with database handles Refresh freshness at read admission and after BEGIN while reusing handle-owned facts for runtime schema checks. Validate canonical triggers before exposing agent readers and classify shared-state failures only after failed admission. Focused runtime checks execute zero SQL statements, versus 30 with the baseline owner. Preserve foreign-commit and snapshot semantics. Full workload measurement and remote integration checks remain merge preconditions after remote runner and fleet-capacity admission failed. * perf(agents): run per-turn session-entry patches through the worker Route audited writer claims, live-model-switch bookkeeping, and pending-final preparation, settlement, and cleanup through the existing agent executor. Preserve native opaque SDK callbacks and the excluded lifecycle and cron paths. The paired isolated Gateway workload reduces native patch transactions from 8 to 2 per warmed turn and target-site SQL from 48 to 12. Overall main-thread SQL averages 648.5 to 493.4 statements per warmed turn. Lifecycle persistence remains follow-up work after openclaw#142236; cron preparation remains with openclaw#161105. Local caller, settlement, error identity, import-boundary, cycle, and database ratchet proof passes. Full build, changed checks, and released SDK diff remain explicit merge preconditions under the maintainer's validation instruction. * test(outbound): align recovery fixtures with queue state Create and read producer-recovery sessions under the same explicit shared-state root as their delivery queue. Worker-backed pending-final settlement correctly rejects the previous fixture ownership mismatch. Preserve durable payloads and all existing assertions. * fix(state): preserve worker handoffs during schema admission Use the existing worker generation claim for maintenance metadata instead of retaining a host read handle. Keep both live ownership checks around the required transaction-entry freshness probe. Consolidate shared-state cache initialization, refresh, and terminal failures in its admission sibling and update the compiled-wrapper inventory. This keeps the cache within the existing module-size limit without changing stored schema or quarantine semantics. Focused maintenance, ownership, schema, worker, wrapper, and quarantine proof passed. Independent Codex review is clean through P2. Full landing validation remains required before merge. * test(agents): extract accounting persistence fixture Keep the accounting persistence suite within its line cap by moving fixture construction into a dedicated test-support module. Preserve suite-owned state, immediate operation registration, and every test case and assertion. * fix(state): keep retained handles free of schema probes Refresh canonical readiness when it consumes schema facts. Retention only holds native lifetime, so cold restore and other worker handoffs no longer execute host SQLite before dispatch. Protect foreign schema invalidation at the warm readiness fast path. Tighten retained-reader budgets to the optimized counts, and require early missing-table diagnosis before callbacks while preserving handle-cleanup assertions. Validation: 93 focused tests, production types, state/config test types, and independent review clean through P2. * perf(agents): read worktree publication lookups in worker Move publication preparation and per-turn tool availability through the existing worktree reader. Capture the physical store and session lifecycle before yielding, refresh availability facts, and preserve live effect guards and branch identity semantics. * test(gateway): document publication reader mock isolation Keep the SQL boundary fixture isolated from session storage, managed-worktree services, configuration, and credential state. Document those boundaries for the new first-party mock-export check. No executable test code, assertions, timeouts, or production behavior changes. The mock-export check, formatter, reader tests, and scoped P2 review pass.
…tory reader (openclaw#164747) * perf(state): carry admitted schema facts with database handles Refresh freshness at read admission and after BEGIN while reusing handle-owned facts for runtime schema checks. Validate canonical triggers before exposing agent readers and classify shared-state failures only after failed admission. Focused runtime checks execute zero SQL statements, versus 30 with the baseline owner. Preserve foreign-commit and snapshot semantics. Full workload measurement and remote integration checks remain merge preconditions after remote runner and fleet-capacity admission failed. * perf(agents): run per-turn session-entry patches through the worker Route audited writer claims, live-model-switch bookkeeping, and pending-final preparation, settlement, and cleanup through the existing agent executor. Preserve native opaque SDK callbacks and the excluded lifecycle and cron paths. The paired isolated Gateway workload reduces native patch transactions from 8 to 2 per warmed turn and target-site SQL from 48 to 12. Overall main-thread SQL averages 648.5 to 493.4 statements per warmed turn. Lifecycle persistence remains follow-up work after openclaw#142236; cron preparation remains with openclaw#161105. Local caller, settlement, error identity, import-boundary, cycle, and database ratchet proof passes. Full build, changed checks, and released SDK diff remain explicit merge preconditions under the maintainer's validation instruction. * test(outbound): align recovery fixtures with queue state Create and read producer-recovery sessions under the same explicit shared-state root as their delivery queue. Worker-backed pending-final settlement correctly rejects the previous fixture ownership mismatch. Preserve durable payloads and all existing assertions. * fix(state): preserve worker handoffs during schema admission Use the existing worker generation claim for maintenance metadata instead of retaining a host read handle. Keep both live ownership checks around the required transaction-entry freshness probe. Consolidate shared-state cache initialization, refresh, and terminal failures in its admission sibling and update the compiled-wrapper inventory. This keeps the cache within the existing module-size limit without changing stored schema or quarantine semantics. Focused maintenance, ownership, schema, worker, wrapper, and quarantine proof passed. Independent Codex review is clean through P2. Full landing validation remains required before merge. * test(agents): extract accounting persistence fixture Keep the accounting persistence suite within its line cap by moving fixture construction into a dedicated test-support module. Preserve suite-owned state, immediate operation registration, and every test case and assertion. * fix(state): keep retained handles free of schema probes Refresh canonical readiness when it consumes schema facts. Retention only holds native lifetime, so cold restore and other worker handoffs no longer execute host SQLite before dispatch. Protect foreign schema invalidation at the warm readiness fast path. Tighten retained-reader budgets to the optimized counts, and require early missing-table diagnosis before callbacks while preserving handle-cleanup assertions. Validation: 93 focused tests, production types, state/config test types, and independent review clean through P2. * perf(sessions): read transcript anchors and readiness through the history reader * refactor(sessions): group history read request types
Preserve upstream session-worker and report-append changes while retaining bounded, redacted timeout output and required persistence ordering. Recognize the exact admitted writer before lifecycle-start publication. Validation: 257 focused tests across 9 files; type-aware lint, formatting, and scoped safety ratchets passed. Full core typecheck was limited by local memory (exit 137). Independent review found no P0-P2 issues.
Remove the retired per-agent default marker while preserving explicit main-agent selection and all foreign-timeout isolation assertions. Validation: Gateway-methods test typecheck, all 17 binding cases, type-aware lint, formatting, and independent review passed.
Merge upstream main 32c8391 while retaining prompt-reaction and terminal-write ownership changes. Use the retained diagnostic redaction owner for bounded timeout output, and wait for exact registration removal in session-binding test cleanup. Validation: 46 lifecycle, 23 binding, and 47 CLI-history tests passed; core typecheck, scoped type-aware lint, and formatting passed.
Merge upstream main 050881c while preserving storage failure copy, unconditional terminal receipts, and async authorization cleanup. Adapt timeout regression fixtures to the runtime configuration owner. Validation: 124 focused tests passed in 292.69s; core typecheck, scoped type-aware lint, formatting, and independent source review passed.
Later terminal events can replace the tracked promise while the lifecycle owner queues their writes. Assert the retained dependency without assuming promise identity; keep the real RPC ordering, failed-save rejection, no-dispatch, and provider replay checks. Reproduced the original CI assertion locally, then passed all six real-Gateway scenarios (44.16s wrapper). Scoped lint, formatting, and independent review passed. The separate Gateway RPC timeout did not reproduce in the same two-file group: 43 tests passed with two workers and unchanged timeouts (189.78s). Its original CI cause remains unknown.
Reuse the canonical writer absence fact before opening a transaction. Keep matching writes, invalidation and rollback semantics unchanged; empty warmed matches save one transaction without delaying any durable effect. Two Codex review rounds clean. Memory tests and static CI lanes passed; wrapper inventory failures reproduce identically on main 0ccaa45. Single post-merge harness pair follows.
Merge upstream main e52278f. Keep both persistence waits outside the session writer and preserve the new admission diagnostic scope and restart-recovery custody changes. Group the core session target fields without changing their read order to retain the existing file line limit. Validation: 125 focused tests passed (325.88s); final admission and real-Gateway proof rerun passed 24 tests (143.15s). Core typecheck, scoped lint, formatting, and independent source review passed.
|
This pull request has been automatically marked as stale after 7 days without qualifying human activity. |
|
#171327 now keeps Before rebasing, could a maintainer confirm the intended direction?
The storage-owner decision on refusing an observing successor after a failed report write also remains pending. This PR is awaiting that design decision. Could a maintainer add |
|
This pull request has been automatically marked as stale after 7 days without qualifying human activity. |
|
Closing due to inactivity. |
Latest update (2026-10-03): head 7717a5c merges main, fixes partial-output redaction/bounds, and clears conflicts. Current validation and remaining owner decision. Earlier exact-head evidence below is historical.
Related: #141839. Extends merged #142135.
What Problem This Solves
When a Gateway deadline stops a run with buffered assistant text, a later model request can lose that unfinished text. A successor can also read history while the timeout report is pending. Merged #142135 supplies the deadline terminal report and CLI persistence context; this PR addresses the remaining buffered-output and admission gaps.
Why This Change Was Made
Capture the buffer before abort cleanup and pass it through the existing terminal lifecycle owner. The existing SQLite report transaction stores the timeout statement and JSON-quoted unfinished output in one
run-failed-before-replycustom message. Existing readers understand that record format. This PR adds no table, index, required field, schema version, replay exception, or backfill.Wait for the same agent/session's timeout persistence before and after work admission. The second check covers a deadline observed while admission waits. Both waits run outside the session writer, allowing the terminal write to acquire it. If the observed write rejects, the pending successor receives the error before dispatch and releases its reservation, abort controller, and admission lease.
User Impact
The report states that a timed-out turn may have performed work; it makes no claim of completion, external success, or rollback. Existing assistant rows are retained. A partial assistant row does not suppress the timeout report. Normal completion, user cancellation, and ordinary failures retain their existing behavior. Transactional authority validation and per-run deduplication remain with the existing owner.
Evidence: schema-24 existing-database refresh (2026-09-30)
This refresh addresses Revision 10's existing-database proof gap on the unchanged published head
7952a8218c90802e572a3dca24e882a1c78534d3, treec7b4cd2a40126044ab43fc2e6299c216113462ae. It supersedes the schema-23 compatibility scope of the historical runs below. No production or repository test bytes changed; no new commit or CI rerun was needed. The earlier exact-head CI failure and its bounded diagnosis remain as recorded below. Storage-owner acceptance of unfinished-text retention/visibility and failed-write recovery remains pending.Pinned sources and real owner paths
v2026.9.3, commit1391f7cd2d40ab5bbcf2f5f831d3a64f520e72d7, annotated taga69d657b4b74556017f2d0ef98b0c64aeabb3643, agent schema 195073ee41abfbe2cab02c0e58a12d4dcc27bcba18, agent schema 24; an untagged source snapshot, not a released-package claimComplete release and upstream source archives were materialized and compared with Git blob identities: 39,434 released-source files and 50,751 upstream files, zero mismatches. Each phase used a fresh Node process and isolated synthetic state. The release's actual session accessor created and closed the original SQLite database; SQLite backup captured the pre-upgrade recovery copy and migrated Gateway input. The candidate used
withAgentDatabaseMaintenanceLeaseandmigrateOpenClawAgentDatabaseForMaintenance, then the real report writer, session accessor, andSessionManager. No manual version-marker edits, extracted readers, replacement migration, or in-memory database were used.Environment: Linux x64, Node 24.19.0. Workspace code resolves within each pinned source tree; external runtime dependencies reuse the existing installation (including Kysely 0.29.6, tsx 4.23.15, and fs-safe 0.21.2). The released source declares older versions of these dependencies. This proves the versioned source storage path, not an installed release package or its full dependency supply chain. Initial harness setup probes failed on missing
mdast-util-from-markdownandms; package-local links and the installed[email protected]resolved those setup errors before the recorded passing paths. The nine same-schema phases completed successfully before the first released-source setup failure; only the blocked upgrade lane was subsequently run again on fresh state.Results
sessionDiffBaselinevalues. The unmigrated candidate read refused with a Doctor instruction. The real migration owner then published 24 in bothPRAGMA user_versionandschema_meta, retaining all original event IDs, sequence, creation timestamps, and decoded JSON hashes. Two long events changed physical representation from JSON text to Zstd while preserving decoded bytes. Full-entry reads reconstructed the exact baselines; raw read-only inspection confirmed that the baselines moved out ofsession_nodes.entry_jsonintosession_entry_snapshotswith unchanged values. Duplicate empty/partial timeout write requests produced exactly one report per run, increasing six events to eight.All 14 recorded SQLite snapshots reported
integrity_check=ok, no foreign-key violations, and the expected owner and matching schema markers. The explicit baseline checker passed all 14. Hash preservation covers the checked transcript payloads/identity/order/time fields and fixture baselines, not every table or byte of a changing database file.Measured Gateway cost: test body 34.945 s, Vitest 111.24 s, wrapper 118.46 s, shell wall 120 s. The existing live-test SHA-256 remains
93cbe8936c4e01f9e8a0d4d8e9231e90c3e459fa18b1b5bf8b7a4bb93e3920a5. These are local current-tree runs; this opt-in released-database fixture has not been executed in hosted CI. Existing current-head fresh-fixture CI proof remains linked below.Limitations: synthetic existing agent databases only; no installed CLI updater, shared-state migration, service restart, automatic package rollback, physical disk failure, or interrupted migration. Snapshot coverage here is one populated
sessionDiffBaselineper session, not a complete schema-24 snapshot-edge-case suite. The existing six-scenario proof injects rejection before the report operation and establishes no successor provider I/O; it does not prove successful recovery of lost partial text after a failed write. This supplement makes no new storage-policy or recovery-contract decision.Reproducing the refreshed run
Use the three full harness files retained in the historical appendix below, apply the following exact patch, and add
check-snapshots.mjsbelow. SetreleaseRoot,baseRoot, andcandidateRootto the pinned sources above, andgatewayMigratedSeedOutputto a new absolute SQLite output path. Use isolated dependencies/state. Runnode run.mjs config.json all; this creates the upgraded seed before adding the direct timeout reports. For the separate Gateway pass:Use a distinct
runNamefor the finalnode run.mjs config-gateway.json gateway-roundtrip, withgatewayOutputset to that output andgatewaySeedSnapshotset to the upgrade run'scandidate-migrated.json. Runnode check-snapshots.mjs runs/<runName>on each completed lane directory. The version assertions intentionally pin these configured roles to 19/24; the unusedgateway-seedmode is not a released-schema-19 seeding command in this pinned harness.Exact harness delta from the historical appendix
Current artifact identities (SHA-256; SQLite binaries are not attached)
d077c9ffe2675426223b914b0007347ebadba2ef4d8334aa02d57ac62e23c807bb98af385efad6cb8ad193a938e78bbd97033c14b14fb04e97c1e414ab7105b98040c25e2e0c1d3ba33cb7b30ac027229ca199d1f7d6e967655c12b585b40013818e44271ea11b6685960c5dce2b1f16f45ed18cd2e9c16bc9a7cf44ec703490Evidence: conflict resolution on 2026-09-30
Current head:
7952a8218c90802e572a3dca24e882a1c78534d3. This is a non-force merge of main5073ee41abfbe2cab02c0e58a12d4dcc27bcba18into the existing PR branch; the published tree was read back and matches the tested local treec7b4cd2a40126044ab43fc2e6299c216113462ae. GitHub reports this head mergeable. The exact-head CI run completed with failure: 116 jobs succeeded, 23 were skipped, and one test shard failed (with the aggregate gate consequently failing). The earlier green run below does not validate this merge commit. The failure ischat.reset-visible-yield.test.ts/preserves real chat yield metadata and the held descendant's complete outcome, reportingrequester did not resumein the failed shard. Bounded triage found the identicalrequester did not resumefailure in an earlier, unrelated PR run on 2026-09-29. That job tested merge97f4ced0a8a61d2d68bb9ac42c4834aa63e5aa7d(PR head9f902836e59d86e5f419816fcb2b5786cc8518b1, then-maind8d0e9c990ea8006fdf8907d9e4972dbf452372b). Direct source reads at that tested merge show notimeoutPartialTextand nowaitForChatSessionTimeoutPersistence; its failing test blob,3c940399e1800ede1576e10256fafa7614ecaf1d, exactly matches this branch. The same failure therefore occurs without this PR's timeout-history/admission changes.A local replay of the failing isolated partition's eight files, using two workers as in CI, passed both
chat.reset-visible-yieldvariants (reset 50.408 s, complete 14.257 s). The whole replay was 503 passed / 4 failed: fouragent.test.tsyielded-orchestrator followup cases instead failed anannouncecall-count assertion; those four cases passed in the hosted run. This is bounded diagnostic evidence, not a repair or an all-green replay. Upstream #161691 addresses this test's per-step timer races and remains open; its proposed root cause is not independently established by this investigation. The current CI failure remains recorded and unresolved. No remote rerun, timeout increase, assertion weakening, or unrelated scheduler change was made.The resolution preserves main's
sessionEntryCurrentcontract and receipt-write guard, ordinary-failure wording, and scheduler ownership. It retains this PR's timeout-specific report, captured unfinished text, and both same-agent/session persistence waits. The live proof now observes the realmaintenance:dedupejob registered withGatewaySchedulerinstead of the retiredsetIntervalhook; it still exercises real RPC admission, deadline handling, SQLite persistence, and the next loopback provider request.Local validation used Linux x64, Node 24.19.0, and the repository-pinned pnpm 12.5.1:
void maintenance.sweep()annotation in the test.partialPreserved: trueandsuccessorProviderRequests: 0after report-write rejection. Its live-test body took 16.910 seconds.node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo) passed. Type-aware lint passed for all 12 changed files using the unchanged lint rules and a task-local TypeScript root set limited to those files plus existing declarations. Formatting, conflict-marker, line-cap, max-lines, assertion-safety and diff checks passed. Independent code review found no actionable resolution defect.check:changedaggregate passed its preliminary guards but was stopped during the broad core-test graph-boundary scan to avoid duplicating large scans while completing final runtime proof. The aggregate and all-test typecheck are not claimed complete. The exact-head remote CI result and its unresolved failure are stated above.Final live-test SHA-256:
93cbe8936c4e01f9e8a0d4d8e9231e90c3e459fa18b1b5bf8b7a4bb93e3920a5.Historical evidence: previous head and hosted CI
The following original evidence is retained for provenance. References below to "current head", "current-head", and schema 23 describe the earlier
878114675c81e88c78e29d73a76cc0f530a80b8fcandidate, not the merge commit above.Current head:
878114675c81e88c78e29d73a76cc0f530a80b8f. The current-head CI run completed with success. The PR check snapshot contains 145 successful checks, 49 skipped checks, and one neutral CodeQL check; there are no failed or pending checks in that snapshot. Maintainer acceptance remains separate from CI.The final local run passed 3 files / 52 tests using the production Gateway, its SQLite store, and a loopback HTTP provider capture. It used the migrated copy of the released source's existing database described below. The six cases cover empty timeout, partial timeout, user cancel, normal completion, duplicate terminal events, and report-persistence rejection. Original seed history reached the next provider request in both existing sessions.
The current-head live-test log exposes
TIMEOUT_HISTORY_CASEcaptures of transcript rows and outgoing provider request bodies, plusTIMEOUT_CONCURRENT_ADMISSIONandTIMEOUT_HISTORY_VERDICT. Hosted CI uses the default fresh fixture; the released-database copy and cross-version roundtrip are local evidence below.The local run took place before the final test-only commit: its metadata names
98aab05bde7ffa9ff04af9b4062858f37afe0bbaplus the test repairs. The production source is identical to current head, and all three recorded test-file SHA-256 hashes match current head. This is source-equivalent pre-commit proof; the linked hosted run is the committed-head execution.The fixed five-second absence wait is removed. A scheduling callback identifies entry into the wait; it is not used as proof that admission awaits persistence. The decisive assertion rejects the actual report operation and observes
GatewayClientRequestError,INVALID_REQUEST, the injected message, no successor registration, and zero successor provider requests. Counterfactuals that remove both admission awaits, or discard the persistence result and wait an unrelated one second, fail because the RPC returnsstartedinstead of rejecting. These are mutation results, not additional passing suites.Targeted lint, formatting, line-cap and diff checks passed locally. The local full changed gate was incomplete in the sparse checkout; current hosted CI is the full remote result. The previously failing configuration fixture passes in this run, including the include-only case at 2.710 seconds. That passing replay is not a claimed root-cause repair of its earlier hook timeout.
Final local Gateway verdict and test-source identities
[ { "scenario": "empty-timeout", "durableTimeoutReports": 1, "historyHasTimeout": true, "nextProviderRequestHasTimeout": true, "stopReasons": [ "timeout" ] }, { "scenario": "partial-timeout", "reportGateReached": true, "providerRequestBeforeReportRelease": false, "durableTimeoutReports": 1, "historyHasTimeout": true, "nextProviderRequestHasTimeout": true, "partialPreserved": true, "stopReasons": [ "timeout" ] }, { "scenario": "user-cancel", "durableTimeoutReports": 0, "historyHasTimeout": false, "nextProviderRequestHasTimeout": false, "stopReasons": [ "rpc" ] }, { "scenario": "normal", "durableTimeoutReports": 0, "historyHasTimeout": false, "nextProviderRequestHasTimeout": false, "stopReasons": [ "stop" ] }, { "scenario": "duplicate-timeout", "durableTimeoutReports": 1, "historyHasTimeout": true, "nextProviderRequestHasTimeout": true, "stopReasons": [ "timeout" ] }, { "scenario": "persistence-failure-timeout", "reportGateReached": true, "reportFailurePropagated": true, "durableTimeoutReports": 0, "successorProviderRequests": 0 } ]{ "src/gateway/session-lifecycle-run-failure.test.ts": "f7d0bd24a2f3773f822ca8e975455f45f3bb19a16a0c10bfb01ef465d1e69a42", "src/gateway/server-methods/chat-send-session-binding.test.ts": "90de7898b8a5a1e4435fcf66a8fedd725932d96d2a18364c0d92442214c014e9", "src/gateway/server-methods/chat.timeout-history-live-proof.test.ts": "e95a4b1686db922dfc3e3d5a0035a7c3c2d5de32033e4580aaec4231863d1f72" }Measured test cost
The new file is
src/gateway/server-methods/chat.timeout-history-live-proof.test.ts. Local environment: macOS arm64, Node 26.5.0, pnpm 12.4.2,OPENCLAW_VITEST_MAX_WORKERS=1. The measured command used the repository's ready-dependency wrapper allowed by AGENTS.md:The local standalone command is the native wrapper above, not an execution of the literal
pnpm test <file> --maxWorkers=1spelling. The corresponding standard entrypoint ispnpm test src/gateway/server-methods/chat.timeout-history-live-proof.test.ts --maxWorkers=1.This file exceeds the 30-second guide threshold. It shares one Gateway boot across six scenarios and exercises the real RPC → timeout owner → SQLite report → next HTTP request chain. Reducer/owner tests do not prove that the registered entrypoint calls those owners or that the provider receives their persisted result. The fixed absence delay was removed; the recorded cost still includes Gateway startup, module transforms, SQLite workers, and real transport completion. No claim is made that this is a sub-five-second unit test or a benchmark of production latency.
Storage contract and maintainer decision
The storage review checkpoint applies because the retained content and admission failure behavior change, despite an unchanged numeric schema. Maintainer acceptance is pending. The evidence below is submitted for that decision; contributor verification does not supply approval.
Please record whether these two behaviors are accepted:
INVALID_REQUEST; no successor provider request starts. This is not a physical disk-failure or interrupted-commit experiment.Credit and overlap
Report by @von8794. The original repair built on the unpublished ClawSweeper attempt in run 34187527730, which stopped on validation checkout-identity accounting; run 34190908565 completed planning only. @chelsealong's merged #142135 supplies the deadline-event gate, factual generic failure reporting, CLI write context/drain and UI visibility now present in the base. This PR adds buffered output inside the existing report and successor admission ordering. Neighboring #125977 concerns failed-assistant replay; this candidate does not modify replay-history.
Existing-database evidence appendix
The prior PR body described extracted-reader/in-memory checks. The following evidence supersedes that compatibility claim with real SQLite files and the real versioned accessors, migration owner, and SessionManager. It includes the harness source and recorded phase results so that review does not depend on a private local file link. Raw SQLite artifacts are retained locally; their hashes are provenance, not a claim that the binary files are attached here.
Scope and source identities
These are recorded runs on synthetic existing agent SQLite databases, created and closed by the selected old source before the candidate opens a copy. Each worker loads the version's actual source accessors, migration owner, report writer, and SessionManager in a fresh process with isolated state. No extracted-reader substitutes or in-memory transcript are used.
1391f7cd2d40ab5bbcf2f5f831d3a64f520e72d7, annotated taga69d657b4b74556017f2d0ef98b0c64aeabb36432d94121bb0ac7a4404e8a81fc00ffd735a89eac5; not a published-release claim98aab05bde7ffa9ff04af9b4062858f37afe0bbaplus test repairs; production is identical to878114675c81e88c78e29d73a76cc0f530a80b8fRuns: 2026-09-25 UTC, macOS arm64, Node 26.5.0. The final three delivery test hashes match the committed head. Materialized source files were compared with their Git blob identities: 11,891 released-source files and 15,121 main-parent files, zero mismatches. External runtime dependencies came from compatible existing installs; this is not validation of an installed release package or its entire dependency supply chain.
Recorded outcomes
All 15 recorded SQLite snapshots, including the released seed and the three lanes, reported
integrity_check=okand no foreign-key violations. Hash preservation refers to transcript payloads and the checked identity/order/time fields, not every table, metadata field, page, or byte in a changing SQLite file.These runs do not exercise the installed CLI updater, shared-state upgrade, service restart, automatic package rollback, physical disk failure, or interrupted migration. The report-operation rejection is covered by the live Gateway test; successful retry or recovery of the lost partial after that failure is not established. Maintainer acceptance of the retained content and successor-failure behavior remains pending.
Phase records
The following tables are generated from the recorded
results.jsonfiles. Exit 1 is expected only for the two explicit version-refusal phases. Seconds are per phase, not production latency benchmarks.stable-upgrade-v2: 15 phases, 156.881 seconds
release-original-backupcandidate-before-migrationcandidate-refused-unmigratedcandidate-owner-migrationcandidate-migrated-readcandidate-migratedcandidate-migrated-timeoutscandidate-migrated-after-timeoutsrelease-downgrade-refusalafter-release-refusalrelease-backup-restorerelease-restoredcandidate-restored-migrationcandidate-restored-reopencandidate-restored-finalsame-schema-v3: 9 phases, 105.321 seconds
base-seedbase-originalcandidate-existing-readcandidate-timeoutscandidate-after-timeoutsbase-reader-writerbase-after-continuationcandidate-reopencandidate-reopenedgateway-roundtrip-delivery: 5 phases, 35.974 seconds
gateway-outputgateway-base-read-writegateway-after-basegateway-candidate-reopengateway-finalBinary artifact identities
These hashes identify the retained local artifacts; the binary database files are not attached to this PR text. The executable harness below makes the asserted path and comparisons inspectable.
cac8bb0ef968023177a94deaaa15a9982865ca5279445626b4b7afb4b2caffd2e9954ecd4ea43084a79655c9ef30a569f6ff321f0c3117474aefb300f699ab5e57516dac067c82fbdc3be39d659e1e0fc15830d47be563d15c5931743146560b79235c1fccaa021673a80674fe2b2977616d59a3ef3fb3d4db9ece1ad01f7ba5Reproduction setup
Save the three source blocks below together in a proof directory outside the source checkouts. Prepare separate complete checkouts at the three listed commits with compatible dependencies;
candidateRootshould be current head. The scripts load source entrypoints through each checkout's ownscripts/tsx.mjs. Use Node 26.5.0. Paths in this example are placeholders to replace with absolute paths on the review host.{ "node": "/absolute/path/to/node", "candidateRoot": "/absolute/path/to/candidate", "baseRoot": "/absolute/path/to/main-parent", "releaseRoot": "/absolute/path/to/release-2026.9.3", "runName": "fresh-review-run" }For the standalone same-schema and released-upgrade lanes, save that configuration as
config.jsonand runnode run.mjs config.json all. This creates old state, backups, phase logs, snapshots and results underruns/<runName>. Use a freshrunNamefor every execution; the harness is not intended to append to a completed fixture.To connect a released seed to the Gateway as in the recorded delivery:
baseRootequal to the released checkout; runnode run.mjs seed.json gateway-seed. It createsruns/<seedRun>/gateway-input.sqliteandgateway-seed.json.releaseSeedDatabaseandreleaseSeedSnapshotto those absolute paths, and setgatewayMigratedSeedOutputto a new absolute output path. Runnode run.mjs upgrade.json stable-upgrade. The migrated output is captured before timeout reports; its manifest isruns/<upgradeRun>/candidate-migrated.json.OPENCLAW_VITEST_MAX_WORKERS=1,OPENCLAW_TIMEOUT_HISTORY_PROOF_DATABASEset to that migrated output, andOPENCLAW_TIMEOUT_HISTORY_PROOF_DATABASE_OUTPUTset to a new absolute export path:node scripts/run-vitest.mjs src/gateway/server-methods/chat.timeout-history-live-proof.test.ts.baseRoot. SetgatewayOutputto the export from step 3 andgatewaySeedSnapshotto the manifest from step 2. Runnode run.mjs roundtrip.json gateway-roundtrip.The wrappers retain per-phase stdout/stderr, exit status, timing, SQLite manifests and results. Session activity is current to avoid replacing the seed through idle reset; historical message timestamps and payload bytes remain fixed and are checked. Seed state is synthetic; no existing user database or credentials are required.
Harness source used for the recorded runs
run.mjs — SHA-256 c4a1951fc654dcb25583443096891ea00debc243e4ec44272f04a457c26652f7
worker.mjs — SHA-256 c98ef5188be7b8450c2cbc4023679a29459d2088ba4ba2f9409bcded840cc0fd
snapshot.mjs — SHA-256 ba5ab3a2daecb64404a55ca2663af2c93d8854c6b83d891c6fd7c9662f97c5bf