Repository navigation
Deliver native Codex generated images - #762
sol-kami-bot wants to merge 3 commits into
Conversation
|
|
AI review gate — Cursor Bugbot found issues
Unresolved findings (2): What to do:
Re-run the gate with “Re-run jobs” after an approval or a finished review. A push re-runs it automatically. |
|
Nerve PR review · ✅ Ready to merge Updated for 521ae72: this "merge upstream main" commit also adds about 570 lines of new work beyond the conflict fixes (
Inline Codex images still become normal Completeness: tests cover the topic and connection races, symlinked workspaces and excluded paths; docs updated; no config or migration needed. Worth considering:
Checked: full suite in an offline sandbox at |
This actually seems like it might happen and be quite annoying, is there a good way to inform the agent that the image went out and not to use send_file? (Or maybe a codex-specific instruction in the system prompt?) |
|
@alex-clickhouse I added a Codex-only developer instruction in c98b35f. It tells Codex that Nerve handles inline generated images and to avoid copying or resending the same image by default. The instruction describes automatic channel delivery as best-effort, so Codex should not report delivery as confirmed. On the durable result question from @nerveai, this change handles inline results. For a file-ID-only result, explicit delivery remains available if the runtime already has a verified workspace file it is allowed to share. Nerve does not fetch the ID or interpret it as a path. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
Reviewed by Cursor Bugbot for commit 521ae72. Configure here.
| except subprocess.TimeoutExpired: | ||
| raise ValueError("Could not verify Git exclusion for generated image") from None | ||
| if result.returncode != 0: | ||
| raise ValueError("Generated image path must be ignored and untracked by Git") |
There was a problem hiding this comment.
Ancestor git repos block image saves
High Severity
_verify_git_exclusion runs git check-ignore for every ancestor that contains .git and aborts the save on any non-zero exit. After the nearest worktree already ignores the image, a higher repository (a project repo or a home dotfiles repo) still vetoes the write even though it does not track files inside the inner worktree. The import then fails and the image is never stored or delivered.
Reviewed by Cursor Bugbot for commit 521ae72. Configure here.
| await self._web.files_upload_v2( | ||
| channel=channel_id, | ||
| file=str(path), | ||
| file=str(path) if content is None else content, |
There was a problem hiding this comment.
Slack uploads reject in-memory bytes
Medium Severity
Generated-image delivery calls Slack files_upload_v2 with the validated content bytes as file. That parameter is a filesystem path or a file object, not raw bytes, so the client raises and the handler returns False. The image stays in the workspace, but it is not posted to Slack.
Reviewed by Cursor Bugbot for commit 521ae72. Configure here.


Codex app-server emits a native completed image item when a generated image is available. Nerve currently drops the image unless the assistant explicitly sends the resulting file itself.
Normalize the completed inline image event, import it as a workspace artifact, and reuse the existing active-channel file delivery path. Record the outcome on the tool card and deduplicate repeated completion events within a turn. Leave file references and unsupported payloads to the existing explicit file flow.
Note
Medium Risk
Changes file delivery, workspace write policy, and per-turn channel routing (hosted connections and Telegram topics), though bounded inline data and git/path checks limit exposure.
Overview
Adds automatic delivery for native Codex
imageGenerationresults when the runtime returns bounded inline PNG/JPEG/WebP bytes. The Codex backend maps completion items to a newGeneratedImageagent event (notsavedPath/fileId), and backend notes steer the model away from duplicating delivery withsend_file.The engine validates and saves images via
store_generated_imageunderoutput/generated-images/(hashed paths, git exclusion checks, symlink-safe writes), surfaces them as ordinarysend_filecards in web history, dedupes repeat completions per turn, and async-uploads validated bytes to the originating channel whenpost_answerandSEND_FILESapply—without blocking the Codex turn on slow uploads.Channel/router work binds reply destinations per inbound turn (hosted
connection_id, Telegram forummessage_thread_id), supports optional in-memorycontentonsend_file, and splits batched messages by actor and destination so attachments stay with the right chat/topic.files.excludeis centralized innerve.utils.workspace_pathsand applied consistently to downloads, generated-image cards, and explicitsend_fileresults; the web UI shows a text-only status when download is blocked but channel send may still succeed.Config-repo
.gitignoredocuments the new runtime output directory; extensive tests cover protocol mapping, storage hardening, engine/upload lifecycle, and routing edge cases.Reviewed by Cursor Bugbot for commit 521ae72. Bugbot is set up for automated code reviews on this repo. Configure here.