Repository navigation
fix(codex): large document uploads are unavailable to local file tools - #156758
Conversation
Media references identify canonical attachments but are not filesystem paths. Bind original input media to the host capability and let the actual Codex connection prepare verified document paths only for eligible local execution. Keep remote staging, read policy, workspace restrictions, live authority, and native input budgets with their existing owners. Execution notes do not alter canonical user messages or persisted media references. Cover registered delivery, native initial input and steering, remote placement, policy exclusions, changed workspace authority, and bounded metadata. Reuse the existing steering persistence cases to verify original SQLite transcript text. Release note: Codex can process complete saved document uploads with local file tools even when their inline text preview is truncated.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: blocked before merge. Reviewed September 23, 2026, 8:33 PM ET / September 24, 2026, 00:33 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch lets local Codex turns receive verified paths to saved document uploads and updates native prompt fitting, documentation, and regression coverage. Merge readiness⛔ Blocked before merge - 2 items remain Keep open. Current main still exhibits the reported limitation, and the branch has credible real-use proof with no concrete blocking code defect found. Repository-required test-cost evidence remains incomplete. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw saves uploads as media references and extracts bounded text for agent prompts. The Codex harness converts that input into native turns; the host may now provide local paths when placement and read policy permit them. flowchart LR
A[Uploaded document] --> B[Saved media reference]
B --> C[Host attachment check]
C --> D{Local read permitted?}
D -->|Yes| E[Verified path note]
D -->|No| F[Inline context only]
E --> G[Codex turn]
F --> G
G --> H[Permitted file read]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +333, Tests +594, Docs +38. Total +965 across 23 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one host-owned attachment preparation path, with Codex consuming verified local paths only under current placement and read authority while canonical user content remains unchanged. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source lacks local path delivery, and the captured before run shows a 154,500-byte upload reduced to an inline preview followed by FileNotFoundError when Codex tried its media reference as a path. I did not execute the repository. Is this the best way to solve the issue? Yes. The branch extends the existing workspace attachment owner and admits local paths only after Codex confirms placement and the host resolves read policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a5f1d0996a1f. LabelsLabel changes: No label 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)
|
Codex retains the admitted path note in native conversation history while OpenClaw preserves canonical user text and media references. Later turns continue to use current execution and tool-policy admission. Merge current main to include the Workshop fixture clock repair and the maintenance-task publication ordering repair. A live known-path follow-up could not dispatch a file command under the restricted tool policy, then read the same saved document after the inherited policy was restored.
…udget Omit optional saved-document path notes when their complete metadata cannot fit, after the same final live-authority check. Revalidate the allowance against all final text outside projected history after inbound context and prompt hooks run, preserving canonical input and inline attachment context. Repair the existing projection fitter to reserve fitting current prefixes alongside the request and hook tail before history, including exact-limit input. Preserve its existing priority when current text alone exceeds the limit. Registered native controls reproduce prefix loss with and without attachment metadata; overflow siblings retain their original behavior.
JSON-escape mention sigils in optional attachment metadata so Codex does not interpret filenames as skill or plugin requests. Preserve exact decoded file identities and explicit mentions in the user's prompt. Cover initial and steering preparation through the registered owner. Merge current main including adf4aff from #156801. The prior CI run reproduced settlement cleanup hangs when fake timers discarded the native coordinator backoff; it was canceled after the failures were captured. The owning repair keeps native storage waits independent of caller timers.
|
Merged via squash.
|
openclaw#156758) * fix(codex): expose saved input documents to eligible local tools Media references identify canonical attachments but are not filesystem paths. Bind original input media to the host capability and let the actual Codex connection prepare verified document paths only for eligible local execution. Keep remote staging, read policy, workspace restrictions, live authority, and native input budgets with their existing owners. Execution notes do not alter canonical user messages or persisted media references. Cover registered delivery, native initial input and steering, remote placement, policy exclusions, changed workspace authority, and bounded metadata. Reuse the existing steering persistence cases to verify original SQLite transcript text. Release note: Codex can process complete saved document uploads with local file tools even when their inline text preview is truncated. * fix(codex): preserve current input when attachment metadata exceeds budget Omit optional saved-document path notes when their complete metadata cannot fit, after the same final live-authority check. Revalidate the allowance against all final text outside projected history after inbound context and prompt hooks run, preserving canonical input and inline attachment context. Repair the existing projection fitter to reserve fitting current prefixes alongside the request and hook tail before history, including exact-limit input. Preserve its existing priority when current text alone exceeds the limit. Registered native controls reproduce prefix loss with and without attachment metadata; overflow siblings retain their original behavior.
What Problem This Solves
Fixes: Codex cannot process a complete uploaded document when its inline preview is truncated and the available file tools receive only a
media://reference.User Impact
User impact: Codex can read the complete saved document with local file tools when the current execution placement and existing read policy permit it. Remote execution, sandboxing, workspace-only access, and disabled tools retain their existing restrictions. No configuration or migration is required.
Why This Change Was Made
A stored media reference identifies an attachment; it is not a filesystem path. The existing workspace attachment owner now supplies a bounded, verified path note after the Codex connection confirms local execution. The same owner continues to handle remote staging, with no local fallback when a remote binding exists.
The optional harness capability captures the original attachment facts before image projection and reuses the prepared read policy, including allowlist intersections. It verifies document eligibility with a bounded header read and checks current authority after awaited work. The note is included in initial and steering native input, while canonical user content, media references, and persisted transcript bytes remain unchanged. Codex retains this admitted input in its native conversation history. A path identifies the saved file; it does not replace the existing execution and tool-policy admission on later turns. Path metadata uses the turn input budget independently of the inline extraction cap; the regression exercises the schema-valid one-character extraction limit. If the complete optional note cannot fit, the owner returns no note and preserves the existing request and inline attachment context instead of aborting the turn.
Evidence
The real Control UI rerun passed on source-bound candidate
6d4c0ba6428c1293f669db99b0694b6fa2f657ce, which contains the original attachment-path implementation plus independently reviewed changes, before the budget-edge follow-up below. Using the identical original 154,500-byte CSV and prompt, nativeawkread the provided saved attachment path and completed with exit 0: 5,000 rows, quantity sum 2,492,302, first itemitem-3f216f8f586d16bb-雪, last itemitem-9cdf93ccc427fdf3-雪. The run used no directory search, write, network request, or delegation. The full original bytes were preserved (SHA256a7a25fea3af22c61b4c5f1b74f6e0d27f8c1a37e124c092fd6e3449b8b530b2c), and the filesystem path did not enter the canonical user transcript.The same candidate's full
pnpm buildpassed in 310.958 seconds on Node 24.20.0 / pnpm 12.4.2 with verified source and artifact bindings. Its separate strict performance check still fails only the inherited isolated Mermaid gzip budget: 1,593,188 bytes against 983,040 bytes. This is retained as a known unrelated performance failure; no threshold was changed. The original hosted CI run failed in two inherited fixtures. The Skill Workshop fixture mixed a fixed historicalDatewith a real worker lease clock, overflowing Node’s timer; main now contains its repair (764c9331). A deferred-tool fixture repair is also on main (c947420a323). This branch incorporates both main fixes instead of rerunning the unchanged failed head. The refreshed5fbc81CI run cleared both previously failing owner shards and ultimately reported success. Its extension bundle 18 nevertheless logged seven 180-second settlement-hook failures before the existing no-output watchdog automatically retried the configuration. That replay passed; the job took 30 minutes 54 seconds. The original failures are retained as a shared fixture defect, and the passing automatic replay is not claimed as a repair. No manual retry was issued. The repaireddf52f7run reproduced the same shared hook defect in bundle 18: four hooks waited 180 seconds, including held assistant-start and partial-reply callbacks. That run was canceled after preserving the live and terminal evidence, before the inherited automatic retry. No retry of unchanged code was requested.The branch now incorporates main's owning repair
adf4aff7c876from #156801. A native coordinator backoff used a global timer that a caller's fake-timer reset could discard, leaving maintenance holding the archive queue. The acquisition owner now sleeps with nativenode:timers/promises, preserving its abort behavior; its unit fixture explicitly keeps virtual-time testing. Current-head CI run 35938381891 passed with this owning fix incorporated; the canceled run is not presented as passing evidence.A same-conversation permission follow-up used the real UI to disable all 72 listed tools, then explicitly supplied the already known synthetic attachment path. The model attempted a fresh
exec_commandread; the current tool surface rejected it as unavailable before command execution. An inode monitor, validated by a positive read control immediately before the turn, recorded zero file opens or reads through completion. The first restricted turn rotated the saved native binding and preserved the original native-history bytes. Its existing host-side history projection read the attachment before the native turn began; this proof does not claim that disabling model tools forbids ordinary attachment-history preparation or creates an OS filesystem sandbox. After restoring the inherited tool policy through the UI, another fresh command read the same exact file and exited 0 with 5,000 rows and sum 2,492,302. This allow → deny → restore sequence ran on the same source-bound composed candidate described above, not on a new build of the refreshed PR head.After merging current main, the unchanged attachment implementation passed a fresh 166-test replay across six files in 108.562 seconds on Node 24.20.0 / Vitest 5.0.1. This covers the registered host boundary, local and remote workspace access, native initial input, confirmed execution placement, and SQLite steering. A fresh independent managed review of the merged candidate and clarified docs found no actionable P0–P2 findings. Production type graphs passed in 40.750 s (core) and 47.158 s (extensions); selected test graphs passed in 152.590 s (core) and 92.529 s (extensions). Targeted typed lint passed in 19.706 s and 93.321 s, with the latter including the plugin SDK declaration build. Formatting passed on all 21 changed files. The staged candidate passed the unchanged line-cap, max-lines, and assertion-safety ratchets in 0.269 s, 7.214 s, and 7.543 s. A pre-commit invocation initially compared the uncommitted merge against the older fork point and flagged two unchanged main files; the supported staged comparison used the actual merged base, with no source or baseline changes.
A subsequent review of
5fbc81found one actionable budget edge: an optional path note could abort a valid near-limit initial or steering request. Auto-merge was canceled before repair. The local attachment owner now omits an over-budget note after its final live-authority check; the existing callers retain their admitted text. Three registered-harness cases (zero budget, metadata overflow, and complete-wrapper overhead) failed at the original throw before the fix. After the fix, the registered host, native initial-input, and SQLite steering suites passed 34 tests in 61.721 seconds on Node 24.20.0. A fresh independent managed review of the unified staged candidate found no actionable P0–P2 findings. The three budget cases each took approximately 80 ms; the 16-case registered suite took 27.32 s including compilation/import and about 1.4 s of test execution. The prior real-provider run proves ordinary complete-file delivery and permission denial/restoration; the new budget edge is covered by registered-boundary proof, not a new real-provider run. A composed-candidate review then identified loss of current inbound and hook context when optional metadata reduced the final prompt budget. Admission now accounts for all final text outside explicit projected history. The registered native input matrix covers inbound context, hook prefixes, hook tails, and combined prefix/tail/history with and without optional paths.This also exposed an existing fitter defect independent of attachments: with an appended hook tail, history consumed the remaining budget before the current prefix even when all current text fit. The existing fitter now reserves the fitting current prefix before history and handles the exact-limit boundary without dropping it. When current text alone exceeds the limit, the original request/tail and history priority is unchanged. Registered no-note and with-note cases failed before repair; the owner table separately failed fitting and exact-limit cases while both original overflow controls passed. The repaired native-input and full projection-fitter suites passed 86 tests in 22.388 seconds on Node 24.20.0 / Vitest 5.0.1. The registered context-engine sibling suite also passed 43 tests in 48.944 seconds after the fitter repair. The 16 native budget cells took 118–208 ms each; the six fitter priority cells took 1 ms each. The retained mandatory-overflow behavior follows the earlier owner changes
88ad407be23(appended context priority) and7e80bb8abf2(newest history over oversized duplicated prefixes). This budget follow-up is proven through the actual native request boundary with a test app-server, not a new real-provider run. A fresh independent managed review of the complete staged candidate, supplied with both full prompt/fitter owner contracts, found no actionable P0–P2 findings. The unchanged core budget follow-up passed production types in 40.224 s, the selected core test graph in 78.923 s, typed lint in 17.500 s, and docs sanity in 0.339 s. The final extension delta passed production types in 22.922 s, test types in 31.780 s, typed lint in 19.898 s, and formatting in 0.048 s. The unchanged line-cap, max-lines, and assertion-safety ratchets passed in 0.411 s, 7.885 s, and 8.198 s; the staged diff check passed. Every proof receipt verified unchanged source throughout execution.The final integration review also caught a filename edge: Codex scans raw native input for skill and plugin mentions, even inside JSON metadata. An uploaded filename such as
report $deploy.csvcould therefore request a skill accidentally. The existing attachment owner now JSON-escapes$and@, preserving the exact decoded filename, media reference, and local path. User-authored mentions stay unchanged. The registered initial and steering regressions both failed before repair; the repaired registered host, native input, and SQLite steering suites passed 52 tests in 99.402 seconds, with the two new cases taking 96 ms and 78 ms. A compiled probe against the exact Codex mention-parser source independently confirmed that plain and linked metadata mentions are suppressed while an explicit user mention still works. This is registered preparation and delivery proof plus dependency-parser proof, not a new real-provider run. A fresh managed review of the full merged 23-file candidate found no actionable P0–P2 findings. Final core production types passed in 50.011 s; selected test types in 88.828 s (40.4 s for the selected graph); typed lint in 18.107 s; docs sanity in 0.324 s; formatting in 0.251 s. The unchanged line-cap, max-lines, and assertion-safety ratchets passed in 0.263 s, 7.326 s, and 7.696 s. All receipts verified unchanged source.The original browser run stored the full document correctly, but delivered only 2,075 complete rows and part of the next row inline. Native Python attempted to open the
media://reference and receivedFileNotFoundError; the model correctly reported that it could not verify the full file.Local proof on Node 26.7.0 / Vitest 5.0.1 covers the registered harness delivery boundary, native initial input, local and remote steering, current-authority changes during preparation, policy exclusions, native-image projection, MIME rejection, hardlinks, and metadata bounds. Existing SQLite steering tests retain their original canonical-content assertions and additionally verify that execution input receives the attachment note. The final connection/steering replay passed all 71 tests in 26.840 seconds. The final source also passed production and test type graphs, typed lint, formatting, unchanged ratchets, and docs checks. An independent managed review reported no actionable P0–P2 findings.
Final per-file test costs
All six changed suites passed individually with
pnpm test <file> --maxWorkers=1on the final49cc9387d86source (Node 24.20.0, pnpm 12.4.2, Vitest 5.0.1). Local wall time includes the wrapper, preparation, imports, and tests. CI seconds below sum the actual per-case durations reported for that file in the successful current-head CI run; they are not whole-job wall times, and exclude shared job setup/import overhead. The CI jobs also run other suites. No CI retries were requested for these measurements.extensions/codex/src/app-server/context-engine-projection.test.tsextensions/codex/src/app-server/run-attempt-connection.test.tsextensions/codex/src/app-server/run-attempt.input-attachments.test.tsextensions/codex/src/app-server/run-attempt.steering.test.tssrc/agents/harness/selection.input-attachments.test.tssrc/agents/workspace-access.test.tsMeasured validation costs and retained failures
The timings below are actual repository-wrapper wall times or explicitly labeled Vitest project times, using
--maxWorkers=1for measured test runs. Final single-file wall timings and current-head CI test seconds are recorded above. These local test timings are separate from the full build and real-provider proof above.The passing matcher, host/registered, and initial-native projects above came from a 63.772-second batch that exited unsuccessfully because three new native fixtures were incomplete. That batch is not presented as wholly green. Its production files match the final commit; the corrected native fixtures were covered by the final 71-test replay.
Failures encountered and retained:
An unchanged approval-timeout sibling passed but took 5.955 seconds; its separate profiling investigation is not a fix claimed by this PR. Silent inline truncation labeling is also separate work; this change restores permitted access to the complete saved document.