Skip to content

codex runtime: long SKILL.md reads lose their middle to output truncation #7831

Closed

Description

@dhshah13

Codex review loads skills/pr-review/SKILL.md through exec_command. Codex 0.157.0 cuts exec output at 10,000 tokens by keeping the first and last halves:

  • codex-rs core/src/unified_exec/mod.rs:79 (DEFAULT_MAX_OUTPUT_TOKENS = 10_000)
  • core/src/tools/context.rs:482-489 (the smaller of the requested budget and the model's truncation_policy, which is 10,000 for every bundled model)
  • utils/string/src/truncate.rs:126-127 (keeps head and tail, drops the middle)

pr-review/SKILL.md on main is 1,425 lines and 67,464 bytes (~16.8k tokens). A single read keeps up to about line 367 and from about line 980, and drops steps 3c-1 through 6d: security triage, risk, context packages, scope constraints, dispatch, collect and merge.

Codex's base prompt tells the model to continue after a truncated read. In 0.157.0 rollouts it did not:

  • The root read lines 241-1435 in one call, got Warning: truncated output (original token count: 13620), and went on to dispatch without rereading.
  • Two other roots read only lines 1-240.
  • A root told to read at most 200 lines per call read all 1,425 lines with no truncation.

These rollouts come from the native sub-agent branch (fullsend-ai/agents#1542), but the read happens before any dispatch. Main's single-context path (codexNoSubagentNote) reads the same file with the same cap.

Retro is not affected: its four skills are 12 KB or less. skills/code-implementation/SKILL.md (49 KB) is over the cap for a Codex code agent.

Options:

  1. One paragraph in agents/review.md "Skill routing": wc -l, then sed -n ranges of at most 200 lines, one per tool call, rereading any range marked truncated. agents/*.md is not context-budget checked; skillsaw passes.
  2. The same rule, made generic, in fullsend's Codex runtime note (internal/runtime/codex_bootstrap.go codexNoSubagentNote), which covers every Codex agent.

pr-review/SKILL.md is at its skillsaw context-budget ceiling (16,784), so the rule cannot go in the skill itself without a baseline bump.

Activity

  1. fullsend-ai-triage commented on Sep 29, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 1:30 PM UTC · Completed 1:34 PM UTC

    Commit: c1724dc · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $0.36

  2. added
    type/bug
    component/runner
    component/harness
    priority/high
    ready-to-code
    on Sep 29, 2026
  3. fullsend-ai-triage commented on Sep 29, 2026

    @fullsend-ai-triage

    This report already pins the root cause precisely: Codex's unified_exec output cap (10,000 tokens, keeping head and tail) truncates single-call reads of SKILL.md files that exceed it, and codexNoSubagentNote in internal/runtime/codex_bootstrap.go -- which every Codex agent's instructions include on the single-context path -- currently has no rule telling the model to read such files in bounded chunks.

    Investigation confirms both halves of the report against the current checkout:

    • docs/agents/review.md's "Skill routing" section has no chunked-read guidance today.
    • codexNoSubagentNote likewise has no such rule, and it is the shared note appended to every Codex agent (not just review), so the exposure is broader than just the pr-review skill.
    • The open, draft-adjacent PR feat(#1500)!: support native Codex review and retro dispatch agents#1542 (blocked on its own companion PR, feat(#6970)!: support native Codex review and retro children #7809) already adds a 200-line chunked-read rule, but only to review.md's native sub-agent path in the agents repo -- it does not touch codexNoSubagentNote, so it does not close the general gap this issue describes on main. No open PR in this repo currently addresses codexNoSubagentNote itself.

    Recommended fix: add the equivalent chunked-read rule generically to codexNoSubagentNote, so it protects every Codex agent's single-context path, and keep the wording aligned with what #1542 is adding on the sub-agent side. Worth also checking skills/code-implementation/SKILL.md (49KB), which is already flagged in the report as over the cap.

    Severity is set to high because the failure mode is silent -- a Codex review run could skip security-relevant steps (security triage, risk assessment, scope constraints) with no visible error.


    Labels: Matches the labeling pattern used for prior Codex-runtime defects (#7264, #7725): a confirmed bug in the runtime/harness skill-loading path, high priority because the failure is silent and can drop security-relevant review steps.


    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
  4. fullsend-ai-coder commented on Sep 29, 2026

    @fullsend-ai-coder
    Contributor

    🤖 Finished Code · ✅ Success · Started 1:36 PM UTC · Completed 1:48 PM UTC

    Commit: c1724dc · View workflow run →

    Runtime: pi · Model: xai/grok-4.6 · Effort: high · Cost: $4.61

  5. added 2 commits that reference this issue on Sep 29, 2026
  6. added a commit that references this issue on Oct 5, 2026
  7. added 2 commits that reference this issue on Oct 6, 2026
  8. added a commit that references this issue on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcomponent/harnesscomponent/runnerpriority/highready-to-codetype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions