Repository navigation
fix(feedback): send text-only report when screenshots exceed the upload limit - #22508
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughFeedback image attachments now have a 4 MiB per-image and combined size limit, enforced in the renderer and main process. The renderer accounts for committed and in-flight image reads. When the server rejects an image submission with HTTP 413, the main process retries the feedback without images. The dialog stores feedback text and the anonymous-submission choice across unmounts, and clears them after successful submission. Priority: ➖ Normal Estimated code review effort: 4 (Complex) — 45 minutes Severity of issue fixed: Medium Merge Risk: 🔵 Low · up to Some users whose screenshots were rejected for another reason will be told they were too large. This is a bounded messaging issue and does not block merging. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to A submission can finish after the feedback dialog is removed, leaving already-sent text in the draft. Reopening the dialog could show that text as unsent and allow it to be sent again. The issue is limited to feedback in the current app session; the new image limits and submission checks remain in place. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 22 files. (1 skipped: 1 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: bc2beef8-b0d5-4fad-9d3a-c51181c6f434
📥 Commits
Reviewing files that changed from the base of the PR and between dac82f6 and 2f3dbf0cffd1d8d43f663fcec51118bcfd17f37c.
📒 Files selected for processing (13)
src/main/ipc/feedback-image-attachments.test.tssrc/main/ipc/feedback-image-attachments.tssrc/main/ipc/feedback-request.tssrc/main/ipc/feedback.test.tssrc/main/ipc/feedback.tssrc/preload/api/crash-report-api.tssrc/preload/api/feedback-bridge.tssrc/renderer/src/components/sidebar/SidebarFeedbackDialog.test.tsxsrc/renderer/src/components/sidebar/SidebarFeedbackDialog.tsxsrc/renderer/src/components/sidebar/use-sidebar-feedback-images.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/feedback-image-attachments.test.tssrc/renderer/src/lib/feedback-image-attachments.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
ℹ️ No critical issues — one edge case inline, plus a nitpick.
Reviewed changes
- Total attachment budget (4 MiB):
readFeedbackImageFilesnow takesexistingBytesand rejects any file that would push the set overMAX_FEEDBACK_IMAGE_TOTAL_BYTES;validateFeedbackImagesenforces the same total at the IPC boundary.MAX_FEEDBACK_IMAGE_BYTESdrops 8 MiB → 4 MiB and is now an alias of the total. - Payload-rejection fallback: when the multipart image upload returns 400/403/408/413/415/422,
submitFeedbackWithImagesresends the report through the existing text-only JSON path and returns{ ok: true, imagesDelivered: false, imagesFailure }. 5xx, network errors, and timeouts still fail without shedding images. - Dialog messaging: a new
imagesRejectedwarning toast distinguishes "sent without your screenshots" from the existing "image delivery could not be confirmed". - Refactor:
postFeedback, the multipart body builder, and the failure helpers moved unchanged tofeedback-request.ts;feedback.tskeeps orchestration and stays under the max-lines gate. Preload types gain optionalimagesFailure.
I verified the focused suites locally (pnpm test on the four changed test files): 101 tests pass.
ℹ️ Nitpicks
hasAttachableFeedbackImagestill keys only off count and per-file size. When the byte budget is full but fewer than 4 images are attached, a pasted supported image makes it returntrue, so the paste is consumed and any text riding along on the clipboard is dropped — even though the read then rejects the image with the total-size toast. The existing comment on that predicate says the intent is to avoid silently eating co-pasted text, so passing remaining bytes through would keep the check honest.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the delta since the prior pullfrog review (2f3dbf0) — commit e7e1994, which closes the stale byte-count race flagged last run.
- Live draft reservations:
handleAddFilesnow derives bothexistingCountandexistingBytesfromliveImageDraftsRef.current, which is updated synchronously when a read resolves, instead of from renderedimagesstate. A batch that resolved but has not yet re-rendered therefore still counts against the 4 MiB budget, and theimageCount/imageBytesvalues and their dependency-array entries are gone. - Regression test: the new
use-sidebar-feedback-images.test.tsxasserts the just-read batch is counted when a second add lands before React commits the first — it pins the pre-commit window (imagesstill empty) and then checksreadFeedbackImageFilesis called with([second], 1, firstBytes).
Prior inline thread 4085330206 is resolved by this commit.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…ad limit Fall back to the text-only JSON request when the image upload is rejected for its payload (413 and the existing attachment retry statuses), and cap image attachments at 4 MiB in total in both the renderer and main-process validators. The HTTP request plumbing moves to feedback-request.ts to keep feedback.ts under the line limit. Fixes stablyai#22466
The add handler read the attached image count and bytes from rendered state, but a finished read moves its batch from the pending refs into liveImageDraftsRef before React re-renders. An add in that gap undercounted both, which could exceed the 4 MiB budget and fail the submit in main. Read both from the live draft ref plus pending reservations instead.
Merge pendingImageReadsRef and pendingImageReadBytesRef into one ref
with { count, bytes } fields, since these values are always modified
together and represent a single concern.
e7e1994 to
6019b4b
Compare
…uest.ts The fetch-mentioning comment moved with postFeedback into the new module; both the add and the stale-entry removal are required for the audit to pass.
…ce in shared The count/per-image/total caps were declared independently in the main and renderer modules that must agree with each other and with the endpoint host's request-body limit, and the submit result shape was hand-copied into two preload files. Nothing enforced either pairing, so a one-sided edit was a silent 413 regression. Adds a test pinning the total budget below Vercel's 4.5 MB FUNCTION_PAYLOAD_TOO_LARGE threshold, which is the invariant that actually fixes orca#22466 - the exact value is not.
The 4 MiB total is the binding limit long before the 4-image count is, but the paste gate and the Attach affordance both only knew the count. After one full-screen screenshot every later paste still passed the gate, called preventDefault and destroyed any co-pasted text on its way to a rejection toast, and the Attach button kept inviting picks that could only be refused. Both now read the live committed+pending byte reservation, and the hint states the total so the rule is discoverable. Also states the outcome in the images-rejected toast instead of implying the screenshots can still be recovered from a dialog that has already closed.
The Send Feedback dialog renders under SidebarSettingsHelpMenu, which the sidebar only mounts while it is open, so collapsing the sidebar discarded the typed report - the loss orca#22466 actually complains about, and one this branch's 413 fallback does not cover because 5xx, timeouts and network errors still fail without a retry. The draft text and the anonymity choice now live in the existing app store beside the other session-only composer drafts, and are cleared only once delivery is confirmed. Image drafts stay local: they hold object URLs the unmount cleanup has to revoke.
There was a problem hiding this comment.
ℹ️ No critical issues — minor suggestions inline.
Reviewed changes
Reviewed the delta since prior pullfrog coverage (e1c31ea) — commits 1269d854, 24ce699a, 39e09589.
- Shared limits and IPC contract:
MAX_FEEDBACK_IMAGE_*and thefeedback:submitargs/result types moved tosrc/shared/feedback-image-limits.tsandsrc/shared/feedback-submit-contract.ts, re-exported by main, preload and renderer; a new test pins the total under the host's 4.5 MB body limit. - Byte-aware attach/paste gates:
hasAttachableFeedbackImagenow takesexistingBytesand mirrorsreadFeedbackImageFiles' per-image and remaining-total limits; the hook exposesgetReservedImageCapacity()(count + bytes), the paste gate passes both, and the side panel disables Attach once the byte budget is spent and states the total in the hint. This addresses the prior-review nitpick. - Persistent feedback draft: the report and anonymous flag moved from dialog state to a session-only
feedbackDraftstore slice, so collapsing the sidebar no longer discards an unsent report; the draft clears on confirmed delivery, with tests for unmount/remount survival, retention after a refused submit, and clearing on success.
I verified the focused suites (pnpm test on the six changed/exercising files, 110 tests) and both pnpm tc:node and pnpm tc:web pass.
ℹ️ Nitpicks
SidebarFeedbackImageAttachments.screenshotsHintchanged its placeholders, and thefr/ja/zhtranslations were deleted rather than updated to{{count}}/{{maxSize}}, so those locales now fall back to English. Repo policy tolerates untranslated keys, but these were previously translated — worth re-translating or calling out as intentional.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 1de5006a-92c2-40aa-9f1a-0834765b1fa9
📒 Files selected for processing (23)
src/main/ipc/feedback-image-attachments.tssrc/main/ipc/feedback-request.tssrc/main/ipc/feedback.tssrc/preload/api/crash-report-api.tssrc/preload/api/feedback-bridge.tssrc/renderer/src/components/sidebar/SidebarFeedbackDialog.test.tsxsrc/renderer/src/components/sidebar/SidebarFeedbackDialog.tsxsrc/renderer/src/components/sidebar/SidebarFeedbackImageAttachments.tsxsrc/renderer/src/components/sidebar/use-sidebar-feedback-images.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/feedback-image-attachments.tssrc/renderer/src/store/index.tssrc/renderer/src/store/slices/feedback-draft.tssrc/renderer/src/store/slices/store-test-helpers.tssrc/renderer/src/store/types.tssrc/shared/feedback-image-limits.test.tssrc/shared/feedback-image-limits.tssrc/shared/feedback-submit-contract.ts
💤 Files with no reviewable changes (5)
- src/renderer/src/i18n/locales/fr.json
- src/renderer/src/i18n/locales/ja.json
- src/renderer/src/i18n/locales/ko.json
- src/renderer/src/i18n/locales/zh.json
- src/renderer/src/i18n/locales/es.json
🚧 Files skipped from review as they are similar to previous changes (1)
- src/renderer/src/i18n/locales/en.json
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
|
Heads up @mmarabel — @nwparker has taken this one over and pushed commits directly to your branch, so you don't need to do anything further here. Your commits are untouched; everything below is on top. Thanks for a genuinely good fix — the fallback is the right shape and I did not change it. Four commits:
Two notes on the framing rather than the code:
One thing you got right that's worth calling out: the old comment claimed the rendered image count was safer than a ref. That premise was just wrong — |
…mid-send A confirmed delivery only cleared the store draft while the dialog was still mounted, so collapsing the sidebar during the request left the sent report sitting in the store and offered it back on the next open. Clearing now runs outside the mount guard (the zustand action outlives the component) but compares the stripped user text first, so a different report typed after a remount survives the stale handler. Also splits the rejected-images toast: only 413 means the screenshots were too large, so the other shed-the-attachment statuses get neutral copy.
|
Follow-up takeover commit pushed (
Tests added for all three behaviours, each verified to fail on revert. PR body updated. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the delta since the prior pullfrog review (39e0958968) — commit 302120afdb, four files.
- Draft clear survives a collapse mid-send:
clearFeedbackDraft()moved above themountedRefguard inSidebarFeedbackDialog.tsx; it now compares the stored draft, footer-stripped and trimmed, to the submitteduserTextbefore clearing, so a confirmed delivery always clears while a report retyped after a remount survives the stale handler. - Rejected-images copy distinguishes the cause: only
413(FEEDBACK_PAYLOAD_TOO_LARGE_STATUS) now gets the "too large" toast; the other shed-the-attachment statuses (403/415/422…) get the new neutralimagesNotIncludedstring. - Tests: a draft-survival pair (clear on unmount-mid-send, retain a report typed after remount) and a
403-vs-413toast case.
The prior open thread on SidebarFeedbackDialog.tsx:203 is addressed and resolved. I ran pnpm test src/renderer/src/components/sidebar/SidebarFeedbackDialog.test.tsx — 23 tests pass.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

ELI5
If you attached a big screenshot to Send Feedback, the server refused the whole upload for being too large and your bug report vanished — not just the picture, the text you had written too.
Three things change. Orca now tells you up front how much you can attach and stops you at the limit, instead of letting you pick something that can only be refused. If the server refuses the pictures anyway, Orca sends your written report on its own and tells you the screenshots did not make it. And the report you typed is no longer thrown away when the dialog goes off screen — it is waiting for you when you come back.
What Changed
Before, as the reporter hit it: attach a 6.4 MB screenshot (the dialog happily accepts up to 8 MiB each, 4 of them), click Send, get a red "Failed to submit feedback. Please try again." Nothing was delivered — not the screenshot, not the text. Reopen the dialog and the report is gone as well.
After: the attach row reads "Attach up to 4 screenshots, 4.0 MB total". Spend that budget on one screenshot and the Attach button greys out. If the server still refuses the images, the report arrives without them and a toast says so. And the typed report survives the dialog being closed or unmounted.
Three independent defects, fixed at their origin:
The client's cap did not match the server's.
https://www.onorca.dev/v1/feedbackis a Vercel Function, and those reject request bodies over ~4.5 MB with413 FUNCTION_PAYLOAD_TOO_LARGE. The client allowed 4 × 8 MiB = 32 MiB, so a single accepted image could already be too big. The limits now live once insrc/shared/feedback-image-limits.ts(they were declared independently in a main-process module and a renderer module that had to agree with each other and with an unversioned server limit), with a test pinning the total below 4.5 MB.The image lane never shed its attachment.
submitFeedbackdeliberately did not retry an image submission, so a 413 killed the text too. The sibling diagnostic-bundle lane already did the right thing for the same status set. The image lane now reuses that same status set and the same text-only JSON request, and reportsimagesFailureup to the dialog. Images and diagnostic bundles are mutually exclusive inbuildSubmitBody, so the fallback body is always plain JSON with nothing left to trip the limit.The draft only existed inside the sidebar.
SidebarFeedbackDialogrenders underSidebarSettingsHelpMenu, which the sidebar only mounts while it is open — collapsing the sidebar unmounted the subtree and took the report with it. The draft text and the anonymity checkbox now live in the existing app store beside the other session-only composer drafts, and are cleared only once delivery is confirmed. Image drafts stay local on purpose: they hold object URLs the unmount cleanup has to revoke.Supporting changes:
preventDefault(), destroyed any text pasted alongside it, and was then rejected anyway. Both now read the live committed-plus-in-flight byte reservation.413gets "Feedback sent. Your screenshots were too large to upload and were not included."; the other statuses that shed the attachment (a corporate filter's403,415,422…) get "Feedback sent. Your screenshots could not be uploaded and were not included."postFeedbackand the request builders moved unchanged fromfeedback.tsintofeedback-request.tsto stay under the 300-line lint cap, and thefeedback:submitresult shape moved intosrc/shared/feedback-submit-contract.ts— it had been hand-copied into two preload files with nothing tying either to what main actually returns.NativeImagealready does this behind a tested seam inclipboard-image-thumbnail.ts) so a big screenshot is shrunk rather than refused.Why
useAppStore, which already owns the sidebar's state, rather than a new store — and session-only, mirroringnewIssueDraft, because a bug report is not something to leave on disk.Linked Issue
Fixes #22466
Follow-up filed: #22776 (recompress oversized screenshots instead of refusing them).
Visual Proof
Captured from a dev build on macOS over CDP, hidden window,
ORCA_BACKGROUND_LAUNCH=1. The attached PNG is exactly 4,194,304 bytes — the whole budget in one file.1. Attaching: the limit is now visible and enforced. One 4.0 MB screenshot, count still 1 of 4.
2. The draft survives. Type a report, close the dialog, collapse the sidebar, reopen it, reopen Send Feedback.
The rejected-images toasts are not shown above: reproducing either needs a real
413/403from the live endpoint, which would post junk into the team's feedback channel. They are covered by unit tests against a stubbednet.fetchinstead — see Testing.Testing
Reproduce the original bug on
main: Help → Send Feedback, type a report, attach a PNG between ~4.5 MB and 8 MiB, Send. You get a red error toast andstatus 413in the renderer console, nothing is delivered, and the report is gone if anything unmounts the sidebar.Manual, on macOS (dev build, CDP-driven, hidden window):
Not manually exercised: a live 413 from
https://www.onorca.dev/v1/feedback. The fallback was exercised only against a stubbednet.fetchin unit tests, which assert two requests, the second carrying a JSON content type and no images. Linux and Windows were not manually exercised; there is no platform-specific code in this change (byte lengths and strings only, no paths, no shortcuts).Automated tests:
{ ok: true, imagesDelivered: false, imagesFailure }, and the dialog shows the rejected-images toast.MAX_FEEDBACK_IMAGE_TOTAL_BYTESis pinned below 4,500,000 — the invariant that actually fixes the bug, as opposed to the exact value.defaultPrevented === false, and the Attach button disables on bytes below the count limit.413produces the "too large" toast and403produces the neutral one, pinned as two separate cases.Each new assertion was verified by reverting the production change and confirming the test fails: reverting the cap to 32 MiB fails the limits test, reverting either gate to count-only fails the two attach tests, reverting the draft to component state fails the two draft tests, putting the draft clear back inside the mount guard fails the unmount-mid-send test, clearing it unconditionally fails the typed-after-remount test, and collapsing the toast back to one string fails the
403test.Checks run locally:
pnpm tc,oxlint(clean),pnpm run check:code-quality:changed, the four localization gates, and the feedback / sidebar / store / preload / main-ipc suites (~10,000 tests).AI Disclosure
Original change written with Claude Opus 5.5 in the pi coding agent by @mmarabel. Takeover commits (audit-map fix, shared limits and IPC contract, byte-aware attach paths, draft persistence) written with Claude Opus 5 by @nwparker.
Review
components/uiprimitives and tokens only; no new colors, sizes or shadow tiers.screenshotsHintgained a{{maxSize}}interpolation, so the stalefr/zh/jatranslations (and two untranslated English copies ines/ko) were retired and fall back to English until a localization pass re-adds them.AppFeedbackDialog. That is complementary — the store-backed draft keeps working there — but whichever merges second will need to resolve locale-catalog conflicts.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)