Skip to content

feat: deliver Codex images and preserve upload originals - #3669

Open
alex-furman wants to merge 12 commits into
Abilityai:devfrom
alex-furman:codex/codex-images-20261013
Open

alex-furman wants to merge 12 commits into
Abilityai:devfrom
alex-furman:codex/codex-images-20261013

Conversation

@alex-furman

@alex-furman alex-furman commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3870. Implements the scope accepted in discussion #3668.

Codex-backed agents currently discard uploaded images, and accepted raster uploads have no workspace original. This change delivers JPEG/PNG/GIF/WebP through native CLI image arguments on initial and resumed turns and saves accepted originals through the existing upload interface.

Native image inputs keep the existing limits: at most ten images, 5 MiB each and 10 MiB total. Random private directories and mode-0600 files belong to the actual subprocess. Cancelling its HTTP waiter does not remove inputs still in use. Upstream reader/handoff ownership and stdin/endpoint protections are retained. An optional registry exit callback releases resources only after child exit is observed, including failed handoff and unconfirmed termination; no separate reaper is added.

Workspace originals use opaque per-dispatch directories, existing upload limits and audit attribution. Concurrent uploads in the same session cannot remove each other's files. If original storage fails, usable native vision still reaches the runtime and the prompt/audit explicitly report that the original is unavailable. New uploads are excluded by default from Git, including existing repositories before their next backend Push; deliberate user gitignore overrides retain their established precedence.

Retention follows existing channel behavior: web/session/public originals remain workspace-owned until explicit removal; successful messaging executions clean up their dispatch. Failed, cancelled or uncertain messaging outcomes retain originals with an actionable log, and require manual removal after confirming the execution stopped. This intentionally trades storage for preservation when completion is uncertain. Original-file availability grants no new public Read permission; existing authorization still controls tool access. No new endpoint, file type or credential path is introduced.

Current integration: a406143a6043418be218a9508431f421df2e83eb, based on official dev c8f67cb857086a31f69d1dcc65d360bd94399ba1.

Validation:

  • Runtime/registry ownership batch: 265 passed; combined upload/channel/Git/template batch: 371 passed; final uploader-attribution batch: 135 passed; endpoint-policy batch: 122 passed. These batches overlap and are not a unique full-suite count. Test-placement and module-isolation lints pass.
  • Fail-before regressions cover original storage, vision despite write failure, Git preparation, uncertain messaging retention, callback/termination ownership, reused execution IDs and missing uploader attribution. Real child-process tests cover running/queued/rejected readers and refused termination.
  • An isolated Docker workflow exercises the actual upload service and wrappers, original-byte readback, valid/rejected mixed files, concurrent same-session dispatches, real Git staging, audit attribution and sibling-safe cleanup.
  • Actual pinned Codex CLI 0.147.0 accepts synthetic PNG/JPEG/GIF/WebP on initial and resumed turns using the candidate command builder and unchanged endpoint pins. An isolated local TLS fixture observes four fresh images on each turn (plus prior images on resume); no real provider or credentials are used.
  • Independent review covers the complete 29-file contribution and reuses verified unchanged receipts. An additional real linked-worktree Git probe confirms default exclusion and deliberate override behavior. No unresolved findings remain.
  • Full upstream CI on this exact head passed, including the full regression comparison: 23 successful checks, five skipped, none pending or failed (November 2).

Limits: the CLI fixture proves decoding/request formation, not live model interpretation; its transport falls back from unsupported WebSocket to HTTPS. Uncertain originals have manual retention, not automatic reconciliation. These checks do not establish production deployment or full live-user workflow acceptance.

Journey Impact: none: native image attachments are not represented in the current journey catalog.

Mutation: current-stock image delivery still fails its characterization checks. Added lifecycle/storage/attribution regressions failed before their corresponding corrections and pass afterward; the separate runtime and Docker proofs exercise the real interfaces with synthetic inputs.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

✅ Nightly unit-suite clean when this PR is merged into dev, all 3 seeds (head_sha: d5fe7317041e41bea8c85b121acf56975649cb04).

