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): reuse labels created earlier in one modify request - #50601
A new label repeated within one mail operation should be created once and reused.
What Changed
Remember labels created earlier in the request in the same lookup list used for existing labels.
Why
When one modify request repeats a new label, Orca creates it then tries to create it again. Gmail's name-conflict error aborts the mail modification after leaving the new label behind.
modifyGmail resolves labels before Gmail message/thread modification.
N/A — this backend label reuse 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
The repeated trimmed Project label causes a conflict error before the target message is modified.
One Project label is created and applied alongside an existing label; no second label creation is attempted.
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 write data integrity
node config/scripts/test-runtime/execution-policy/run-vitest.mjs run --config config/vitest.config.ts src/main/google/google-gmail-repeated-label.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. Reuses an already-returned label object and avoids duplicate network writes. Existing label matching and response fields are preserved.
Risk
Level: Low
Low. Reuses an already-returned label object and avoids duplicate network writes. Existing label matching and response fields are preserved.
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.
Notes
The user contribution history and targeted repository PR searches were checked for an existing equivalent change.
Checklist
This PR is small and focused
I explained what changed and why, including the mechanism and before/after result
I stated the risk and how to back it out
Before/after data evidence is included; no graphical layout change
Self-reviewed for correctness, security and performance
Cross-platform, SSH/remote and path/shortcut impact considered
Full lint/typecheck/test/build gate: component results and local IPC limitation are recorded above; CI still needs to cover the complete gate
No actionable comments were generated in the recent review.
Walkthrough
labelIds now adds a newly created Gmail label to the in-memory list of existing labels. This lets later names in the same request reuse it. A regression test covers repeated, whitespace-padded label names and verifies that the requested labels are applied.
Severity of issue fixed: Medium
Merge Risk: Minimal · up to e3646
This change lets repeated or whitespace-padded new Gmail label names in one request reuse the label just created, instead of failing on a name conflict. It adds no meaningful runtime cost and comes with a regression test, so the merge risk is minimal. CI should still pass before merging.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(gmail): reuse labels created earlier in one modify request" matches the main change. The raw summary and objectives say labelIds now adds newly created labels to the existing-label look…
Description check
The description follows the repository template. It has ELI5, What Changed, Why, Linked Issue (Fixes #50600), Visual Proof (N/A with reason and before/after data), Testing, Performance, Risk with leve…
Linked Issues check
Issue #50600 requires that modifyGmail create a repeated new label once and apply it. At the reviewed head, labelIds in src/main/google/google-gmail-write.ts pushes each newly created label into the e…
Out of Scope Changes check
The PR changes three files per the summary. (1) src/main/google/google-gmail-write.ts adds one line (existing.push(made)) that implements the issue's proposed behavior. (2) src/main/google/google-gmai…
Full details: Title check
Explanation
The title "fix(gmail): reuse labels created earlier in one modify request" matches the main change. The raw summary and objectives say labelIds now adds newly created labels to the existing-label lookup, so a repeated label in one modifyGmail call reuses the label created earlier instead of creating it twice. The title is specific and concise, and it follows a conventional commit style.
Full details: Description check
Explanation
The description follows the repository template. It has ELI5, What Changed, Why, Linked Issue (Fixes #50600), Visual Proof (N/A with reason and before/after data), Testing, Performance, Risk with level, AI Disclosure, Review, Agent skill boundary, Notes, and Checklist. It explains the mechanism: a repeated new label was created twice and Gmail's name-conflict error aborted the modification. The Performance and Risk sections repeat the same sentence, and the Testing section has a long, partly internal note about aggregate results. The Risk section also does not name a specific revert consequence beyond a plain revert. These are minor gaps, so the description is mostly complete.
Full details: Linked Issues check
Explanation
Issue #50600 requires that modifyGmail create a repeated new label once and apply it. At the reviewed head, labelIds in src/main/google/google-gmail-write.ts pushes each newly created label into the existing lookup list (existing.push(made)). A later name in the same call that trims and lowercases to the same key matches that entry through existing.find and reuses its id, so no second POST to labels occurs. The requested labels, including Existing, still resolve to ids before batchModify or thread modify runs. The PR summary states that a test for repeated, whitespace-padded Project inputs asserts one created label and one application of each label. I could not read the test file or the whole-PR diff because the changed blobs were unavailable, so the test assertions rest on the PR summary and description, not on direct source reading. The issue's requirement is implemented in the code I could read.
Full details: Out of Scope Changes check
Explanation
The PR changes three files per the summary. (1) src/main/google/google-gmail-write.ts adds one line (existing.push(made)) that implements the issue's proposed behavior. (2) src/main/google/google-gmail-repeated-label.test.ts adds a Vitest regression test for the issue scenario, which supports the objective. (3) src/main/google/google-api-http.test-fixture.ts adds a test fixture that mocks the home directory and saves a connected Google account. It exists only to support the new test. No unrelated production behavior change appears in the summary. The whole-PR diff could not be read, so this verdict relies on the summary and the head file content.
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 finding and fixing this! We've landed your fix in #50675 on a maintainer branch, rebased on current main with a slightly simplified co-located test. Your authorship is kept via a Co-authored-by trailer on the commit. Closing this one in favor of #50675.
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
A new label repeated within one mail operation should be created once and reused.
What Changed
Remember labels created earlier in the request in the same lookup list used for existing labels.
Why
When one modify request repeats a new label, Orca creates it then tries to create it again. Gmail's name-conflict error aborts the mail modification after leaving the new label behind.
modifyGmail resolves labels before Gmail message/thread modification.
Linked Issue
Fixes #50600
Visual Proof
N/A — this backend label reuse 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 write data integrity
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. Reuses an already-returned label object and avoids duplicate network writes. Existing label matching and response fields are preserved.
Risk
Level: Low
Low. Reuses an already-returned label object and avoids duplicate network writes. Existing label matching and response fields are preserved.
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
The user contribution history and targeted repository PR searches were checked for an existing equivalent change.
Checklist