fix(server): tell agents to write image revisions to new file names #13942
main fromrefs/pull/13942/head·opened View on GitHubNote
🤖 Opus 5.5 on behalf of Oliver
Important
Prompt-only mitigation. The durable fix, which copies each message's images when it completes, is #14009 (targets t3code/codex-turn-mapping); the two are independent and can merge in either order.
Explain Like I'm Lost#
Agents show screenshots in chat by writing Markdown image links to absolute file paths. T3 caches each image by its path, so if an agent overwrites the same file, the chat keeps showing the old image. This change tells agents to save each new version under a new file name.
Problem#
When an agent iterates on UI, it often overwrites /tmp/screenshot.png and links it again. The client caches the signed asset URL per path (up to an hour), and the browser caches the response (max-age=3600), so the new message shows the old image. Busting the cache would not fully fix this, because paths are live references: earlier messages would switch to the latest file and the before/after history would be lost.
Fix#
Add one sentence to the shared runtime instructions every provider receives: "Write each image revision to a new file name; reused paths show the old cached image." That adds about 15 words (~7%) to the runtime instructions.
Opus 5.5 via Claude Code in T3 Code
Summary by CodeRabbit#
- Bug Fixes
- Image revisions are now saved under new filenames so updated images display correctly instead of showing cached versions.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
80a91c71-8ee3-4412-9c5d-4b9a4bebfaf8📥 Commits
Reviewing files that changed from the base of the PR and between a727d1d97690c9bb12cee5760e91cfd1aa7c017d and 97a76b4e0e3719b4b6367c34d28cd1ff9a9d5d4f.
📒 Files selected for processing (1)
apps/server/src/provider/RuntimeInstructions.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough#
The runtime instruction now tells the model to use a new file path for each image revision because reused paths display the cached image.
Changes#
Image Revision Paths
Layer / File(s) Summary Image revision guidance
apps/server/src/provider/RuntimeInstructions.tsThe runtime instruction tells the model to save each image revision under a new file path. It notes that reused paths display the old cached image. Priority: ⬇️ Low
Estimated code review effort: 1 (Trivial) | ~3 minutes
Change: Bug fix
Suggested reviewers:
juliusmarmingeMerge Risk: ⚪ Minimal · up to
97a76This change asks agents to save revised images under new paths to avoid stale cached displays. No concrete regression is indicated; the PR is mergeable subject to normal checks.
Security Architecture Review#
Security architecture risk: 🔵 Low · up to
97a76Using new filenames can preserve earlier images instead of replacing them. No access-control change was found, but the available evidence does not establish when older files are removed.
Retained concerns No architecture-level concerns identified.
Security review details
Security Blast Radius
- inferred — The changed text can influence image files produced by agents receiving the shared instruction, but the formatter itself performs no file operation or authorization decision.
Trust Boundaries and Controls
- observed — In the checked Codex consumer, actual tool availability still determines whether tool instructions are supplied; the new filename guidance is carried in application context, not in that availability decision.
Hardening Proposals
- proposed — Confirm that distinct image revisions remain subject to the existing file-access controls and have a defined cleanup path after repeated or interrupted work.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
Check name Status Explanation Resolution Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold. ✅ Passed checks (4 passed)
Check name Status Explanation Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. Title check ✅ Passed The title clearly and concisely describes the main change: instructing agents to use new file names for image revisions. Description check ✅ Passed The description clearly explains what changed, the caching problem, and the reason for the fix. It does not include the template's checklist or an explicit UI Changes section, but these omissions are … - Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
Comment `@coderabbitai help` to get the list of available commands.Note
This comment is posted by Julius' dot
This changes the shared runtime prompt for every provider to require a new filename for each image revision. The stale-image report is useful, but neither this PR nor #14009 records maintainer approval of that global agent behavior, as required by prior approval. Please agree on the prompt mitigation and its scope with maintainers, link that decision and verification results, then request reconsideration.
juliusmarminge closed this
Sign in to join this conversation.
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — This one-line change updates the shared default runtime prompt for every provider, altering how agents create image revisions on existing request paths. Although the change is narrowly scoped and its effect is clear, modifying a product default warrants human review.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).