Repository navigation
fix(ai-chat): preserve image uploads with compaction - #288
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5927787c72
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Problem
Enabling chat compaction rejects image attachments in both public and database-persisted chats. Removing that rejection alone would leave the text summarizer unable to see older images and count inline image bytes as text tokens.
Solution
Keep recent image attachments in the model context. When older turns are compacted, summarize their text and then pass each image as vision input to incorporate its contents into the summary. Preserve original messages and attachments, and only advance the checkpoint after the entire summary succeeds.
Estimate images separately from encoded bytes, with a default allowance of 4096 tokens per image and an optional
imageTokenEstimatefor models with higher image costs. Existing attachment validation and authorization still apply. Non-image files remain unsupported with compaction. Document the behavior and prepare Stack/Codegen 4.5.1.Public browser composers now use an explicitly configured upload handler, matching the public API. Saved-chat attachment permission checks and upload-endpoint authentication remain intact. The generated demos cover selecting and sending an inline image with compaction enabled.
Follow-up to #287 based on consumer verification and the requested image-support parity.
Verification
pnpm typecheck,pnpm lint,pnpm build, registry regeneration, and documentation production build passed.