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(mobile): prevent duplicate queued sends after chat remount - #39809
Reopening a mobile chat while an offline-queued message was still sending could deliver the same instruction twice. The shared chat queue now admits one pending send across screen instances.
Files
Added
Deleted
Net
Test
1
$\color{#1a7f37}{\Huge{\mathbf{+}}}$35
0
$\color{#1a7f37}{\Huge{\mathbf{+}}}$35
Prod
2
$\color{#1a7f37}{\Huge{\mathbf{+}}}$15
$\color{#cf222e}{\Huge{\mathbf{−}}}$7
$\color{#1a7f37}{\Huge{\mathbf{+}}}$8
What Changed
Claim a queued message synchronously in the shared queue before dispatch; refuse missing entries or a queue with a send already in progress.
Skip a sending head during automatic drain, and apply the shared claim to manual Send Now too.
Add one regression covering remount, rejected duplicate/manual dispatch, and successful delivery of the next queued message after settlement.
Why
The screen-local draining flag resets on remount while the queue survives. Owning the claim in that shared queue preserves ordering and prevents a second structured send from getting a fresh message ID.
Linked Issue
Release-scan P1 finding F01, introduced by #39423.
Visual Proof
N/A — internal queue ownership and delivery fix; no visual or interaction design changes. The hook regression exercises the remount behavior.
Testing
Regression failed before the fix: the first message was delivered twice after remount. It passes with the fix and delivers the next message after the pending send settles.
ORCA_BACKGROUND_LAUNCH=1 pnpm --dir mobile test src/session/native-chat/composer/use-mobile-native-chat-offline-sends.test.ts src/session/native-chat/composer/mobile-native-chat-draft-persistence.test.ts src/session/use-mobile-structured-native-chat-send-bridge.test.ts --maxWorkers=2 — 22 tests passed across the focused runs.
Production queue + structured-send bridge reproduction — accepted-send control and pending-send remount case passed.
Mobile application and test typechecks, lint, formatting, changed-code quality, and flaky-test ratchet passed.
After rebasing onto current main: ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=2 — all 15 selected checks passed.
Manually tested on a device (not performed)
Automated regression added; failed before the fix with hardcoded expected delivery order.
Risk
Level: Low. A bad admission guard could leave queued messages waiting. The regression verifies settlement allows the next message through; existing failure, handback, and Resume tests pass. The change is platform-independent and keeps existing chat scope keys for local, remote, and folder workspaces. It changes no stored schema or wire contract. A plain revert backs it out.
Review
Self-reviewed the shared claim, remount lifetime, manual dispatch, and queue settlement paths. Native-device and rendered navigation testing were not performed.
Agent skill upstream boundary
Not applicable; no upstream skill-installer content copied.
Checklist
Small and focused: three files.
User-facing trigger, fix, risk, and validation described.
Cross-platform, remote, mobile, folder-workspace, and backward-compatibility impact considered.
Applicable local checks passed; full PR workflow must pass before merge.
No actionable comments were generated in the recent review.
Walkthrough
The offline send start function now returns a boolean and refuses to start when the requested ID is absent or another send is already in progress. Dispatch marks a send as draining only after a successful start. Automatic dispatch skips a queue head that is paused or already sending. A new test covers repeated dispatch attempts while a send remains pending across a hook remount.
Merge Risk: Minimal · up to d403d
No actionable current-head issue is established. The reported native-device testing remains outstanding, but the change is mergeable after normal checks.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title "fix(mobile): prevent duplicate queued sends after chat remount" matches the main change. The PR claims queued offline messages in the shared queue before dispatch, so a remounted mobile cha…
Description check
The description follows the repository template and covers the required sections. It has an ELI5 section, a What Changed section, a Why section, a Linked Issue reference (Release-scan P1 finding F01, …
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "fix(mobile): prevent duplicate queued sends after chat remount" matches the main change. The PR claims queued offline messages in the shared queue before dispatch, so a remounted mobile chat no longer delivers the same queued message twice. The title is specific, concise, and uses a conventional-commit style. It does not list files or use vague terms.
Full details: Description check
Explanation
The description follows the repository template and covers the required sections. It has an ELI5 section, a What Changed section, a Why section, a Linked Issue reference (Release-scan P1 finding F01, introduced by #39423), Visual Proof marked N/A with a reason, a Testing section with commands and results, a Risk section with a level (Low) and a revert path, a Review section, the agent skill boundary checkbox, and a completed checklist. The Linked Issue entry does not give a GitHub issue number (it cites a release-scan finding and a PR number instead), and the 'Fixes #' line from the template was replaced. The AI Disclosure section is missing. The 'Manually tested on a device' box is unchecked and noted as not performed. The Testing section also reports a failing-before-fix run only in prose, and the 'hardcoded expected delivery order' note is unclear.
Resolution
Optional improvements: add a Linked Issue with a real GitHub issue number (the template asks for 'Fixes #' with an actual issue, and outside contributors need one), fill in or mark N/A the AI Disclosure section, and clarify the note about the 'hardcoded expected delivery order' in the Testing section.
Full details: Docstring Coverage
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 3 files.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
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; 6 remain after this review.
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
Reopening a mobile chat while an offline-queued message was still sending could deliver the same instruction twice. The shared chat queue now admits one pending send across screen instances.
What Changed
Why
The screen-local draining flag resets on remount while the queue survives. Owning the claim in that shared queue preserves ordering and prevents a second structured send from getting a fresh message ID.
Linked Issue
Release-scan P1 finding F01, introduced by #39423.
Visual Proof
N/A — internal queue ownership and delivery fix; no visual or interaction design changes. The hook regression exercises the remount behavior.
Testing
ORCA_BACKGROUND_LAUNCH=1 pnpm --dir mobile test src/session/native-chat/composer/use-mobile-native-chat-offline-sends.test.ts src/session/native-chat/composer/mobile-native-chat-draft-persistence.test.ts src/session/use-mobile-structured-native-chat-send-bridge.test.ts --maxWorkers=2— 22 tests passed across the focused runs.ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=2— all 15 selected checks passed.Risk
Level: Low. A bad admission guard could leave queued messages waiting. The regression verifies settlement allows the next message through; existing failure, handback, and Resume tests pass. The change is platform-independent and keeps existing chat scope keys for local, remote, and folder workspaces. It changes no stored schema or wire contract. A plain revert backs it out.
Review
Self-reviewed the shared claim, remount lifetime, manual dispatch, and queue settlement paths. Native-device and rendered navigation testing were not performed.
Agent skill upstream boundary
Checklist