Repository navigation
fix: preserve reply context in embedded prompts - #76659
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. at source level. Current main renders Next step before merge Security Review detailsBest possible solution: Land this PR after maintainer review and completed CI, preserving reply context as explicit current-turn prompt data while keeping internal runtime context hidden and image loading scoped to the visible prompt. Do we have a high-confidence way to reproduce the issue? Yes, at source level. Current main renders Is this the best way to solve the issue? Yes. The PR uses a narrow typed current-turn context seam instead of reintroducing arbitrary runtime context into the submitted user prompt, and the follow-up keeps prompt-local image detection on the clean prompt. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against d35c79edd63b. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 173a67bf04
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -2737,7 +2742,7 @@ export async function runEmbeddedAttempt( | |||
| // Detect and load images referenced in the visible prompt for vision-capable models. | |||
| // Images are prompt-local only (pi-like behavior). | |||
| const imageResult = await detectAndLoadPromptImages({ | |||
| prompt: promptSubmission.prompt, | |||
| prompt: promptForModel, | |||
There was a problem hiding this comment.
Exclude reply-context suffix from image reference scanning
Using promptForModel here makes the image detector parse the appended "Replied message" JSON block as if it were user instructions. Because detectImageReferences matches paths inside quoted strings (e.g. "./foo.png") and [media attached: ...] tokens, a quoted/replied message can trigger local file or media-uri loading and silently attach images to the model call. This only happens on vision-capable models, but in those runs it can leak workspace/local media and change model inputs unexpectedly; scan only the actual user prompt body when resolving image refs.
Useful? React with 👍 / 👎.
173a67b to
05520f8
Compare
05520f8 to
0659d77
Compare
0659d77 to
2317666
Compare
Summary
Fixes #76419.
Tests
pnpm buildpnpm vitest run src/auto-reply/reply/get-reply-run.media-only.test.ts --testNamePattern "threads reply context"pnpm vitest run src/agents/pi-embedded-runner/run/runtime-context-prompt.test.ts --testNamePattern "formats explicit reply context|omits empty explicit reply context"