Skip to content

fix(compaction): drop context-engine fallback on codex ownership skip - #115666

Merged
steipete merged 1 commit into
mainfrom
steipete/codex-skip-no-fallback-114155
Jul 29, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/codex-skip-no-fallback-114155

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Budget-triggered compaction for Codex OAuth sessions failed with No API key found for provider "openai" after successful turns. The chain: post-turn CLI compaction asks the codex harness to compact; codex correctly declines with "codex app-server owns automatic compaction"; the unlocked branch of that intentional skip then set fallbackToContextEngine: true, and the context-engine pass requires a direct provider API key that OAuth-only sessions don't have — a non-benign failure that surfaced every turn.

Closes #114155. Supersedes the approach in #114182 (closed), whose diagnosis by @HOYALIM identified this exact chain (Co-authored-by on the commit).

Why This Change Was Made

Post-#115284/#115514 the ownership contract is explicit: Codex owns native-thread token pressure (codex-rs runs inline auto-compaction during turns — codex-rs/core/src/session/turn.rs:1016-1095); OpenClaw owns only the host-transcript byte fuse. The intentional ownership skip is therefore a terminal no-op, not a reason to compact by other means: the unlocked branch now returns {compacted: false} exactly like the locked branch already did (src/agents/command/cli-compaction.ts), with the skip logged. Net −10 lines; deletes the last branch that fought the ownership boundary.

User Impact

Codex OAuth (ChatGPT-auth) sessions no longer error after successful turns when budget compaction fires; codex's own automatic compaction continues to manage the thread, and the host byte fuse (#115514) continues to bound the host transcript independently.

Evidence

  • node scripts/run-vitest.mjs src/agents/command/cli-compaction.test.ts — 23 passed; the fallback test is rewritten to assert the clean skip for both unlocked and model-selection-locked sessions (no context-engine call, no compaction-store record).
  • Codex-backed autoreview on the commit: clean, no accepted findings (0.98).
  • Failure chain verified on current main before the fix (skip → fallbackToContextEngine: true → non-benign "No API key found" throw at cli-compaction.ts:784-790); codex inline auto-compaction verified in sibling ../codex source.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Jul 29, 2026
@steipete
steipete marked this pull request as ready for review July 29, 2026 06:17
@steipete
steipete force-pushed the steipete/codex-skip-no-fallback-114155 branch from c357081 to 68e6a1c Compare July 29, 2026 10:54
@steipete
steipete merged commit bc3a4c6 into main Jul 29, 2026
122 checks passed
@steipete
steipete deleted the steipete/codex-skip-no-fallback-114155 branch July 29, 2026 11:11
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to yetval/openclaw that referenced this pull request Jul 29, 2026
* origin/main: (224 commits)
  fix(memory): preserve Windows session ownership (openclaw#115851)
  fix(compaction): drop context-engine fallback on codex ownership skip (openclaw#114155) (openclaw#115666)
  fix(msteams): ignore blank certificate settings (openclaw#109112)
  fix(usage): guard malformed DeepSeek payloads (openclaw#110785)
  docs(agents): reword imported review rules in repo voice
  docs(agents): add context-budget, tool-description, cache-invalidation, and review-premise rules
  docs(agents): mock-gateway proof satisfies gate without discouraging live proof
  docs(agents): add vitest in-flight edit rule and mock-gateway proof recipe
  docs(agents): restructure root AGENTS.md around product doctrine and deduped policy
  fix(codex): keep completed answers over audit gaps (openclaw#115849)
  test(cli): isolate unknown-command process validation (openclaw#115848)
  fix(memory-host-sdk): resolve stable execPath for worker fork to survive Homebrew Node upgrades (openclaw#99318)
  feat(ui): add composer capability menu (openclaw#115800)
  fix(synology-chat): stop fabricating send message ids (openclaw#110770)
  fix(feishu): reply to direct messages by chat id (openclaw#109637)
  fix(acp): attach error listener to spawned ACP agent process (openclaw#109529)
  fix(sessions): deliver agent announcements to direct message sessions (openclaw#115811)
  fix(nextcloud-talk): reject reactions for disabled or unconfigured accounts (openclaw#112675)
  refactor(ui): move Agent Defaults entry from the sidebar into the Agents page (openclaw#115836)
  feat(gateway): push session PR indicators to subscribed clients (openclaw#115643)
  ...

# Conflicts:
#	src/agents/apply-patch.ts
#	src/agents/sandbox/fs-bridge-mutation-helper.ts
pull Bot pushed a commit to yann0001/openclaw that referenced this pull request Jul 29, 2026
* origin/main:
  fix: CJK replies are silently dropped instead of recovered when the model skips message(action=send) (openclaw#115556)
  fix(gateway): stop managed crash loops for pending agent DB migrations (openclaw#115631)
  fix(plugins): validate constrained empty config schemas (openclaw#109569)
  fix(cli-runner): scope bundle-MCP cleanup to the run's session, not the process-wide loopback server (openclaw#110251)
  fix(feishu): log message content JSON parse failures instead of silently swallowing (openclaw#107947)
  docs(vision,agents): layer calibration, interface-on-demand, telemetry opt-in, whole-document guidance rules
  fix(memory): preserve Windows session ownership (openclaw#115851)
  fix(compaction): drop context-engine fallback on codex ownership skip (openclaw#114155) (openclaw#115666)
  fix(msteams): ignore blank certificate settings (openclaw#109112)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
* origin/main:
  fix: CJK replies are silently dropped instead of recovered when the model skips message(action=send) (openclaw#115556)
  fix(gateway): stop managed crash loops for pending agent DB migrations (openclaw#115631)
  fix(plugins): validate constrained empty config schemas (openclaw#109569)
  fix(cli-runner): scope bundle-MCP cleanup to the run's session, not the process-wide loopback server (openclaw#110251)
  fix(feishu): log message content JSON parse failures instead of silently swallowing (openclaw#107947)
  docs(vision,agents): layer calibration, interface-on-demand, telemetry opt-in, whole-document guidance rules
  fix(memory): preserve Windows session ownership (openclaw#115851)
  fix(compaction): drop context-engine fallback on codex ownership skip (openclaw#114155) (openclaw#115666)
  fix(msteams): ignore blank certificate settings (openclaw#109112)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Budget-triggered compaction hard-fails on Codex OAuth sessions — native compaction path is ordered after the one requiring an API key

1 participant