Repository navigation
fix(sessions): preserve transcript IDs across agent idle resets - #184157
Conversation
Append the existing reset boundary at admitted command persistence so idle and daily resets keep historical messages indexed. Preserve terminal recovery rotation and explicit session-ID resume behavior. Co-authored-by: SeungTaek Lim <[email protected]>
Keep the durable transcript ID through Gateway agent preparation, share reset metadata cleanup, and commit the boundary with the renewed lifecycle. Preserve the triggering RPC source during cleanup and the ended transcript window for hooks. Co-authored-by: SeungTaek Lim <[email protected]>
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Keep Gateway explicit-ID expiry semantics while preserving transcript IDs. Align voice and Gateway consumer assertions, adapt the in-memory lifecycle fixture, and retain the original patch accessor binding used by restart-settlement tests.
|
Codex review: needs maintainer review before merge. What this changesThis PR preserves transcript IDs across automatic CLI and Gateway agent resets while appending reset boundaries. Example: A conversation contains AMBER731 before a configured one-minute idle reset and COBALT942 afterward.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Ready for maintainer review: the stable-to-head upgrade evidence resolves the previous compatibility blocker, and no actionable findings remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCLI and Gateway agent preparation select session lifecycle state, persist it through the session writer, and supply transcripts to agent execution, lifecycle hooks, and memory indexing. flowchart LR
A[CLI agent turn] --> C[Session reset decision]
B[Gateway agent RPC] --> C
C --> D[Atomic lifecycle writer]
D --> E[Transcript and reset boundary]
D --> F[Runtime cleanup and hooks]
E --> G[Agent context and memory indexing]
Technical reviewBest possible solution: Land the focused wiring to the existing atomic reset writer while retaining terminal recovery rotation and the separate historical-lineage repair. Do we have a high-confidence way to reproduce the issue? Current-main source shows expired agent sessions receiving replacement IDs, and the supplied CLI/RPC canary replay demonstrates the resulting search loss; no target code was executed during this review. Is this the best way to solve the issue? The smallest complete repair keeps transcript identity, renews lifecycle state through the existing atomic writer, and shares metadata cleanup without adding storage or policy owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 642b31d1993b. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +135, Tests +297, Docs +2. Total +434 across 17 files. Added test files: 2. View PR surface stats
Review metrics
LabelsLabel 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 (2 earlier review cycles)Reviewed October 26, 2026, 2:45 AM ET / 06:45 UTC (Revision 3). |
Define the fixture dependency surface from the accessor contracts instead of importing its parent mock module. This removes the type-only import cycle without changing fixture execution or production code.
|
@clawsweeper re-review Both code findings are addressed in the current head: the voice consumer requires the preserved ID with a renewed start time and reuse on the next turn; the original patch accessor binding is restored, and the unchanged stopped-claim regression passes. Gateway expiry, recovery controls, scoped checks, and the final import-cycle correction pass locally. The PR body now contains final production-revision canary replay and build timings, plus the unrun stable-upgrade limitation. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Added the requested stable-to-head upgrade proof to the PR body. The installed latest stable created and indexed five real Ollama sessions; all were idle-expired before manual package replacement. After backed-up Doctor migration, the installed candidate preserved all IDs and original transcript events, appended the expected boundaries, and recalled all ten canaries. Final Doctor and validation passed. No source change or new head. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…claw#184157) * fix(sessions): preserve agent transcript IDs across automatic resets Append the existing reset boundary at admitted command persistence so idle and daily resets keep historical messages indexed. Preserve terminal recovery rotation and explicit session-ID resume behavior. Co-authored-by: SeungTaek Lim <[email protected]> * fix(sessions): preserve Gateway automatic reset boundaries Keep the durable transcript ID through Gateway agent preparation, share reset metadata cleanup, and commit the boundary with the renewed lifecycle. Preserve the triggering RPC source during cleanup and the ended transcript window for hooks. Co-authored-by: SeungTaek Lim <[email protected]> * fix(sessions): preserve reset consumer contracts Keep Gateway explicit-ID expiry semantics while preserving transcript IDs. Align voice and Gateway consumer assertions, adapt the in-memory lifecycle fixture, and retain the original patch accessor binding used by restart-settlement tests. * test(gateway): decouple accessor fixture types Define the fixture dependency surface from the accessor contracts instead of importing its parent mock module. This removes the type-only import cycle without changing fixture execution or production code. --------- Co-authored-by: SeungTaek Lim <[email protected]>
Absorbs openclaw/openclaw main at 96da011 (2026-10-26T21:55:24-07:00), 1,293 commits past jump 6's upstream base 2e963ca, into the j6 batch head c7f1481 (j6 final 935ba44 plus #1488, #1489 and #1490). 45 conflicted files, resolved upstream-first, hunk by hunk: - generated files regenerated with their generators (PostgreSQL schema catalogs, gateway protocol predicates, config baseline, worker-access inventory); the mock-factory baseline pruned by its ratchet; - tests upstream rewrote take upstream's shape and keep the fork's continuation cases (result accounting, heartbeat drain, media-only, spawn, CLI transcript redaction, Codex #1438 user-image row); - source hunks keep the continuation lines beside upstream's change (spawn envelope, fallback-cycle result fields, event source, traceparent carry in the Gateway persist builder, live-interruption retirement). Agent schema: upstream took 36 (openclaw#183888, PostgreSQL-only exact-path indexes) and 37 (openclaw#183827, cold transcript archive chunks). The continuation recipient-authority step moves 36 -> 38, on top of them, per the ruling on bootstrap#1727 (comment 6434991502). On SQLite the live seats' our-35 and j6's our-36 databases are upstream's same-numbered schema plus the authority table, so upstream's 37 adds the chunk table and the idempotent step 38 admits them and keeps their rows. State 33 -> 34 (openclaw#183508) is upstream-only. Semantic collisions in cleanly merged files: - subagent-spawn-envelope.ts carries upstream's blind flag and structured output instruction into the fork's extracted envelope builder; - openclaw#184157's two new automatic-reset cleanup calls (agent-command.ts and the Gateway persist reset path) route through the fork's continuation-aware clearReplacedSessionRuntimeState, as the reply-session path does (ruling item 2); - the agent port descriptor treats 37 as a historical source that already has the chunk table. Refs karmaterminal/openclaw-bootstrap#1727 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tinuation custody Upstream openclaw#184157 (cd8fd90) added an automatic-reset runtime cleanup to agent-command. The jump-7 merge routes it through the fork's continuation-aware clearReplacedSessionRuntimeState, as the reply-session path does (ruling on bootstrap#1727, comment 6434991502, item 2). This pins that routing at the composed agent-command boundary, on real continuation custody: - a session carrying the legacy pending-reset marker (updatedAt 0, reset reason "reset") has its queued continuation work cancelled ("Cancelled by session reset"); - an idle or daily expiry rotates the session and keeps the queued work. The suite needs the shared-state host broker (custody writes go through the state worker), so it joins the database-worker core paths beside the other reset-cleanup proofs; without it the runner classifies the file unit-fast. Patch-only negative control (agent-command passes "idle" for every automatic reset, i.e. no continuation settlement, as upstream's helper behaves): the marker case fails (record stays "queued"); idle/daily stay green. GREEN here: 3/3 (about 13 s; the composed path is the contract). Refs karmaterminal/openclaw-bootstrap#1727 Co-Authored-By: Claude Opus 5.5 <[email protected]>
) * fix(sessions): preserve agent transcript IDs across automatic resets Append the existing reset boundary at admitted command persistence so idle and daily resets keep historical messages indexed. Preserve terminal recovery rotation and explicit session-ID resume behavior. Co-authored-by: SeungTaek Lim <[email protected]> * fix(sessions): preserve Gateway automatic reset boundaries Keep the durable transcript ID through Gateway agent preparation, share reset metadata cleanup, and commit the boundary with the renewed lifecycle. Preserve the triggering RPC source during cleanup and the ended transcript window for hooks. Co-authored-by: SeungTaek Lim <[email protected]> * fix(sessions): preserve reset consumer contracts Keep Gateway explicit-ID expiry semantics while preserving transcript IDs. Align voice and Gateway consumer assertions, adapt the in-memory lifecycle fixture, and retain the original patch accessor binding used by restart-settlement tests. * test(gateway): decouple accessor fixture types Define the fixture dependency surface from the accessor contracts instead of importing its parent mock module. This removes the type-only import cycle without changing fixture execution or production code. --------- Co-authored-by: SeungTaek Lim <[email protected]> Adapt to the beta.5 SQLite lifecycle owner without importing the later controller architecture. Preserve richer base metadata and all admission guards; qualify same-ID boundaries with real command/Gateway tests and closed-interval readers. Source-commit: cd8fd90 Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Configured idle and daily resets through
openclaw agentor Gatewayagentrotated the durable transcript ID, so forced session-memory reindexing lost the earlier conversation.User Impact
Automatic resets now retain the transcript ID and append a reset boundary. Earlier messages remain available to transcript recall and session-memory indexing. Local explicit session-ID resume bypasses automatic expiry. Gateway
agentretains its configured expiry policy even with a matching explicit ID. Terminal recovery requiring a replacement transcript still rotates.Why This Change Was Made
The command resolver and Gateway's pre-command persistence were both missed by #112988. Both now use the existing atomic lifecycle reset writer, retain reset-generation checks, and share metadata cleanup. Gateway cleanup preserves the triggering RPC input, and session-end hooks read the closed pre-reset interval.
This is a focused follow-up to #181258, reported and isolated by @namest504 (SeungTaek Lim). Per the author's suggestion, its historical/pre-upgrade transcript and ACP-lineage work remains intact in that PR: #181258 (comment).
Evidence
chat.sendinitialization retains both. On the fixed production revision, the fixture replay passes in 79.71s and native Ollamaqwen3:8bplusnomic-embed-textpasses in 100.03s. Each of four surfaces retains its original ID, appends exactly one idle boundary, and semantic search returns all eight BEFORE/AFTER canaries. Real CLI/RPC replies contain the requested canary.81026a873ba; production code is unchanged at the current head, whose last commit only removes a test-fixture type dependency. The fixture factory implementation is unchanged.CI follow-through aligned the old voice ID-rotation assertion, restored the original patch accessor binding so restart fault injection remains effective, and adapted the in-memory handler store to the reset API. Accessor mock implementations moved into a shared test-support owner to keep the fixture under its line cap.
Production: +503/-368 (net +135); tests: +517/-220 (net +297); docs: +2. Production growth connects both admission paths to the existing reset and cleanup owners; most Gateway diff volume relocates the existing entry builder. No new schema, configuration, or dependency.
Local proof is macOS-only. The channel control exercises shared inbound initialization through
chat.send, not an external channel service. The stable-to-head package upgrade is covered below; this PR reuses existing reset-event storage without adding a schema or migration. No operator Gateway or state was used.Upgrade proof
Passed on macOS with Node 26.12.1, native Ollama
qwen3:8b, andnomic-embed-text. Installed the registry's latest stable,2026.10.7(157d8c2bc3ea), into a fresh isolated npm prefix, HOME, state directory, and config on port 20080. The installed stable CLI and Gateway created five real sessions; forced indexing found all five BEFORE canaries. They were left idle naturally, without database timestamp edits: each had 275–315 seconds of inactivity against a 60-second limit when replacement began.Built and integrity-checked a self-contained package at
f8e9309ca03a81958b63c7beef117f2efe53db59, then manually replaced the package in the same prefix with the same HOME/state/config (npm install --global --prefix "$PREFIX" --allow-scripts=openclaw ./openclaw-candidate.tgz). This exercised manual package replacement, not automatic updater delivery. The candidate required the documenteddoctor --fix --non-interactivestep for existing credential custody and agent schema v25 → v37 migration; Doctor created migration backups before applying it. This PR introduces no schema change itself.Redacted result excerpt from the installed candidate:
Stable's public
sessions.resetproduced a reset event with a nonzero timestamp, not a legacyupdatedAt: 0pending marker. That native stable reset state was carried through and retained its original boundary. Zero-timestamp rotation remains covered by the unchanged, passing consumer regressions; no fabricated marker is claimed as stable-produced.The original model, reset policy, memory settings, workspace, and tool profile were preserved. Normal Doctor changes added a missing display name, materialized the configured
num_ctx, and installed current config defaults; its suggestedskill_workshoppermission was added to this minimal test fixture. Final Doctor retained only informational empty-workspace/channel/backup tips. All original transcript events remained equal through migration and the subsequent turns. The model replay, final Doctor, index, and search completed in 180.08s; package replacement took 86.51s, and the head build took 233.6s. No code changes or push were needed; the operator Gateway and state were untouched.