Repository navigation
fix(gateway): preserve admitted worker history during transcript changes - #153337
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. |
|
Codex review: blocked before merge. Reviewed September 22, 2026, 1:17 PM ET / 17:17 UTC (Revision 21). ClawSweeper reviewWhat this changesCloud-worker preparation waits for input persistence, reads the history preceding that input, and preserves its transcript anchor across retries, with regression coverage for races and recovery. Merge readiness⛔ Blocked before merge - 1 item remains The fix remains necessary on current main. The previous merge-conflict blocker is resolved, the reviewed feature files are unchanged, and no introduced correctness or security defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway prepares conversation history and the current request before launching a cloud worker. The transcript recorder supplies the persisted input boundary, and the history reader supplies the earlier messages used by the worker. flowchart TD
A[Admitted user request] --> B[Transcript recorder]
B --> C[Wait for persistence]
C --> D[Read history before input]
D --> E[Recheck current run and session]
E -->|Current| F[Prepare worker launch]
E -->|Cancelled or replaced| G[Reject launch]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -3, Tests +190. Total +187 across 3 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Use the existing recorder admission and asynchronous history reader to preserve the input boundary while retaining current launch authority and recovery contracts. Do we have a high-confidence way to reproduce the issue? Yes, from source: persist the current input, append later assistant activity, then prepare its worker turn; current main selects the later tail instead of the admitted prefix. This review did not execute that scenario. Is this the best way to solve the issue? Yes. Passing the existing admission receipt to the canonical reader fixes the boundary directly and avoids introducing another history-selection owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 673048954c9b. 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 (20 earlier review cycles; latest 8 shown)
|
7d0f8ec to
791ad1d
Compare
abb285f to
42ed7ef
Compare
791ad1d to
549c034
Compare
42ed7ef to
ce6aab5
Compare
549c034 to
b31d2c4
Compare
ce6aab5 to
7ac223f
Compare
b31d2c4 to
31dd062
Compare
7ac223f to
a3178a1
Compare
31dd062 to
9f26b5f
Compare
a3178a1 to
65d51e5
Compare
9f26b5f to
eebba35
Compare
65d51e5 to
25b7ef8
Compare
Keep the hydration input private to its shared worker union owner while retaining the externally consumed SQLite target input export. This clears the unused-export finding without changing emitted runtime code.
Preserve current sharing projections, membership facts, database identity checks, and incognito ownership while retaining the canonical metadata-unavailable error import. Hydration feature changes remain identical to the prior qualified source.
Wait for canonical recorder persistence before preparing cloud-worker history. Read the exact admitted prefix and use its user entry as the transcript base, so later activity cannot shift or duplicate the current input during replay. Preserve current authority checks, asynchronous credential acknowledgment, and replacement-worker recovery. Validation: current owning Gateway types and 24 admitted-history cases with freshly compiled transcript workers, plus fresh independent P2 review. Exact feature bytes retain prior strict lint, formatting, and 55-case caller proof; the earlier broader run's slow fork-shutdown warning remains documented. Release-note context: cloud-worker launches keep the current user admission out of replay and retain its correct transcript base across persistence races. Source: #153337; depends on #153335.
Route the canonical row-facts operation through the extracted history reader owner, preserving the 64-key bound and captured inputs. Retain hydration cancellation, database custody, and worker retirement while incorporating current main types, dispatch, and snapshot reads.
Integrate the reviewed Plain and hydration successors with their additive session row-facts support. All three Recorder feature files and the complete feature patch remain byte-identical to the reviewed Recorder source. Reuse the feature-scoped P2 review and current 24-case compiled-history and owning-type proof. The hydration owner separately qualified the row-facts integration, currentness controls, types, lint, and independent review. No Recorder request or hydration API changed in this composition. Source: #153337; depends on #153335.
Preserve main database-root reuse and scoped cleanup while retaining captured-environment controls on isolated per-test transcript roots. Keep rootOverride third and captured environment fourth in the fixture. All 32 admission cases, core/session types, scoped lint, formatting, and fresh P0-P2 fixture-integration review pass. Hydration production files remain byte-identical to the preceding qualified candidate.
Compose the landed quarantine reader and graph codec with asynchronous hydration while retaining metadata error identities in the shared owner. Keep the canonical singleton cleanup class, persisted quarantine cause, and aggregate-only wire classification. A real history-worker quarantine refusal preserves the manager view. All 103 selected owner, stream, cancellation, and cleanup cases pass, along with owning types, scoped lint, and fresh P0-P2 integration review.
Integrate the reviewed Plain and hydration successors while preserving all three Recorder feature files and the complete feature patch byte-for-byte. Validation: nine selected admitted-history, persistence, append-race and cancellation cases passed with current compiled workers; owning Gateway types passed on the exact composed tree. Retain feature-scoped independent review for the identical patch. Hydration and Plain separately qualified full-stream snapshot, cleanup, quarantine, and terminal-settlement behavior. Source: #153337; depends on #153335.
Keep the new membership-facts operation in the existing extracted history-reader owner, preserving main capture and publication fences. Retain the moved sharing facade, row-facts ownership cutover, and H streaming, cancellation, and metadata error contracts. All 28 selected membership, sharing, stream, and SDK cases pass, along with owning types, scoped lint, formatting, and fresh P0-P2 review.
Integrate the reviewed Plain and hydration successors. All three Recorder feature files and the complete feature patch remain byte-identical; the new membership reader lives in the existing owner without changing Recorder's history request, signal, or stream callback contracts. Reuse the Recorder feature review and nine-case/type proof with exact patch parity, plus the separately qualified hydration integration and current Plain execution/types proof. The prior hosted native catalog timeout remains unattributed and is not represented as fixed by this source composition. Source: #153337; depends on #153335.
Integrate the reviewed Plain successor based on landed hydration main. All three Recorder feature files and the complete feature patch remain identical. The reached transcript, admission, framing, and worker owners are unchanged. Retain the exact feature review and compiled entry/type evidence by parity, plus the current Plain owning-type proof. Prior Recorder head bc61065 passed hosted CI; the earlier catalog timeout and separate prerequisite readiness failure remain recorded without attributing or claiming fixes here. Source: #153337; depends on #153335.
Absorb the reviewed Plain successor and already-landed archive fixture repair. All three Recorder feature files and the complete feature patch remain exact. No Recorder request, dependency manifest, or ownership contract changed. Retain source-bound feature review and compiled-entry evidence by parity. The prior catalog timeout and subsequent green Recorder CI remain separate observations; no additional product fix is claimed by this composition. Source: #153337; depends on #153335.
Absorb the reviewed Plain successor and already-landed owning type graph fix. All three Recorder feature files and the complete feature patch remain exact. No reached Recorder runtime, admission, session owner, or manifest changed. Retain source-bound feature review and compiled-entry evidence by parity, including green hosted CI for the prior Recorder head. The Plain owner passed its current owning type graph; no duplicate fix or runtime replay is claimed. Source: #153337; depends on #153335.
Absorb the reviewed Plain successor and canonical main fixes. All three Recorder feature files and the complete feature patch remain exact. Retain the Recorder feature review and compiled-entry proof by parity. The Plain owner separately passed seven current ownership/terminal cases and owning types for the shared hydration extraction. The canonical memory repair passed three positive cases and failed both historical blocking controls; its postprocessing limitation and verified cleanup remain recorded. Source: #153337; depends on #153335.
Integrate actual main after the Plain prerequisite landed. The resulting diff against main contains only the exact three reviewed Recorder feature files; there is no remaining hydration or Plain prerequisite delta. Validate the current dependency graph with a normal physical frozen install including fs-safe 0.18.1. All nine selected admitted-history/currentness cases and the owning Gateway type graph passed on the exact composed tree. Retain the prior feature-scoped review by byte-identical patch parity. Source: #153337; builds on merged #153335.
|
Merged via squash.
|
…ges (openclaw#153337) * refactor(sessions): reconcile hydration with current worker context * fix(sessions): remove unused hydration worker type export Keep the hydration input private to its shared worker union owner while retaining the externally consumed SQLite target input export. This clears the unused-export finding without changing emitted runtime code. * refactor(gateway): hydrate worker transcript reads asynchronously * fix(gateway): keep worker history at admitted input Wait for canonical recorder persistence before preparing cloud-worker history. Read the exact admitted prefix and use its user entry as the transcript base, so later activity cannot shift or duplicate the current input during replay. Preserve current authority checks, asynchronous credential acknowledgment, and replacement-worker recovery. Validation: current owning Gateway types and 24 admitted-history cases with freshly compiled transcript workers, plus fresh independent P2 review. Exact feature bytes retain prior strict lint, formatting, and 55-case caller proof; the earlier broader run's slow fork-shutdown warning remains documented. Release-note context: cloud-worker launches keep the current user admission out of replay and retain its correct transcript base across persistence races. Source: openclaw#153337; depends on openclaw#153335. * fix(sessions): stream full hydration within worker memory limits Transfer canonical transcript chunks through the existing history worker while retaining one read-only snapshot and complete caller-side results. Preserve SQLite text encodings, BOM errors, cancellation, current-owner checks, and native cleanup without raising the worker heap limit. * test(sessions): align hydration error controls with streaming Model interactive admission and the canonical streaming result in the existing quarantine error fixture, preserving its cleanup and retirement assertions. Remove a redundant unknown-alias assertion from the reader; emitted production JavaScript is unchanged. The complete 21-case worker error file, assertion ratchet, owning types, scoped lint, and fresh P0-P2 review pass.
Builds on merged #153335.
What Problem This Solves
Worker turns could prepare history before pending input persistence established its boundary, or replay a later transcript tail for already-recorded input.
User Impact
Cloud-worker launches use the history preceding their admitted input and keep that input's original transcript anchor across supported retries. Later messages do not enter that history, and excluding the current input preserves earlier unanswered user messages.
Why This Change Was Made
Preparation joins recorder persistence and reads the canonical admitted prefix through the existing model-context worker. It checks the current run, cancellation, turn claim, session target, and blocked-input state after the read. The ordinary admission receipt remains usable across pre-handoff recovery. Main's asynchronous credential acknowledgment, Stop/reconnect recovery, and the authority check after node-context preparation remain intact.
The reader returns a detached snapshot. It does not retain a transcript lease through subsequent transport setup; canonical destructive lifecycle operations and transaction-owned transcript commits keep their existing responsibilities. This does not establish exclusion against arbitrary standalone SDK or raw database writes.
Evidence
The actual-main composition passed all nine selected admitted-history/currentness cases and the owning Gateway type graph with a normal physical frozen dependency install, including fs-safe 0.18.1. The other 15 cases in the test file were outside this focused selection. Current compiled workers were prepared and verified, and source hashes remained unchanged. A type-driver preflight initially collided with the test driver's Git index capture before the compiler started; the typecheck then ran sequentially and passed.
The diff against landed main contains only the three reviewed Recorder files. Their complete feature patch is byte-identical, so the earlier clean feature-scoped P2 review and lint/formatting evidence are retained. Normal merge hooks passed. Earlier full 24-case and broader 55-case proof retain their source identities; the broader run's slow fork-shutdown warning remains recorded. No live remote worker launch was performed.
The preceding head passed CI run 35750816813. Historical failures remain separately recorded: an earlier native model-catalog timeout was reproduced without a causal fix, and an old timed memory fixture was replaced by the independently qualified canonical repair. That repair passed three positive cases and two historical blocking controls; its driver postprocessor failed afterward, later hash assertions were skipped, and raw results plus cleanup were independently verified. No cold-start latency claim is made.
Fresh CI for this actual-main head and canonical maintainer landing checks remain required.