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(bots): let paired desktops read bot handoff outcomes - #49960
When a bot chat is opened from a paired desktop and that bot hands work to another bot, the handoff card kept spinning even after the other bot had replied. The computer running the bots refused to tell a paired desktop how the handoff ended, and the card treats a refused read as "still pending". It now answers a person's paired desktop the same way it answers the host's own windows and paired phones.
What Changed
Before:bots.request.outcome threw invalid_argument ("Bot requests are read on the computer that runs the bots.") for every paired caller that was not a phone. On a paired desktop the handoff card never got an outcome, so it kept the pending spinner, including after reopening the chat.
After: the handler refuses only an agent calling over a device pairing (caller.kind === 'paired-device' && caller.agent). People's paired desktops and phones get the outcome, answer and mail ids, exactly as they already read the sending chat itself. The host's own windows and local CLI keep their access. The onClient path is unchanged.
Mechanism: the gate now keys off the caller identity (person vs agent) instead of the pairing scope (phone vs computer). src/main/runtime/rpc/methods/bots-request-outcome.ts, with a regression test in bots-request-outcome.test.ts.
Why
The outcome is the sending chat's own mail, and a paired desktop can already read that chat in full, so hiding the outcome from it protected nothing. It only left the card stuck. Changing the server-side gate fixes the bug for current desktops without a new client capability, new params or a renderer change, so an older paired desktop talking to an updated host is fixed too. The alternative from #49960 (scoped card lookups plus a new capability and renderer polling) was much more code for the same result.
N/A. This is a host-side RPC permission fix and the card UI is unchanged; the only visible effect is that the existing spinner resolves. A live paired-desktop-to-server capture needs two paired Orca installs and was not recorded. The before/after evidence is the regression test below, which fails on main with the exact invalid_argument error from the issue and passes on this branch.
Testing
Repro (unit level): bots-request-outcome.test.ts calls the handler as a paired desktop (runtime-paired scope), a paired phone, the host desktop and the local CLI. On main the paired desktop case throws InvalidArgumentError: Bot requests are read on the computer that runs the bots.; on this branch all four return { outcome: 'answered', answer: 'Done.', mailIds: ['msg_2'] }. An agent over a device pairing is still refused.
oxlint (anti-slop, code-quality native plugins), ast-grep, oxfmt and the changed-code quality gate pass on the changed files.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None. The guard went from one constant-time check to another (both measured in the tens of nanoseconds per call, within noise of each other). A paired desktop now runs the same three indexed SQLite reads the host's own windows already run for this card. The card already rereads only when the bot's chat activity changes. There is no new polling, subprocess or sync file I/O.
Risk
Level: Low. The riskiest part is widening who may read a bot request outcome: paired desktops (people, not agents) can now read it. They could already read the sending chat that contains the same answer. Agents over a pairing are still refused. An updated desktop paired to an older host still sees the spinner until the host updates. To back out, revert the commit; no data or settings change.
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Security: only agent callers over a device pairing stay blocked; people keep the same view of the chat they already have. Cross-platform, SSH and mobile: no platform or path code; the mobile path behaves as before.
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)
I stated the risk: what could break, for whom, and how to back it out
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)
The outcome handler now rejects paired-device callers when their agent value is truthy. Other callers continue to the existing outcome lookup, while client requests retain the existing client outcome path. Tests cover paired desktop, paired phone, desktop, local CLI, and paired-device agent callers.
Severity of issue fixed: Medium
Merge Risk: Moderate · up to 7606f
Paired desktops can now read bot handoff outcomes, but the host does not appear to confirm the handoff belongs to the requesting chat, card, or workspace. A paired desktop that supplies another handoff's ID could read its answer. Add the per-handoff ownership check and a test that rejects unrelated handoffs before merging.
Pre-merge checks: 3 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Linked Issues check
[#49937] requires that a paired desktop sending chat read its own handoff outcome, so the card shows the recorded reply. At head 7606fda, bots-request-outcome.ts removes the rule that rejected paired…
Provide evidence for the following: (1) the BotRequestOutcomeParams schema at head and any sendingCard or sender binding, (2) whether a non-agent paired-device caller can read answer text for a messageId that is not its own sending card, an…
Passed checks: 3 passed
Check name
Status
Explanation
Out of Scope Changes check
The reviewed handler hunk changes only the bots.request.outcome authorization branch and the paired-device error message. It reads the same outcome path that #49937 names. No unrelated change was foun…
Title check
The title "fix(bots): let paired desktops read bot handoff outcomes" matches the main change. The raw summary and PR description both say the handler now lets paired desktops read bot request outcomes…
Description check
The description follows the repository template closely. It covers ELI5, What Changed (before and after, plus mechanism), Why (including alternatives considered), Linked Issue (Fixes #49937), Visual P…
Full details: Out of Scope Changes check
Explanation
The reviewed handler hunk changes only the bots.request.outcome authorization branch and the paired-device error message. It reads the same outcome path that #49937 names. No unrelated change was found in the inspected hunks. The raw summary lists the test file as covering paired desktop, paired phone, desktop, CLI, and agent-denied cases, which supports the same path. Other files in the whole-PR diff were not inspected, so this result covers only the inspected hunks.
Full details: Title check
Explanation
The title "fix(bots): let paired desktops read bot handoff outcomes" matches the main change. The raw summary and PR description both say the handler now lets paired desktops read bot request outcomes, while agents over device pairings stay blocked. The title is specific, short, and follows a conventional commit style.
Full details: Description check
Explanation
The description follows the repository template closely. It covers ELI5, What Changed (before and after, plus mechanism), Why (including alternatives considered), Linked Issue (Fixes #49937), Visual Proof (N/A with reason), Testing with a regression test description, Performance with a reason, Risk with level and rollback, AI Disclosure, the upstream boundary checkbox, and the checklist. The AI Disclosure section is left empty, which is acceptable for an internal contributor. The Review and Notes sections are present. Overall the description is complete.
Full details: Linked Issues check
Explanation
[#49937] requires that a paired desktop sending chat read its own handoff outcome, so the card shows the recorded reply. At head 7606fda, bots-request-outcome.ts removes the rule that rejected paired-device callers unless callerScope.kind was mobile. Only paired-device callers with a truthy agent value are now rejected. Non-agent paired desktops reach the existing getBotRequest and getMessageById lookup. This addresses the reported invalid_argument path. However, the handler does not bind the read to the sending card or sending session. It takes only messageId and onClient, and it returns answer and mailIds for any bot request. The PR description states that the host checks the card, sender, and workspace. The earlier sendingCard path described in the previous assessment does not appear in this file's diff against the merge base. The issue also limits scope to the sender's own outcome and excludes reply contents. Other gating may exist in the params schema, the method permission ('workspace'), or the renderer. I could not inspect those in the available checks. NativeChatBotRequestCard.tsx returned an empty diff, so the renderer routing claimed earlier cannot be confirmed here. The regression test was not run.
Resolution
Provide evidence for the following: (1) the BotRequestOutcomeParams schema at head and any sendingCard or sender binding, (2) whether a non-agent paired-device caller can read answer text for a messageId that is not its own sending card, and (3) the renderer change that sends the sending session and card identifiers, including the path where it lives. If the handler lacks the card, sender, and workspace checks, add them before the paired read returns status or answer.
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.
A bot chat opened from a paired desktop kept showing a pending spinner on
a handoff card after the receiving bot had replied. bots.request.outcome
refused every paired non-mobile caller with invalid_argument, and the card
treats a failed read as still pending.
The handler now refuses only agents calling over a device pairing. People's
paired desktops and phones read the outcome the same way they already read
that chat, and the host's own windows and CLI keep their access.
Fixesstablyai#49937
Co-authored-by: Daniel Lafraia <[email protected]>
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Major · Security & Privacy · Heavy lift
Limit paired-desktop handoff reads to the sender's own handoff.
The new guard admits a paired desktop that is not an agent. The handler then looks up the supplied messageId and returns the answer body, mail IDs, and chat ID. The lookup does not check that the handoff belongs to the calling sending session, saved card, or workspace. The workspace permission admits the method for paired desktops, and the store query matches message_id alone. A paired desktop that supplies another sender's messageId can therefore read that handoff's answer.
The linked issue limits this read to the sender's own handoff, and the PR states that unrelated cards are rejected. The current code does not enforce either limit. The test double also returns a record for any identifier, so it does not cover rejection of an unrelated handoff.
For a paired desktop request, the host must confirm that the handoff belongs to the calling sending session, card, and workspace before it returns any reading. It must reject any other handoff. Keep the existing owner and phone read behavior unchanged.
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
When a bot chat is opened from a paired desktop and that bot hands work to another bot, the handoff card kept spinning even after the other bot had replied. The computer running the bots refused to tell a paired desktop how the handoff ended, and the card treats a refused read as "still pending". It now answers a person's paired desktop the same way it answers the host's own windows and paired phones.
What Changed
bots.request.outcomethrewinvalid_argument("Bot requests are read on the computer that runs the bots.") for every paired caller that was not a phone. On a paired desktop the handoff card never got an outcome, so it kept the pending spinner, including after reopening the chat.caller.kind === 'paired-device' && caller.agent). People's paired desktops and phones get the outcome, answer and mail ids, exactly as they already read the sending chat itself. The host's own windows and local CLI keep their access. TheonClientpath is unchanged.src/main/runtime/rpc/methods/bots-request-outcome.ts, with a regression test inbots-request-outcome.test.ts.Why
The outcome is the sending chat's own mail, and a paired desktop can already read that chat in full, so hiding the outcome from it protected nothing. It only left the card stuck. Changing the server-side gate fixes the bug for current desktops without a new client capability, new params or a renderer change, so an older paired desktop talking to an updated host is fixed too. The alternative from #49960 (scoped card lookups plus a new capability and renderer polling) was much more code for the same result.
Linked Issue
Fixes #49937
Original fix by @lafraia in #49960; final version reworked during the bug bash.
Reported by @lafraia
Visual Proof
N/A. This is a host-side RPC permission fix and the card UI is unchanged; the only visible effect is that the existing spinner resolves. A live paired-desktop-to-server capture needs two paired Orca installs and was not recorded. The before/after evidence is the regression test below, which fails on
mainwith the exactinvalid_argumenterror from the issue and passes on this branch.Testing
Repro (unit level):
bots-request-outcome.test.tscalls the handler as a paired desktop (runtime-pairedscope), a paired phone, the host desktop and the local CLI. Onmainthe paired desktop case throwsInvalidArgumentError: Bot requests are read on the computer that runs the bots.; on this branch all four return{ outcome: 'answered', answer: 'Done.', mailIds: ['msg_2'] }. An agent over a device pairing is still refused.pnpm exec vitest run src/main/runtime/rpc/methods/bots-request-outcome.test.ts src/main/runtime/rpc/methods/orchestration/federation/paired-server-asks.test.ts: 2 files, 29 tests pass (macOS).oxlint (anti-slop, code-quality native plugins), ast-grep, oxfmt and the changed-code quality gate pass on the changed files.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None. The guard went from one constant-time check to another (both measured in the tens of nanoseconds per call, within noise of each other). A paired desktop now runs the same three indexed SQLite reads the host's own windows already run for this card. The card already rereads only when the bot's chat activity changes. There is no new polling, subprocess or sync file I/O.
Risk
Level: Low. The riskiest part is widening who may read a bot request outcome: paired desktops (people, not agents) can now read it. They could already read the sending chat that contains the same answer. Agents over a pairing are still refused. An updated desktop paired to an older host still sees the spinner until the host updates. To back out, revert the commit; no data or settings change.
Agent skill upstream boundary
Notes
Security: only agent callers over a device pairing stay blocked; people keep the same view of the chat they already have. Cross-platform, SSH and mobile: no platform or path code; the mobile path behaves as before.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)