Skip to content

Preserve AGENTS world-state context - #788

Open
shiny-code-bot wants to merge 4 commits into
mainfrom
code/issue-787-agents-context
Open

Preserve AGENTS world-state context#788
shiny-code-bot wants to merge 4 commits into
mainfrom
code/issue-787-agents-context

Conversation

@shiny-code-bot

@shiny-code-bot shiny-code-bot commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Why

A single 32-KiB AGENTS context item did not hard-enforce the repository's per-item 10K-token rule. This amendment keeps the same approximate aggregate allowance while proving every model-visible item stays independently bounded.

Refs #787

What changed

  • Render AGENTS instructions as up to four fixed standalone shards, each capped at 8 KiB of final rendered InputText.
  • Preserve the static approximately 32-KiB aggregate allowance while counting markers, directory labels, notices, bounded envelopes, and truncation text inside the rendered caps.
  • Give every shard a stable ID, distinct marker/matcher pair, and the same full source-document hash for atomic refresh.
  • Migrate old unsharded snapshots with one primary replacement notice; remove obsolete continuation keys on shrink/removal.
  • Pre-bound oversized combined instructions with explicit middle truncation, then split deterministically at UTF-8 and nearby line boundaries.
  • Keep project_doc_max_bytes solely in the project loader; no global/home loader cap is added.
  • Ensure initial and steady-state pipelines emit every shard as a separate response item.

Verification

  • just test -p codex-core world_state — 104 passed, 0 failed.
  • just test -p codex-core agents_md — 66 passed, 0 failed.
  • just fix -p codex-core — completed successfully.
  • just fmt — completed successfully.
  • git diff --check — clean.
  • Final diff versus origin/main: 706 additions, 92 deletions; 798 changed lines across seven files.

Changed-files inspection was separately inconclusive: the configured IntelliJ Code Bridge descriptor was unavailable, so execution is not proven. This is an inspection/harness limitation, not a code failure.

Internal review delegation was unavailable. Automatic Validation and Automatic Background Review emitted no observable start or terminal events in this run, so neither status is claimed. Final independent review remains with external orchestration.

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.

2 participants