Repository navigation
fix(agents): identify changed facts behind prompt-cache drops - #186095
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
5f49445 to
3a7fb06
Compare
Name bounded runtime, routing, tooling, context-line, and computer-description changes only when reporting a cache drop. Keep private before-images bounded and exclude prompt values and arbitrary headings/tool names from warning details. Prompt and provider payload bytes remain unchanged.
3a7fb06 to
83eb1ea
Compare
|
Codex review: needs changes before merge. What this changesThis PR identifies changed prompt and tool-description facts in cache-drop diagnostics without printing their contents. Example: The Runtime suffix changes from model=fixture-a to model=fixture-b and cache reads fall from 8,000 to 2,000 tokens.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: it adds useful maintainer-directed diagnostics absent from current main, but leaves an existing integration-test expectation incompatible with the new output. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe embedded runner observes model-request prompts and tools, pairs snapshots with provider usage, and sends cache-drop explanations to logs and cache traces. flowchart LR
A[Model request] --> B[Request observer]
B --> C[Bounded diagnostic tracker]
D[Provider usage] --> C
C --> E[Fact comparison on drop]
E --> F[Warnings and cache traces]
Technical reviewBest possible solution: Retain the bounded attribution implementation and update the existing request-submit integration assertion to the positional diagnostic contract. Do we have a high-confidence way to reproduce the issue? Source confirms current main stops at section/tool attribution and deterministically shows the stale integration assertion; no tests or product commands were executed during this read-only review. Is this the best way to solve the issue? The existing tracker supplies the appropriate lifetime and comparison baseline, while one fact owner replaces the previous attribution helpers without changing provider requests. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 65f07e3fbf1e. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +263, Tests -2, Docs 0, Other +115. Total +376 across 5 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 27, 2026, 12:20 PM ET / 16:20 UTC. |
…aw#186095) * fix(agents): identify changed facts behind prompt-cache drops Name bounded runtime, routing, tooling, context-line, and computer-description changes only when reporting a cache drop. Keep private before-images bounded and exclude prompt values and arbitrary headings/tool names from warning details. Prompt and provider payload bytes remain unchanged. * test(agents): consolidate cache diagnostic regression coverage * test(agents): remove unused cache observation import
What Problem This Solves
Prompt-cache drop warnings identify a changed suffix section or tool description but do not explain which fact changed. Operators cannot distinguish a model-field change, tool-list reorder, routing policy change, or computer capability clause from unexplained churn.
User Impact
Warnings now include bounded, content-free fact names such as
Runtime.model,Session routing.hidden delegation,Tooling.tool list order, andcomputer.description.window observation. Arbitrary context uses line positions. Unknown headings and custom tool names use positions rather than printing their text. Prompts, tool definitions, provider payloads, and cache behavior are unchanged.Why This Change Was Made
Fact parsing and hashing happen only after a reportable cache drop. Exact before/after attribution therefore needs a before-image: private tracker data retains at most 32,768 UTF-16 code units of suffix text and 16,384 of tool descriptions per request snapshot. Oversized sources explicitly report unavailable fact detail. Suffixes are detached from large stable prefixes and reused when unchanged. Before-images follow the existing bounded snapshot/session lifecycle and never appear in exported trace snapshots.
The existing section/tool attribution code moves into the fact owner; there is no second prompt builder or provider path. Runtime production code grows by 263 net lines because this adds requested diagnostic functionality. The standalone owner benchmark adds 115 lines. This is an observability improvement, not a performance speedup.
Evidence
Six new fact-attribution regressions failed on the unchanged base for the intended missing detail. The final owner file passes all 33 tests, including content exclusion, deferred fact hashing, large-prefix/suffix bounds, computer clauses, and snapshot reuse. Focused observation/history/request-observer and prompt-prefix tests passed 114 tests before the tool-capture simplification; the final owner rerun covers that simplification. Export collision guard and both import/source closure files passed (32 tests). Scoped oxfmt, typed lint, and
git diff --checkpass. When rebasing exposed an inherited test-line ceiling overage, consolidating this owner file preserved all 33 cases and made this PR net -2 test lines. The existing non-growth ratchet passes; the ceiling was not edited. Owner file: 11.96 seconds total including transformation, under one second of test execution.Review: independent subagent review (autoreview route unavailable), scoped-clean through P2. Codex autoreview refused before inference because the selected provider did not match operator configuration; no configuration was changed. The fresh-context reviewer inspected the final production diff, direct caller, warning consumer, renderer grammar, docs, and benchmark. No accepted findings remain. The subsequent test-only consolidation received an additional independent review.
Synthetic owner benchmark: 64 rotating active observations, 40 tools, a roughly 100 KB stable prefix, and a multi-section suffix. Five counterbalanced base/candidate pairs, 5,000 requests per arm per pair (25,000 per side per mode). CPU is untraced; allocation uses separate inspector sampling passes including collected objects. Acceptance was unchanged prompt bytes, drop-only fact hashing, bounded content-free output, and explicit attribution cost. Mean values:
The drop workload includes alternating cache-hit and cache-drop requests. The additional work buys fact attribution; normal-path overhead is approximately 2.5 µs/request. Host one-minute load ranged from 28.1 to 33.8. Usage and baseline-owner selection are documented in
scripts/perf/prompt-cache-facts-measure.ts.No live server was accessed. No Gateway stress/load result is claimed: this attribution-only change used the requested focused fast path, so Gateway CPU, GC, event-loop/RPC percentiles, and RSS/heap impact remain unmeasured. PR CI is the broad validation gate.