Repository navigation
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 3, 2026, 11:34 AM ET / 15:34 UTC. Summary PR surface: Source +12, Tests +70. Total +82 across 3 files. Reproducibility: yes. Source inspection shows current main reads the active Codex session file before thread startup, and an ENOENT from that read returns undefined and triggers the wrapper warning. Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land the ENOENT-only lower-reader fix with the added reader and wrapper regression tests, preserving malformed-history diagnostics. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main reads the active Codex session file before thread startup, and an ENOENT from that read returns undefined and triggers the wrapper warning. Is this the best way to solve the issue? Yes. Handling only ENOENT in the lower mirrored-history reader is narrower than muting the wrapper warning and preserves diagnostics for malformed non-empty history. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f3eccb0dfdec. Label changesLabel justifications:
Evidence reviewedPR surface: Source +12, Tests +70. Total +82 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
Thanks @litang9. I validated the startup race, preserved your two commits and Alex Tang's authorship, and landed the narrowed current-main version through #100484 as The replacement was necessary because GitHub's Focused local and Testbox tests passed 11/11, |
What Problem This Solves
Codex app-server harness hooks can warn with
failed to read mirrored session history for codex harness hookswhen they read mirrored history before the session JSONL file exists.Current
mainalready treats parsed-empty session history as[], so this PR focuses on the remaining transient state:ENOENTwhile the file-backed active transcript artifact has not been created yet.Why This Change Was Made
A missing mirrored session file during startup means there is no history to replay yet. It should behave like empty history rather than surfacing as a failed history read.
Malformed non-empty history remains unchanged: the reader still returns
undefined, so the existing warning path continues to surface real transcript corruption.User Impact
This reduces noisy Codex embedded-runtime warnings for healthy new sessions whose mirrored history file is created after the harness hook runs.
It does not suppress warnings for malformed non-empty transcript files.
Evidence
/tmp/openclaw/openclaw-2026-07-03.log:failed to read mirrored session history for codex harness hooksappeared for yuantai cron sessions before the corresponding JSONL file's first record timestamp; after the run completed, those files parsed successfully.pnpm install --frozen-lockfilecompleted in the rebased worktree before running validation.node --import tsx --input-type=modulelive terminal proof passed from the patched checkout and imported the productionrunCodexAppServerAttemptpath, not Vitest.node --import tsx --input-type=modulelive terminal proof passed from the patched checkout and imported the productionreadMirroredSessionHistoryMessageswrapper, not Vitest.node scripts/run-vitest.mjs extensions/codex/src/app-server/attempt-context.test.ts extensions/codex/src/app-server/session-history.test.tspassed with12tests.git diff --checkpassed.Real behavior proof
Behavior addressed: Codex harness hook history reads should not warn when the mirrored session file is temporarily missing during a new-session startup race.
Real environment tested: local OpenClaw gateway logs from
2026-07-03under the user's active~/.openclawstate, plus the current source checkout rebased ontoupstream/mainat0420aefb1dand patched throughfb7c53c51c.After-fix production Codex attempt proof
This proof does not use Vitest. It runs a one-shot Node process from the patched checkout, imports the production
runCodexAppServerAttemptimplementation fromextensions/codex/src/app-server/run-attempt.ts, starts an in-process app-server client double, and lets the real Codex attempt startup path proceed throughthread/start,turn/start, and cleanup. The session file is intentionally missing before the attempt starts, matching the startup race that produced the gateway warning.Exact post-patch command shape:
Relevant output from the patched checkout:
What the production attempt proof verifies:
before_run_session_file_exists=no).thread/start,turn/start,thread/unsubscribe).after_run_session_file_exists=yes), matching the observed startup race rather than a permanently invalid path.After-fix production wrapper proof
This proof does not use Vitest. It runs a one-shot Node process from the patched checkout, imports the production
readMirroredSessionHistoryMessageswrapper fromextensions/codex/src/app-server/attempt-context.ts, and captures the productionembeddedAgentLog.warncall site that emitsfailed to read mirrored session history for codex harness hooks.Exact post-patch command shape:
Relevant output from the patched checkout:
What the live wrapper proof verifies:
session.jsonlreturns[]from the same wrapper used by harness hooks.embeddedAgentLog.warnis not called for that missing-file case, so the reported gateway warning is not emitted.undefinedand callsembeddedAgentLog.warn("failed to read mirrored session history for codex harness hooks", { sessionFile }), preserving the real-corruption warning path.Regression tests
Exact post-patch test command:
Relevant output:
Related
mainalready handles parsed-empty history. This PR covers the missing-file transient state against the current scoped reader API.