Repository navigation
fix(codex): report native project docs truthfully - #126010
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 5:05 PM ET / 21:05 UTC. ClawSweeper reviewWhat this changesThe PR marks native Codex project documents as having unknown injected size when app-server exposes only their source paths, and updates Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open for maintainer handling: the local accounting repair is coherent, but the required direct Codex-source contract check is unavailable in this review environment. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherCodex-backed runs assemble a session context report that feeds flowchart LR
A[Project AGENTS files] --> B[Codex app server]
B --> C[Instruction source paths]
D[OpenClaw-injected files] --> E[Session context report]
C --> E
E --> F[/context]
E --> G[Context map]
E --> H[Control UI Usage details]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +60, Tests +70, Docs +4. Total +134 across 9 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Verify the pinned Codex runtime contract directly, then retain this producer-owned unknown state and its existing consumer treatment if that contract confirms per-file retained bytes are unavailable. Do we have a high-confidence way to reproduce the issue? Yes for the local defect: current main reports an uninjected native AGENTS.md as fully injected at extensions/codex/src/app-server/attempt-context.ts:464-466; upstream-runtime confirmation is unavailable here. Is this the best way to solve the issue? Unclear: the closed unknown state is the correct local owner boundary, but the mandatory direct Codex source check could not be completed. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8032e6c75e01. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready verification for exact head
Known proof boundary: app-server does not expose exact retained bytes, so the repaired output intentionally remains |
|
Merged via squash.
|
What Problem This Solves
Follow-up to #125966. Native Codex turns load project
AGENTS.mdfiles under one aggregate root-to-working-directory byte budget, so a later file can be partially retained. OpenClaw's context accounting instead treated every nativeAGENTS.mdas fully injected whenever OpenClaw had not injected it itself.That made
/context, context maps, and Usage details report a precise value that the Codex app-server cannot actually provide.Why This Change Was Made
Codex 0.147 exposes the loaded instruction source paths on thread start, resume, and fork, but it does not expose per-file retained byte counts or completeness. A listed source can still have been truncated by the aggregate budget.
This change gives native project documents an explicit
native_unverifiedaccounting state with unknown injected/truncated values. OpenClaw-injected workspace files remain precisely measured./contextexplains the distinction and keeps native files out of the separate OpenClaw character-budget analysis; context maps and the Control UI omit unknown bytes rather than inventing a value.The 128 KiB normal-thread default landed by #125966 is unchanged. Lightweight and restricted zero-document behavior is unchanged. Normal runs emit no new messages; the warning is visible only when an operator explicitly opens
/contextreporting or Usage details.User Impact
Operators inspecting context diagnostics now see native
AGENTS.mdfiles asNATIVE/UNVERIFIED/unknowninstead of a false full-injection count. The report explains that earlier/root project documents consume the shared byte budget and recommends reading the relevant scoped file directly when guidance appears missing.Measured OpenClaw workspace files, memory routing, normal Codex execution, and restricted/lightweight turn behavior are unchanged.
Evidence
rust-v0.147.0(3ed6f04f6bf8b7c46299d1cb1ff99c74ce21a51d) inspected directly:codex-rs/core/src/agents_md.rs:94-143applies one byte budget across root-to-CWD project documents and truncates a later file to the remaining bytes.codex-rs/core/src/agents_md.rs:403-412retains source paths, not retained-byte counts.codex-rs/app-server-protocol/src/protocol/v2/thread.rs:175-208,408-459,600-633exposesinstructionSourceson start/resume/fork without completeness metadata.AGENTS.mdreportsnative_unverifiedwith null retained counts; an agent-workspaceAGENTS.mdinjected by OpenClaw remains exactly measured./contextboundary coverage verifiesNATIVE/UNVERIFIED, actionable aggregate-budget guidance, and no incorrect OpenClaw bootstrap-limit advice.AGENTS.mdrenders asunknownand contributes no invented token count.pnpm docs:check-mdx: 777 files passed.git diff --check origin/main...HEAD: clean.Visual proof:
Known proof boundary: current app-server responses do not expose the exact retained bytes, which is the reason this report is intentionally unverified rather than reconstructed from local file contents.
AI-assisted; implementation and final diff were reviewed and verified by Peter Steinberger.