Skip to content

core: wrap token budget window context - #29494

Merged
bolinfest merged 1 commit into
mainfrom
pr29494
Jun 22, 2026
Merged

core: wrap token budget window context#29494
bolinfest merged 1 commit into
mainfrom
pr29494

Conversation

@bolinfest

@bolinfest bolinfest commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Token-budget initial context carries thread and context-window lineage that the model should treat as one structured context-window block. Wrapping it in <context_window> makes that boundary explicit while preserving the existing window id content.

Before this change, the window identifiers were injected as an untagged developer text fragment:

Thread id <THREAD_ID>.
First context window id: <FIRST_WINDOW_ID>
Current context window id: <WINDOW_ID>
Previous context window id: <PREVIOUS_WINDOW_ID>

After this change, the same payload is wrapped as a context-window block:

<context_window>
Thread id: <THREAD_ID>
First context window id: <FIRST_WINDOW_ID>
Current context window id: <WINDOW_ID>
Previous context window id: <PREVIOUS_WINDOW_ID>
</context_window>

This adds shared CONTEXT_WINDOW_*_TAG protocol constants, updates TokenBudgetContext to render with those markers, treats the new wrapper as contextual developer content when mapping history, and refreshes the token-budget request-shape assertions and snapshot.

Verification:

  • just test -p codex-core token_budget
  • just test -p codex-core recognizes_context_window_as_contextual_developer_content

@bolinfest
bolinfest force-pushed the pr29494 branch 2 times, most recently from 4dcfeb3 to e29a3af Compare June 22, 2026 23:02
@bolinfest
bolinfest marked this pull request as ready for review June 22, 2026 23:07
@bolinfest
bolinfest requested a review from a team as a code owner June 22, 2026 23:07
Token-budget initial context carries thread and context-window lineage that the model should treat as one structured context-window block. Wrapping it in `<context_window>` makes that boundary explicit while preserving the existing window id content.

This adds shared `CONTEXT_WINDOW_*_TAG` protocol constants, updates `TokenBudgetContext` to render with those markers, treats the new wrapper as contextual developer content when mapping history, and refreshes the token-budget request-shape assertions and snapshot.

Verification:
- `just test -p codex-core token_budget`
- `just test -p codex-core recognizes_context_window_as_contextual_developer_content`
@bolinfest
bolinfest enabled auto-merge (squash) June 22, 2026 23:23
@bolinfest
bolinfest merged commit f1945de into main Jun 22, 2026
61 of 62 checks passed
@bolinfest
bolinfest deleted the pr29494 branch June 22, 2026 23:37
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants