fix(codex): rotate transcript after harness compaction#82856
fix(codex): rotate transcript after harness compaction#82856hansolo949 wants to merge 2 commits into
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. at source level: current main returns the harness compaction result before transcript rotation, and the rotation helper currently refuses transcripts without a compaction entry. The PR body also supplies terminal proof of the after-fix rotation behavior from a real local setup. Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the PR after normal CI and maintainer gates, preserving synthetic rotation plus established post-compaction side effects for harness compaction without a delegated successor. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main returns the harness compaction result before transcript rotation, and the rotation helper currently refuses transcripts without a compaction entry. The PR body also supplies terminal proof of the after-fix rotation behavior from a real local setup. Is this the best way to solve the issue? Yes. The updated approach keeps the fix in the compaction transcript utility and harness finalization path, and the second commit now emits the same post-compaction side effects expected by the existing rotation paths. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 45d9a0948571. |
|
Addressed ClawSweeper feedback in
Latest GitHub checks are green. @clawsweeper re-review |
Summary
Verification
node scripts/run-vitest.mjs run --config test/vitest/vitest.agents-pi-embedded.config.ts src/agents/pi-embedded-runner/compaction-successor-transcript.test.tsnode scripts/run-vitest.mjs run --config test/vitest/vitest.agents-pi-embedded.config.ts src/agents/pi-embedded-runner/compact.hooks.test.tspnpm tsgo:core:testpnpm exec oxfmt --check --threads=1 src/agents/pi-embedded-runner/compact.queued.ts src/agents/pi-embedded-runner/compaction-successor-transcript.ts src/agents/pi-embedded-runner/compact.hooks.harness.ts src/agents/pi-embedded-runner/compact.hooks.test.ts src/agents/pi-embedded-runner/compaction-successor-transcript.test.tsgit diff --checkReal behavior proof
Behavior addressed: Successful external agent-harness compaction, including Codex native app-server compaction, can compact the provider thread without writing an OpenClaw
type: "compaction"transcript boundary. Withagents.defaults.compaction.truncateAfterCompaction = true, OpenClaw should still rotate to a smaller active successor transcript instead of continuing to carry the bloated parent transcript.Real environment tested: Han's local OpenClaw setup on macOS, running installed OpenClaw
2026.5.16-beta.3with the equivalent local hot patch applied while investigating this regression. The source PR moves the same behavior into the core harness compaction wrapper.Exact steps or command run after this patch: Ran
openclaw --version,openclaw health --json, and a local Codex-native compaction smoke that copied the real main session transcript, simulated the Codex app-server compaction completion path, and inspected the rotated successor transcript written by OpenClaw.Evidence after fix: Terminal output from the real local OpenClaw setup:
Observed result after fix: The active successor transcript shrank from
958625bytes to106636bytes, retained the recent40message tail, wrote exactly one synthetic compaction entry for the Codex app-server backend, and preserved the original parent transcript path for rollback/history.What was not tested: A full live WebChat browser run from this source branch was not run in the PR worktree; the live setup proof above was run against the installed local OpenClaw bundle with the equivalent hot patch.