You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(gmail): bound attachment reads when forwarding drafts - #50598
Forward messages with many attachments using Orca's existing request budget instead of launching every download together.
What Changed
Retrieve saved attachments through the existing inBatches helper and GMAIL_CALLS_AT_ONCE budget. Preserve attachment ordering and aggregate byte limits.
Why
Forwarding or revising a message launches every attachment retrieval simultaneously. This ignores Orca's existing Gmail request budget and can fail the entire draft on a concurrent-request429.
saveGmailDraft invokes composeForward and composeRevision, both using savedAttachments.
N/A — this backend attachment concurrency fix has no graphical layout change. The reproducible before/after behavior is recorded below.
Before/after data-level reproduction of the same input:
Before
After
Forwarding12 small files fails at the modeled GoogleApi concurrency boundary.
The same production composeForward entry succeeds with all attachments in order; a single attachment still has the original contents.
No graphical layout change is included. The evidence above is from the production operation; no desktop screenshot is claimed.
Testing
I manually tested these changes locally through the production-entry reproduction described above
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
External concurrency invariant
node config/scripts/test-runtime/execution-policy/run-vitest.mjs run --config config/vitest.config.ts src/main/google/google-gmail-forward-concurrency.test.ts
Locally exercised on Linux with Node 24.22.3. External API cases use protocol fixtures; no live provider account, graphical desktop, macOS, Windows or remote SSH execution is claimed.
Changed-code quality passed with zero findings. Node typecheck passed (17,005 files); web typecheck passed (16,094 files). The integrated regression run passed 51 tests in 30 files; the Drive performance contract passed separately. The final three test typing changes were rerun and passed. These are aggregate first-batch results, not per-PR test counts.
The required pnpm check:changed --base=9890ea181c0f9ae59fb82da64c4a6fbc0504a817 was attempted after final edits. It stopped in the workspace-package build because this environment rejects the tsx CLI's local IPC socket (listen EPERM). The full gate/build is therefore not claimed to pass; CI remains required. The process-host build entry executed successfully using node --import tsx --conditions=orca-source.
Performance
Low. At most the existing 10-request budget is spent per attachment batch. Number of reads and output bytes do not increase; many-file operations trade unrestricted parallelism for fewer quota refusals.
Risk
Level: Low
Low. At most the existing 10-request budget is spent per attachment batch. Number of reads and output bytes do not increase; many-file operations trade unrestricted parallelism for fewer quota refusals.
A plain revert restores the previous behavior; no schema migration is introduced.
AI Disclosure
Core contribution owner: @Afloat16. Required tooling disclosure: GPT-6 Astra Pro was used for implementation and review.
Review
Reviewed the production caller, baseline failure, ordinary controls, data integrity and additional work. No new shell commands, path grammar, remote protocol fields, polling or UI layout were introduced. SSH/remote, mobile and agent integrations retain their existing entry points.
Agent skill upstream boundary
Not applicable: this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments or documentation.
No actionable comments were generated in the recent review.
Walkthrough
Saved Gmail attachments are now downloaded through inBatches, using GMAIL_CALLS_AT_ONCE to limit concurrent requests. The existing attachment conversion and total-size check remain unchanged. A new test checks forwarding messages with 12 attachments and one attachment under a modeled 10-request concurrency limit.
Severity of issue fixed: Medium
Merge Risk: Minimal · up to 87099
Forwarding or revising drafts with many saved attachments now stays within the Gmail request budget while keeping attachment order. No actionable merge risk remains beyond running the usual CI checks.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(gmail): bound attachment reads when forwarding drafts" matches the main change. The raw summary and objectives say forwarding and revising drafts now fetch saved attachments in batches …
Description check
The description follows the template. It has ELI5, What Changed, Why, Linked Issue (Fixes #50596), Visual Proof (N/A with reason and data-level before/after), Testing, Performance, Risk with level and…
Linked Issues check
Issue #50596 requires that forwarding or revising a message with many saved attachments stay within GMAIL_CALLS_AT_ONCE (10). It requires retrieval through inBatches, attachment order preserved, and a…
Out of Scope Changes check
The whole-PR diff against the merge base 9890ea1 changes only src/main/google/google-gmail-draft-compose.ts (import of GMAIL_CALLS_AT_ONCE and inBatches; savedAttachme…
Full details: Title check
Explanation
The title "fix(gmail): bound attachment reads when forwarding drafts" matches the main change. The raw summary and objectives say forwarding and revising drafts now fetch saved attachments in batches limited by GMAIL_CALLS_AT_ONCE instead of unbounded concurrent downloads. The title names the Gmail scope and the forwarding behavior. It omits the revision path, which is a minor gap.
Full details: Description check
Explanation
The description follows the template. It has ELI5, What Changed, Why, Linked Issue (Fixes #50596), Visual Proof (N/A with reason and data-level before/after), Testing, Performance, Risk with level and revert path, AI Disclosure, Review, the upstream boundary checkbox, Notes, and Checklist. It is mostly complete. Gaps: the Performance and Risk paragraphs repeat the same text, the Why section gives no comparison with alternatives, the Testing section mixes a failing full gate with claimed results, and the Visual Proof before/after table is only a textual description rather than a switchable artifact. The template asks for the reason the chosen approach beats the alternatives, and that is missing.
Full details: Linked Issues check
Explanation
Issue #50596 requires that forwarding or revising a message with many saved attachments stay within GMAIL_CALLS_AT_ONCE (10). It requires retrieval through inBatches, attachment order preserved, and aggregate byte limits preserved. At the reviewed head, savedAttachments in src/main/google/google-gmail-draft-compose.ts retrieves files with inBatches(files, GMAIL_CALLS_AT_ONCE, ...) instead of an unbounded Promise.all. The inBatches helper in google-gmail-read.ts runs at most limit items at a time and appends results batch by batch, so output order matches input order. The total-size check before retrieval is unchanged. The same savedAttachments function serves composeForward and composeRevision, so both paths are covered. The PR adds src/main/google/google-gmail-forward-concurrency.test.ts, which the raw summary describes as a 12-attachment test against a mock API that rejects more than 10 concurrent requests. I did not read the test body, so its exact assertions are not independently verified. The implementation alone meets the stated coding requirements. The author's reported local runs were not re-executed here.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against the merge base 9890ea1 changes only src/main/google/google-gmail-draft-compose.ts (import of GMAIL_CALLS_AT_ONCE and inBatches; savedAttachments body rewritten to use inBatches) and adds the concurrency test file. Both changes connect directly to issue #50596. No unrelated source changes appear in the file listing or the summary. The PR description contains non-code claims about tooling, AI disclosure, and check results. These do not alter repository content and are not code scope issues.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
Thanks @Afloat16 for this fix! We couldn't push to your branch, so it has been rebased onto the latest main and landed in #50671. Your authorship is preserved on the commit. Closing this one in favor of that PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Forward messages with many attachments using Orca's existing request budget instead of launching every download together.
What Changed
Retrieve saved attachments through the existing inBatches helper and GMAIL_CALLS_AT_ONCE budget. Preserve attachment ordering and aggregate byte limits.
Why
Forwarding or revising a message launches every attachment retrieval simultaneously. This ignores Orca's existing Gmail request budget and can fail the entire draft on a concurrent-request429.
saveGmailDraft invokes composeForward and composeRevision, both using savedAttachments.
Linked Issue
Fixes #50596
Visual Proof
N/A — this backend attachment concurrency fix has no graphical layout change. The reproducible before/after behavior is recorded below.
Before/after data-level reproduction of the same input:
No graphical layout change is included. The evidence above is from the production operation; no desktop screenshot is claimed.
Testing
External concurrency invariant
Locally exercised on Linux with Node 24.22.3. External API cases use protocol fixtures; no live provider account, graphical desktop, macOS, Windows or remote SSH execution is claimed.
Changed-code quality passed with zero findings. Node typecheck passed (17,005 files); web typecheck passed (16,094 files). The integrated regression run passed 51 tests in 30 files; the Drive performance contract passed separately. The final three test typing changes were rerun and passed. These are aggregate first-batch results, not per-PR test counts.
The required
pnpm check:changed --base=9890ea181c0f9ae59fb82da64c4a6fbc0504a817was attempted after final edits. It stopped in the workspace-package build because this environment rejects the tsx CLI's local IPC socket (listen EPERM). The full gate/build is therefore not claimed to pass; CI remains required. The process-host build entry executed successfully usingnode --import tsx --conditions=orca-source.Performance
Low. At most the existing 10-request budget is spent per attachment batch. Number of reads and output bytes do not increase; many-file operations trade unrestricted parallelism for fewer quota refusals.
Risk
Level: Low
Low. At most the existing 10-request budget is spent per attachment batch. Number of reads and output bytes do not increase; many-file operations trade unrestricted parallelism for fewer quota refusals.
A plain revert restores the previous behavior; no schema migration is introduced.
AI Disclosure
Core contribution owner: @Afloat16. Required tooling disclosure: GPT-6 Astra Pro was used for implementation and review.
Review
Reviewed the production caller, baseline failure, ordinary controls, data integrity and additional work. No new shell commands, path grammar, remote protocol fields, polling or UI layout were introduced. SSH/remote, mobile and agent integrations retain their existing entry points.
Agent skill upstream boundary
Notes
Primary references:
The user contribution history and targeted repository PR searches were checked for an existing equivalent change.
Checklist