@alex-furman
alex-furman marked this pull request as ready for review October 15, 2026 03:45
@vybe

vybe commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

merge-train: held back from today's train. Thanks for this; the code is careful, the security checks found nothing, and the tests execute the real paths. It needs a maintainer decision before it can land:

  • No tracking issue or accepted proposal yet. Discussion Native Codex image input with preserved workspace originals #3668 has no maintainer response. Once a scoped issue exists, add Fixes #N here.
  • Images now land in the agent's git repo. upload_service.py:152 writes every image to /home/developer/uploads/<uuid>/, which sits inside the repo root. uploads/ is not in the default ignore list (git_service/gitignore.py), so auto-sync can commit them. That includes images from anonymous public-link visitors. Web, session and public chats never clean them up. Adding uploads/ to the default ignore list would close most of this.
  • Uploads kept forever on unknown outcomes (message_router.py:351, :669): nothing reaps them, and the warning names neither the directory nor the execution.
  • Saving the original now gates vision for every runtime, Claude included (upload_service.py:331-342): an image-only message now fails when the container write fails. Before, images worked without any disk write.
  • Codex now kills its process group on any task cancellation (codex_runtime.py:1417). Claude's headless path lets the process finish instead, so the two runtimes now behave differently.

@vybe vybe added the status-needs-fix PR has an unaddressed review/validation finding; cleared by the author's next push (#2815) label Oct 17, 2026
@alex-furman alex-furman changed the title feat: native Codex images with preserved upload originals feat: deliver native images to Codex executions Oct 18, 2026
@alex-furman

Copy link
Copy Markdown
Contributor Author

@vybe Narrowed this to native Codex image delivery in 0a8708696, with validation documentation clarified in d5fe73170.

The shared original-file persistence, channel retention changes and added Read grant are removed, so this PR no longer adds images to the workspace repo or makes shared vision depend on saving originals. Temporary native image inputs belong to the subprocess reader until it finishes; HTTP cancellation does not introduce process-group termination. Rejected reader submission/startup stops the child before releasing its inputs.

204 runtime tests pass. An independent probe also used the pinned, unmodified Codex 0.147.0 with synthetic PNG/JPEG/GIF/WebP inputs and a local fake provider: initial and resumed turns each attach four fresh images. This does not establish live model interpretation.

Proposal acceptance in #3668 and a scoped tracking issue remain outstanding; I have not treated the revisions as clearing that gate. Please review whether this narrower native-image scope is acceptable, and re-review the implementation.

@alex-furman

Copy link
Copy Markdown
Contributor Author

@vybe Following up on the narrowed native Codex image proposal. We integrated current dev in 2e373af8d, preserved its stdin-based prompt handling, and verified initial and resumed image delivery with the pinned CLI against a local fake endpoint. Independent re-review and 210 runtime tests pass, as does the current regression comparison.

Is this narrow capability something you would accept upstream? If so, could you point us to the appropriate reviewer and scoped issue for discussion #3668? Shared original-file storage and retention remain outside this PR, and the CLI fixture does not establish live model interpretation. We would appreciate a direction before further integration work.

@alex-furman alex-furman changed the title feat: deliver native images to Codex executions feat: deliver Codex images and preserve upload originals Nov 2, 2026
@vybe

vybe commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

merge-train (2026-11-04): this is the direction you asked for on 10-27. The scope is accepted through discussion #3668 and tracked in #3870, so the proposal itself is fine. This train did not validate the code.

The next step is on your side: this head conflicts with dev in docker/base-image/agent_server/services/codex_runtime.py. Please merge dev and comment here. A fork push cannot clear status-needs-fix, so it will be lifted by hand and the PR will go through full validation on the next train. That review will re-check the 10-17 finding that uploads could land in the agent's git repo, since the current head brings workspace originals back into scope.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status-needs-fix PR has an unaddressed review/validation finding; cleared by the author's next push (#2815)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants