Skip to content

fix(codex): pass maxRenderedHistoryContextChars to legacy mirrored-history fallback#1

Open
thomaszta wants to merge 1 commit into
mainfrom
fix/84084-mirrored-history-context
Open

fix(codex): pass maxRenderedHistoryContextChars to legacy mirrored-history fallback#1
thomaszta wants to merge 1 commit into
mainfrom
fix/84084-mirrored-history-context

Conversation

@thomaszta

Copy link
Copy Markdown
Owner

Summary

What problem does this PR solve?

  • The legacy mirrored-history fallback in run-attempt.ts:1088-1092 was calling projectContextEngineAssemblyForCodex without passing maxRenderedContextChars, causing it to fall back to DEFAULT_RENDERED_CONTEXT_CHARS = 24000 instead of deriving a budget-scaled cap from contextTokenBudget.

Why does this matter now?

What is the intended outcome?

What is intentionally out of scope?

  • Root cause investigation for why some channels frequently re-establish Codex threads (separate issue)
  • Changes to UI or configuration defaults

What does success look like?

  • Legacy fallback now uses budget-scaled projection cap (e.g., 272k tokens → up to 1M chars / ~250k tokens of rendered history capacity)

What should reviewers focus on?

  • extensions/codex/src/app-server/run-attempt.ts:1088-1098 — the legacy fallback call site

Linked context

Which issue does this close?

Which issues, PRs, or discussions are related?

Was this requested by a maintainer or owner?

  • ClawSweeper:queueable-fix + clawsweeper:fix-shape-clear + clawsweeper:source-repro labels

Real behavior proof (required for external PRs)

  • Behavior or issue addressed: Legacy mirrored-history fallback ignores contextTokenBudget
  • Real environment tested: Local checkout with Codex extension
  • Exact steps or command run after this patch: N/A — code path requires live Codex session with mid-session thread rebuild trigger
  • Evidence after fix: Code now passes maxRenderedContextChars derived from resolveCodexContextEngineProjectionMaxChars() at legacy fallback call site, matching active-context-engine pattern at lines 952-957
  • Observed result after fix: Legacy fallback will use budget-scaled cap instead of 24,000 default
  • What was not tested: Live production session (requires Codex OAuth + long-running channel)
  • Proof limitations: Code change only — verification requires live environment
  • Before evidence (optional): Pre-fix: legacy fallback omitted maxRenderedContextChars kwarg

…allback

The legacy mirrored-history fallback at run-attempt.ts:1088-1092 was calling
projectContextEngineAssemblyForCodex without maxRenderedContextChars,
falling back to DEFAULT_RENDERED_CONTEXT_CHARS=24000 instead of deriving
a budget-scaled cap from contextTokenBudget.

This fix copies the maxRenderedContextChars kwarg from the active-context-engine
branch (lines 952-957) into the legacy fallback call site, matching the
behavior added in PR openclaw#80761 for issue openclaw#80760.

Fixes openclaw#84084
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Codex legacy mirrored-history fallback ignores contextTokenBudget and caps high-window sessions at ~24k rendered chars

2 participants