[codex] fix Codex budget native compaction trigger#87158
Conversation
4a4bb8f to
47f3374
Compare
|
Thanks for the context here. I did a careful shell check against current Current main already handles the useful Codex budget/native-compaction behavior through the merged context-engine-first implementation from #91590, so this older helper-only branch is no longer a useful landing candidate. So I’m closing this as already implemented rather than keeping a duplicate issue open. Review detailsBest possible solution: Keep the merged current-main implementation from #91590 as the canonical Codex budget compaction path and close this stale branch. Do we have a high-confidence way to reproduce the issue? Not applicable as a current-main reproduction: the relevant behavior is already fixed on main by #91590. The pre-fix failure mode is documented by that merged PR's before/after proof and by the older ClawSweeper review on this PR. Is this the best way to solve the issue? No, this PR is no longer the best way to solve the issue. Current main uses the safer owner-boundary shape: context-engine compaction remains primary and Codex native Security review: Security review cleared: The PR diff does not add dependencies, workflows, package-resolution changes, credentials handling, or new external code execution paths. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 7f1d82ab2518; fix evidence: commit a8d33f23a09d, main fix timestamp 2026-06-09T21:33:00-05:00. |
|
ClawSweeper PR egg ✨ Hatched: 🥚 common Cosmic Shellbean Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
|
ClawSweeper applied the proposed close for this PR.
|
Summary
budgetpreflight trigger instead of treating it like an unrelated automatic trigger.overflowtriggers on the existing Codex-owned skip path.agents.defaults.compaction.maxActiveTranscriptBytesstarts native Codex compaction for Codex harness sessions.Duplicate check
I checked current
origin/mainplus open PRs/issues before opening this PR. Currentmainstill skippedtrigger: "budget"inextensions/codex/src/app-server/compact.tsand had a test pinning that skip incompact.test.ts. I did not find an open PR from this fork for this compaction trigger; the only openSteady-aiPR was #86716 for Discord delivery accounting. I also inspected nearby compaction/Codex PRs including #81916, #63636, #54585, #86160, #83229, #82856, #86094, and #73092; none madebudgetstart native Codex compaction.Real behavior proof
Behavior addressed: Codex harness sessions with
agents.defaults.compaction.maxActiveTranscriptBytescall compaction withtrigger: "budget". Current source skipped that trigger before sendingthread/compact/start, so the local transcript-byte guard could leave long-lived channel mirrors above the configured cleanup threshold.Real environment tested: OpenClaw source worktree rebased on
origin/mainatd88681662b, PR head47f33748d4, on WSL Ubuntu 24.04 / Node 22.22.0. The source-runtime probe used the realmaybeCompactCodexAppServerSessionentry point and real Codex session-binding file I/O, with the app-server client boundary instrumented only to capture the outgoing app-server request.Exact steps or command run after this patch: Ran a
node --import tsx -source-runtime probe from the PR worktree. The probe wrote a temporary Codex app-server binding, invokedmaybeCompactCodexAppServerSessiononce withtrigger: "budget"and once withtrigger: "overflow", then printed the request/result shape. I then ran the focused checks listed in Verification.Evidence after fix: Copied terminal output from the source-runtime probe:
Observed result after fix: Budget preflight compaction now sends
thread/compact/startand returns the existing pending native-compaction result shape. The overflow trigger sends no additional app-server request and still returns the existingnon_manual_triggerskip result.What was not tested: I did not run a live Discord or Telegram gateway replay from this source branch. The live failure was observed in an installed runtime; this PR ports the source-level behavior and locks it with focused Codex extension tests.
Risk
Low. The change is limited to the Codex app-server compaction trigger gate. It does not wait for native compaction completion, add credentials, change network targets, or replace Codex compaction with OpenClaw summarization.
Verification
OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-codex.config.ts extensions/codex/src/app-server/compact.test.ts-> 1 file / 19 tests passednode_modules/.bin/oxfmt --check extensions/codex/src/app-server/compact.ts extensions/codex/src/app-server/compact.test.ts docs/plugins/codex-harness-runtime.md docs/reference/session-management-compaction.md-> passedgit diff --check-> passedpnpm docs:list-> passednode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.extensions.json extensions/codex/src/app-server/compact.ts extensions/codex/src/app-server/compact.test.ts-> passednode scripts/check-docs-mdx.mjs docs/plugins/codex-harness-runtime.md docs/reference/session-management-compaction.md-> passed