Repository navigation
fix(agents): preserve prompt-released session metadata - #93194
Conversation
|
ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed June 16, 2026, 2:06 AM ET / 06:06 UTC. Summary PR surface: Source +236, Tests +692. Total +928 across 4 files. Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Review metrics: none identified. Stored data model Merge readiness This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict. Risk before merge
Maintainer options:
Next step before merge
Review detailsBest possible solution: Retry the Codex review after fixing the execution failure. Do we have a high-confidence way to reproduce the issue? Unclear. The review failed before ClawSweeper could establish a reproduction path. Is this the best way to solve the issue? Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 2b752ac0d1f4. Label changesLabel changes:
Evidence reviewedPR surface: Source +236, Tests +692. Total +928 across 4 files. View PR surface stats
What I checked:
Likely related people:
How this review workflow works
|
a2ed886 to
e616863
Compare
e616863 to
1710152
Compare
|
Addressed the review follow-up by extending the regression case to cover the remaining accepted control-entry branches ( |
|
Added a PR-body compatibility note clarifying that this does not introduce or migrate session JSONL types, and that prompt-content entries ( |
1710152 to
7507d95
Compare
|
Land-ready verification for Branch-specific proof:
The six remaining failed checks exactly match Direct Codex contract checked:
Known proof gap: no production-credential external channel delivery was run. The real filesystem, lock, publication, navigation, Codex projection, and doctor paths were exercised directly. |
Summary
Fixes #93193.
Embedded attempts now preserve safe session rows appended while the prompt lock is released without treating them as a takeover or allowing a stale
SessionManagerrewrite to discard them.openclaw doctor --fix.Why this shape
Allowing more JSONL entry types at the fence is insufficient because an already-open manager can later rewrite accepted rows away. Reloading the whole manager is unsafe because it can drop prepared or not-yet-flushed active state. The final implementation keeps one canonical transcript graph, records side appends explicitly, centralizes leaf-controlled context selection, and carries owned-write facts through the lock scope instead of rediscovering them.
Verification
Final head:
fe9695d717045ca156a45043793b9e097d2b65f7git diff --check: passed.Exact-head AWS Crabbox run
run_0496c4c08e6c:c7a.16xlarge, Linux, Node 24.16.0, pnpm 11.2.2.pnpm check:test-typesreached the existingorigin/mainfailure only:extensions/codex/src/app-server/bounded-turn.ts:223-224.Run: https://crabbox.openclaw.ai/portal/runs/run_0496c4c08e6c
The final Crabbox checkout is rebased onto current
origin/mainatb5648b1d5ee0f21823ad5873f717a6532000b09a. Its type gate asserts that these are the only two type errors and fails on any additional error; this PR does not touchbounded-turn.ts.Direct Codex contract inspection:
../codex/codex-rs/app-server-protocol/src/protocol/v2/thread.rs:329-349../codex/codex-rs/core/src/session/session.rs:1068-1089../codex/codex-rs/app-server/src/request_processors/thread_lifecycle.rs:540-567../codex/codex-rs/app-server/src/request_processors/turn_processor.rs:736../codex/codex-rs/app-server-protocol/src/protocol/v2/thread.rs:1240-1243These paths confirm that thread resume/fork/history use the selected persisted rollout path and that turn start consumes the resumed thread state; OpenClaw therefore must project the canonical active transcript branch consistently before handing history to Codex.
Real behavior proof
Behavior addressed: Prompt-time delivery mirrors, global metadata, side appends, and nested owned writes survive stale-manager operations without entering active model context or silently masking takeover.
Real environment tested: Linux AWS Crabbox using real session files,
acquireSessionWriteLock, owned transcript publication,SessionManager, transcript navigation/checkpoints, Codex history projection, and the builtopenclaw doctor --fixCLI.Exact steps or command run after this patch:
pnpm crabbox:run -- --provider aws --class fast --market on-demand --idle-timeout 90m --ttl 240m --timing-json --preflight --script /tmp/pr-93194-crabbox-e2e.tsEvidence after fix: Crabbox run
run_0496c4c08e6ccompleted the production build, seven real scenarios, and 1,181 tests. The scenarios covered prompt-release delivery/global metadata, terminal side append after reopen, multi-controller publication, navigation/checkpoint/fork/Codex projection, malformed leaf controls, doctor repair, drained nested takeover propagation, and primary-error preservation.Copied live terminal output:
Observed result after fix: Active context retained the intended user/assistant branch; side deliveries and metadata persisted across reopen/rewrite; navigation and Codex history selected the same canonical branch; doctor removed invalid hidden runtime state; drained takeover rejected outer success; an existing outer failure retained precedence.
What was not tested: A live external channel/provider delivery using production credentials was not exercised. The real on-disk session, lock, publication, navigation, Codex projection, and doctor paths used by that delivery were exercised directly.
Release-note context
Fix embedded agent sessions losing or exposing concurrent prompt-time transcript updates when stale managers, transcript rewrites, or nested owned writes overlap. Thanks @snowzlm for the report and original fix.