-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
[Bug]: Codex native compaction can leave post-compaction context usage stale or unknown #66263
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
After native Codex app-server compaction, OpenClaw can lack a reliable post-compaction token count. When that happens, status/context reporting should explicitly treat usage as unknown or bounded, not revive stale pre-compaction usage.
Parent tracker: #66251
Steps to reproduce
Expected behavior
After Codex native compaction:
tokensAfter, OpenClaw marks context usage as unknown/stale rather than pretending the old count is freshActual behavior
Native Codex compaction may complete without a reliable post-compaction token snapshot.
In that case, OpenClaw can fall back to stale transcript-derived or cumulative usage data and display it as current context usage. This makes compaction appear ineffective or can create confusing context reports after a successful compaction.
OpenClaw version
2026.4.10 / 2026.4.11 reports, plus current
maininvestigationOperating system
macOS and Linux reports
Install method
npm/global CLI and local source investigation
Model
codex/gpt-5.4
Provider / routing chain
OpenClaw -> bundled codex plugin -> Codex app-server
Additional provider/model setup details
NOT_ENOUGH_INFO
Logs, screenshots, and evidence
Scope boundary
This issue is specifically about native Codex app-server compaction and post-compaction context accounting.
Cumulative app-server token projection is related but partly tracked separately in #64669. This issue should focus on compaction boundaries,
tokensAfter, stale/unknown state, and status reporting after native compaction.Acceptance criteria
tokensAfterwhen the app-server provides it.tokensAfteris unavailable, OpenClaw records post-compaction context usage as unknown/stale rather than fresh.Suggested test coverage
tokensAfterwhen available.tokensAfteris absent.Related
Impact and severity
Affected: Users running OpenClaw with the bundled Codex harness.
Severity: High for long-running Codex sessions that rely on compaction/status reporting.
Frequency: Observed during Codex harness stabilization investigation.
Consequence: Users can see misleading context usage after compaction, making it difficult to tell whether compaction succeeded or whether a session is safe to continue.
Additional information
The local investigation has in-progress changes in this area. This issue is intended to capture the observed failure mode and the acceptance criteria for a focused fix.