Skip to content

fix(feedback): send text-only report when screenshots exceed the upload limit - #22508

Merged
nwparker merged 8 commits into
stablyai:mainfrom
mmarabel:mmarabel/fix-feedback-413-22466
Sep 25, 2026
Merged

nwparker merged 8 commits into
stablyai:mainfrom
mmarabel:mmarabel/fix-feedback-413-22466

Conversation

@mmarabel

@mmarabel mmarabel commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

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:

  1. The client's cap did not match the server's. https://www.onorca.dev/v1/feedback is a Vercel Function, and those reject request bodies over ~4.5 MB with 413 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 in src/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.

  2. The image lane never shed its attachment. submitFeedback deliberately 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 reports imagesFailure up to the dialog. Images and diagnostic bundles are mutually exclusive in buildSubmitBody, so the fallback body is always plain JSON with nothing left to trip the limit.

  3. The draft only existed inside the sidebar. SidebarFeedbackDialog renders under SidebarSettingsHelpMenu, 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:

  • Both attach paths are byte-aware. The paste gate and the Attach button previously knew only the image count. With a 4 MiB total, one full-screen screenshot spends the budget while the count still reads 1 of 4 — so every later paste passed the gate, called preventDefault(), destroyed any text pasted alongside it, and was then rejected anyway. Both now read the live committed-plus-in-flight byte reservation.
  • The rejected-images toast states the outcome rather than implying the screenshots can still be recovered from a dialog that has already closed — and it only blames the size when the server actually said so. 413 gets "Feedback sent. Your screenshots were too large to upload and were not included."; the other statuses that shed the attachment (a corporate filter's 403, 415, 422…) get "Feedback sent. Your screenshots could not be uploaded and were not included."
  • A confirmed delivery clears the draft even if the sidebar collapsed mid-send. Clearing used to be skipped when the dialog had already unmounted, so a report that did arrive came back on the next open and invited a duplicate send. The clear now runs outside the mount guard (the store action outlives the component) but first checks that the stored text still matches what was sent, so a different report typed after reopening is not wiped by the old in-flight handler.
  • postFeedback and the request builders moved unchanged from feedback.ts into feedback-request.ts to stay under the 300-line lint cap, and the feedback:submit result shape moved into src/shared/feedback-submit-contract.ts — it had been hand-copied into two preload files with nothing tying either to what main actually returns.
  • Capacity regression, stated plainly: the total attachment budget drops from 32 MiB to 4 MiB and the per-image ceiling from 8 MiB to 4 MiB. Two full-screen Retina PNGs will often no longer fit. That is a deliberate last-resort guard, not the end state — Recompress oversized Send Feedback screenshots instead of refusing them #22776 tracks recompressing oversized screenshots in the main process (Electron's NativeImage already does this behind a tested seam in clipboard-image-thumbnail.ts) so a big screenshot is shrunk rather than refused.

Why

  • A cap alone would keep throwing away the user's screenshot, and a fallback alone would keep sending every large upload into a guaranteed 413. Doing both means the common case never reaches the server oversized, and the rare one still delivers the text.
  • The fallback reuses the diagnostic-bundle lane's existing text-only path and status set rather than adding a second retry mechanism. The refactor actually removes a duplicate: there is now one text-only post in the file instead of two.
  • The draft went into useAppStore, which already owns the sidebar's state, rather than a new store — and session-only, mirroring newIssueDraft, because a bug report is not something to leave on disk.
  • Considered and rejected: chunked or split uploads (needs server changes); leaving the cap at 32 MiB and relying only on the fallback (every large screenshot silently dropped); client-side recompression in this PR (the right answer, but a larger change with its own UX questions — filed as Recompress oversized Send Feedback screenshots instead of refusing them #22776 rather than rushed in here).

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.

Before — hint hides the real rule, Attach stays enabled on a spent budget After — hint states the total, Attach disables
proof-1-before-attach.png proof-2-after-attach.png

2. The draft survives. Type a report, close the dialog, collapse the sidebar, reopen it, reopen Send Feedback.

Before — report gone, only the auto-inserted footer is left After — report still there
proof-3-before-draft.png proof-4-after-draft.png

The rejected-images toasts are not shown above: reproducing either needs a real 413 / 403 from the live endpoint, which would post junk into the team's feedback channel. They are covered by unit tests against a stubbed net.fetch instead — 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 and status 413 in 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):

  1. Help → Send Feedback → the hint reads "Attach up to 4 screenshots, 4.0 MB total".
  2. Attach a 4,194,304-byte PNG → thumbnail shows "4.0 MB" and the Attach button disables at 1 of 4.
  3. Type a report → close the dialog → collapse the sidebar (this unmounts the dialog subtree; the Help button disappears) → re-expand → Send Feedback → the report is still there.

Not manually exercised: a live 413 from https://www.onorca.dev/v1/feedback. The fallback was exercised only against a stubbed net.fetch in 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:

  • 413 on the image lane → a second JSON request without images → { ok: true, imagesDelivered: false, imagesFailure }, and the dialog shows the rejected-images toast.
  • A failed text-only resend keeps both statuses; 401/429/500/502 and network errors are not resent.
  • The total-size cap accepts a set exactly at the limit and rejects one byte over, in both the dialog-side and main-process validators.
  • MAX_FEEDBACK_IMAGE_TOTAL_BYTES is pinned below 4,500,000 — the invariant that actually fixes the bug, as opposed to the exact value.
  • A paste on a spent budget leaves defaultPrevented === false, and the Attach button disables on bytes below the count limit.
  • 413 produces the "too large" toast and 403 produces the neutral one, pinned as two separate cases.
  • The draft survives unmount/remount, survives a submit the server refused, clears once delivery is confirmed, clears when the dialog unmounts before the request resolves, and does not clear a new report typed after reopening while the old request is still in flight.

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 403 test.

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

  • Cross-platform: no platform-specific code. Size checks are byte lengths; no paths, no keyboard shortcuts.
  • SSH / remote / runtime: feedback is submitted from the desktop main process only, so SSH worktrees, folder workspaces and remote runtimes are unaffected. No wire format between a client and a remote host changes.
  • Agents / integrations: none affected. No agent-status producer or reader touched.
  • Performance: one extra text-only request after a rejected upload, and summing attachment sizes that are already known.
  • UI: no layout change. One hint string gains the total size, the Attach button gains a second disable condition, and there are two toasts. Existing components/ui primitives and tokens only; no new colors, sizes or shadow tiers.
  • Security: the main process still validates the raw IPC input before any typed-array normalization, now including the total size. The fallback resends only the text fields the user already submitted. Sharing the result type with preload does not widen what crosses the boundary.
  • Localization: screenshotsHint gained a {{maxSize}} interpolation, so the stale fr / zh / ja translations (and two untranslated English copies in es / ko) were retired and fall back to English until a localization pass re-adds them.
  • Adjacent PR: fix(feedback): stop the Help menu funnelling ordinary bug reports into the crash channel #12493 moves this dialog out of the sidebar entirely into an app-level 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

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Backwards compatibility: no server change is required, and the fallback uses the existing JSON request shape.
  • The 4 MiB budget counts images only; the textarea has no length cap, so a very long pasted log plus a full 4 MiB of screenshots can still exceed the host limit. The text-only fallback is what guarantees delivery there — the headroom in the comment is nominal, and says so. Tracked in Recompress oversized Send Feedback screenshots instead of refusing them #22776.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Feedback 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 39e09

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 Review

Security architecture risk: 🟡 Moderate · up to 39e09

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

  • Medium · security · inferred: If a feedback request succeeds after its dialog unmounts, mounted-only success handling skips clearing the now session-wide draft. Reopening the dialog can expose already-delivered text as an unsent draft and permit another submission.
Security review details

Security Blast Radius

  • inferred — The identified lifecycle issue concerns feedback text and anonymity choice in one running client's draft, with possible repeat delivery to the existing feedback endpoint. The evidence does not show increased crash-lane authority or cross-user access.

Security Findings and Attack Paths

  • inferred — After an in-flight dialog unmounts, successful delivery cannot run its mounted-only cleanup. The retained text may be displayed and resubmitted on remount; no remote attacker or server-side duplicate acceptance has been established.

Trust Boundaries and Controls

  • observed — The renderer can supply feedback and image bytes, but preload forwards them through IPC; main validates images before network submission and does not let this channel select the privileged crash submission lane.

Resilience and Maintainability Implications

  • observed — The image fallback sends a separate text-only request only for configured response statuses; a failed text-only request remains a failure result. Response status is client-visible, but server-side delivery and deduplication guarantees were not available.

Hardening Proposals

  • proposed — Give an in-flight submission an owner or immutable draft version outside the dialog, and reconcile its completion after unmount. Clear only the matching delivered draft and prevent a remounted dialog from resending that in-flight report.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning 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:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #22466 requires protection against oversized screenshot requests and delivery of typed feedback when image upload fails. The shared limits set a 4 MiB per-image and total-image cap. Renderer and…
Out of Scope Changes check ✅ Passed The changed request module, shared IPC contracts, renderer state, localization, validation, and tests support Issue #22466. The request extraction supports the text-only retry. The draft slice address…
Title check ✅ Passed The title clearly identifies the primary behavior change: sending a text-only feedback report when screenshot uploads exceed the server limit. It is concise and directly related to the changes.
Description check ✅ Passed The description is complete and follows the repository template. It explains the user impact, implementation, rationale, linked issue, visual proof, testing, AI disclosure, compatibility consideration…
Full details: Docstring Coverage

Explanation

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.)

  • Fix all pre-merge checks with AI

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts
  • src/main/ipc/feedback-image-attachments.ts
  • src/main/ipc/feedback-request.ts
  • src/main/ipc/feedback.test.ts
  • src/main/ipc/feedback.ts
  • src/preload/api/crash-report-api.ts
  • src/preload/api/feedback-bridge.ts
  • src/renderer/src/components/sidebar/SidebarFeedbackDialog.test.tsx
  • src/renderer/src/components/sidebar/SidebarFeedbackDialog.tsx
  • src/renderer/src/components/sidebar/use-sidebar-feedback-images.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/feedback-image-attachments.test.ts
  • src/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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one edge case inline, plus a nitpick.

Reviewed changes

  • Total attachment budget (4 MiB): readFeedbackImageFiles now takes existingBytes and rejects any file that would push the set over MAX_FEEDBACK_IMAGE_TOTAL_BYTES; validateFeedbackImages enforces the same total at the IPC boundary. MAX_FEEDBACK_IMAGE_BYTES drops 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, submitFeedbackWithImages resends 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 imagesRejected warning 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 to feedback-request.ts; feedback.ts keeps orchestration and stays under the max-lines gate. Preload types gain optional imagesFailure.

I verified the focused suites locally (pnpm test on the four changed test files): 101 tests pass.

ℹ️ Nitpicks

  • hasAttachableFeedbackImage still 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 return true, 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.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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: handleAddFiles now derives both existingCount and existingBytes from liveImageDraftsRef.current, which is updated synchronously when a read resolves, instead of from rendered images state. A batch that resolved but has not yet re-rendered therefore still counts against the 4 MiB budget, and the imageCount/imageBytes values and their dependency-array entries are gone.
  • Regression test: the new use-sidebar-feedback-images.test.tsx asserts the just-read batch is counted when a second add lands before React commits the first — it pins the pre-commit window (images still empty) and then checks readFeedbackImageFiles is called with ([second], 1, firstBytes).

Prior inline thread 4085330206 is resolved by this commit.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

mmarabel and others added 3 commits September 23, 2026 17:47
…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.
@AmethystLiang
AmethystLiang force-pushed the mmarabel/fix-feedback-413-22466 branch from e7e1994 to 6019b4b Compare September 24, 2026 00:59
…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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ 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 the feedback:submit args/result types moved to src/shared/feedback-image-limits.ts and src/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: hasAttachableFeedbackImage now takes existingBytes and mirrors readFeedbackImageFiles' per-image and remaining-total limits; the hook exposes getReservedImageCapacity() (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 feedbackDraft store 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.screenshotsHint changed its placeholders, and the fr / ja / zh translations 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.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 1de5006a-92c2-40aa-9f1a-0834765b1fa9

📥 Commits

Reviewing files that changed from the base of the PR and between e1c31ea and 39e0958.

📒 Files selected for processing (23)
  • src/main/ipc/feedback-image-attachments.ts
  • src/main/ipc/feedback-request.ts
  • src/main/ipc/feedback.ts
  • src/preload/api/crash-report-api.ts
  • src/preload/api/feedback-bridge.ts
  • src/renderer/src/components/sidebar/SidebarFeedbackDialog.test.tsx
  • src/renderer/src/components/sidebar/SidebarFeedbackDialog.tsx
  • src/renderer/src/components/sidebar/SidebarFeedbackImageAttachments.tsx
  • src/renderer/src/components/sidebar/use-sidebar-feedback-images.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • 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/lib/feedback-image-attachments.ts
  • src/renderer/src/store/index.ts
  • src/renderer/src/store/slices/feedback-draft.ts
  • src/renderer/src/store/slices/store-test-helpers.ts
  • src/renderer/src/store/types.ts
  • src/shared/feedback-image-limits.test.ts
  • src/shared/feedback-image-limits.ts
  • src/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.

@nwparker

Copy link
Copy Markdown
Contributor

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:

  1. e1c31ea — unblocked CI. The only failing check was the global-fetch call-site audit: the fetch()-mentioning comment moved with postFeedback into the new feedback-request.ts, and AUDITED_GLOBAL_FETCH_LINES still pointed at feedback.ts. Both the add and the stale-entry removal were needed — the second assertion would have failed on the next run even with a one-line fix.

  2. 1269d85 — the limits and the IPC result shape are declared once. MAX_FEEDBACK_IMAGE_COUNT / _BYTES / _TOTAL_BYTES were in two parallel modules that had to agree with each other and with an unversioned server limit; they now live in src/shared/feedback-image-limits.ts. The submit result shape was hand-copied into two preload files, so that moved to src/shared/feedback-submit-contract.ts. Added a test pinning the total below Vercel's 4.5 MB — the main-process tests all derived their numbers from the constant, so reverting the cap to 32 MiB would have kept them green.

  3. 24ce699 — both attach paths know about the byte budget. This was the real gap. With a 4 MiB total, one full-screen screenshot spends the budget while getReservedImageSlots() still returns 1, so hasAttachableFeedbackImage passed, preventDefault() fired, and any text pasted alongside the image was destroyed — the exact bug that function's docstring says it exists to prevent. Same on the second entry point: the Attach button disabled on count alone, so it kept inviting picks that could only be refused. Both now read live committed-plus-in-flight bytes, and the hint states the total. Also reworded the rejected-images toast, since the dialog closes on that path and "They couldn't be uploaded." implied the user could still do something about them.

  4. 39e0958 — the draft lives outside the sidebar subtree. [Bug]: Send Feedback with a screenshot over ~4.5 MB fails with 413, and the typed report is then lost #22466's third ask. SidebarFeedbackDialog renders under SidebarSettingsHelpMenu, which the sidebar only mounts while open, so collapsing it discarded the report — and the branch deliberately does not retry 5xx, timeouts or network errors, which is exactly when the user still needs the text. Draft text and the anonymity choice moved into the existing useAppStore beside newIssueDraft, session-only. Image drafts stayed local: they hold object URLs the unmount cleanup has to revoke.

Two notes on the framing rather than the code:

  • The cap is presented in the body as the root-cause fix, but it is really a last-resort guard — 32 MiB of capacity became 4 MiB and the per-image ceiling halved, so the 6.4 MB Retina PNG the reporter actually attached still cannot be attached. I rewrote that section to say so, and filed Recompress oversized Send Feedback screenshots instead of refusing them #22776 for the honest fix (recompress in the main process — the images are already byte arrays there, and NativeImage.resize is already driven behind a tested seam in clipboard-image-thumbnail.ts).
  • Body now has before/after visual proof for both the attach affordance and the draft survival, and Testing states plainly that the 413 path was only exercised against a stubbed net.fetch, never a live 413 from the endpoint.

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 — liveImageDraftsRef is written synchronously in the read callback, in handleRemoveImage and in clearImages, so it is strictly fresher than state. Flipping to the ref was a correctness fix, not a refactor.

…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.
@nwparker

Copy link
Copy Markdown
Contributor

Follow-up takeover commit pushed (302120a), closing the last two review findings:

  • Draft survived a delivery that landed after unmount. Clearing the store draft was inside the mountedRef guard, so collapsing the sidebar mid-send left the sent report in the store and offered it back on the next open — a duplicate-send invitation, and a regression in this PR's own headline feature. The clear now runs outside the guard (the zustand action outlives the component) and instead compares the stripped user text, so a different report typed after reopening survives the stale handler.
  • The rejected-images toast no longer blames the size for every status. Only 413 means the upload was over the host's limit; 403 / 415 / 422 shed the same attachment for other reasons and now get neutral copy (new imagesNotIncluded key).

Tests added for all three behaviours, each verified to fail on revert. PR body updated.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 the mountedRef guard in SidebarFeedbackDialog.tsx; it now compares the stored draft, footer-stripped and trimmed, to the submitted userText before 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 neutral imagesNotIncluded string.
  • Tests: a draft-survival pair (clear on unmount-mid-send, retain a report typed after remount) and a 403-vs-413 toast 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.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit 745cde6 into stablyai:main Sep 25, 2026
30 checks passed

@nwparker nwparker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved to run CI. Taken over and reworked by @nwparker; findings addressed and independently re-verified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Send Feedback with a screenshot over ~4.5 MB fails with 413, and the typed report is then lost

3 participants