Repository navigation
fix(codex): accept bounded upstream prompt provenance - #127730
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 22, 2026, 12:51 AM ET / 04:51 UTC. ClawSweeper reviewWhat this changesThe PR allows exact upstream Codex prompt provenance to use the settled-turn projector’s existing 512 KiB aggregate budget instead of the ordinary 64 KiB text limit, with boundary tests. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open for a Codex-area compatibility decision. The patch is narrowly scoped and no discrete code defect was found, but repository policy requires direct inspection of the pinned Codex source before a merge verdict. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherThe bundled Codex plugin projects a settled OpenClaw tool transcript into response items for a private app-server finalization turn. Codex receives those items through injection and returns the final channel-visible answer. flowchart LR
A[Settled OpenClaw transcript] --> B[Exact prompt provenance]
B --> C[Settled-turn projector]
C --> D[512 KiB aggregate budget]
D --> E[Codex item injection]
E --> F[Final channel answer]
Decision needed
Why: The plugin directly calls the external Codex app-server protocol, and repository policy requires direct source inspection before this compatibility decision can be made. Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +48. Total +51 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Confirm the pinned app-server injection contract, then rebase and land this focused repair while keeping the separate oversized-history producer work in #125254. Do we have a high-confidence way to reproduce the issue? Yes: current main deterministically rejects exact upstream provenance above 64 KiB before injection; the PR body also supplies an exact-head before/after Telegram trace. Is this the best way to solve the issue? Unclear: reusing the established 512 KiB aggregate cap is the narrowest local repair, but its Codex protocol compatibility still needs direct upstream-source confirmation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 48a2b45fede5. 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
HistoryReview history (3 earlier review cycles) |
|
ClawSweeper’s remaining item is the pinned Codex compatibility check, which its review environment could not perform: “repository policy requires direct inspection of the sibling Codex source before a Codex compatibility or merge verdict; that checkout is unavailable here.” The source change is one narrow bound override, ClawSweeper reports no actionable findings, the required CI gate is green, and the PR body includes a real Codex app-server 0.148.0 settled-finalization trace at 65,537 bytes with successful For maintainer convenience, Could a maintainer make the remaining Codex compatibility call? |
|
Fast-lane landing resolution for the latest ClawSweeper notes:
Exact-head CI, PR-context validation, owner tests, pinned-contract inspection, and real Telegram changed-path proof are green at |
Allow exact upstream prompt provenance to use the existing 512 KiB settled-projection budget while preserving ordinary text bounds and aggregate accounting. Co-authored-by: Marvinthebored <[email protected]>
Related to #125254.
AI-assisted with Codex. I reviewed the generated change and understand the behavior and compatibility boundary it modifies.
What Problem This Solves
Codex settled-turn finalization rejects exact
upstreamUserTextprovenance above 64 KiB before applying the existing 512 KiB complete-projection budget. OpenClaw can legitimately persist a larger exact prompt. The isolated finalizer then aborts beforethread/inject_items, leaving the Telegram turn without its final answer.This fixes only that secondary finalizer contradiction. It does not remove the degraded-engine whole-history continuity producer and must not close #125254.
Root cause and fix
projectSettledCodexMessagesapplied the ordinary-message 64 KiB field bound to exact prompt provenance. Exact provenance is a distinct contract: adopted-session activity detection exact-matches it against Codex user input, so truncation or substitution would corrupt ownership detection.The projector now admits exact provenance up to the existing 512 KiB projection budget. Ordinary user, assistant, tool-result, and tool-argument text remains capped at 64 KiB. Serialized response items are still charged to the aggregate 512 KiB limit and fail closed above it.
Evidence
Exact head:
8596e8ca443741f6481a8e611af60095d86d1e1f.6cb08cb8ee9ee6235c7bd1f5f3fd7b85b8673ce7): one real-user DM exercised the deterministic tool-only settled-finalizer path with a 68,884-byte prompt. Gateway result:Codex settled-turn projection found oversized upstream user text; Telegram showed the visible agent-failure warning. Verdict:actual=affected,toolOnlyTurnCompleted=true,finalizerStarted=false,injectedHistoryBytes=0,finalAnswerObserved=false.Codex settled-turn projection found oversized upstream user texton current main.node scripts/run-vitest.mjs extensions/codex/src/app-server/settled-turn-projection.test.ts extensions/codex/src/app-server/settled-turn-context.test.ts extensions/codex/src/app-server/settled-turn-finalizer.test.ts extensions/codex/src/app-server/bounded-turn.test.ts— 64/64 pass.pnpm exec oxfmt --checkon both touched files — pass.pnpm exec oxlinton both touched files — pass.pnpm tsgo— pass.pnpm check:test-types— pass.git diff --check origin/main...HEAD— pass.Pinned Codex contract
Directly verified against
openai/codextagrust-v0.148.0(3ba0f711642a888aec92a611a3f3b2211157ff89), matchingextensions/codex/package.json:codex-rs/app-server-protocol/src/protocol/v2/thread.rs:ThreadInjectItemsParams.itemsis rawVec<JsonValue>with no protocol text-size cap.codex-rs/app-server/src/request_processors/turn_processor.rs:thread_inject_items_response_innerdeserializes each item asResponseItem, validates image URLs, and injects the items; it adds no text-size cap.codex-rs/app-server/tests/suite/v2/thread_inject_items.rs: injected response items are retained in model-visible rollout history.The final real-Telegram repaired-path verdict will be added after the exact-head local ClawSweeper gate.
Final real-Telegram repaired-path proof
A real Telegram user DM exercised the changed path on exact head
8596e8ca443741f6481a8e611af60095d86d1e1fwith the retained oversized-provenance fixture:{ "actual": "repaired", "promptBytes": 68884, "toolOnlyTurnCompleted": true, "finalizerStarted": true, "injectedHistoryBytes": 68884, "oversizedProvenanceRejected": false, "finalAnswerObserved": true }The redacted app-server trace records the first tool-only turn, then an isolated process calling
thread/inject_itemswith six items (largest exact input text: 68,884 bytes) beforeturn/start. Telegram observed typing plus one SUT answer containingCODEX_SETTLED_FINALIZATION_OK. This is the same deterministic flow that failed on current main before finalizer startup.