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
A bot's Slack and Linear actions tell Orca Cloud whether the bot is acting for its owner. Orca decided "owner" from signals it can't actually verify: an account a paired device says it is signed in to, a chat's owner default even when someone else's device typed the message, and connector requests that carried no proof of which chat sent them. Owner attribution now follows only provenance Orca verified itself.
Files
Added
Deleted
Net
Test
9
$\color{#1a7f37}{\Huge{\mathbf{+}}}$787
$\color{#cf222e}{\Huge{\mathbf{−}}}$22
$\color{#1a7f37}{\Huge{\mathbf{+}}}$765
Prod
23
$\color{#1a7f37}{\Huge{\mathbf{+}}}$284
$\color{#cf222e}{\Huge{\mathbf{−}}}$83
$\color{#1a7f37}{\Huge{\mathbf{+}}}$201
What Changed
Declared device accounts never override a teammate's chat (STA-18011). Only a message sent at the host's own window makes a turn the owner's over whom its conversation acts for. A paired device whose declared account matches the host's still acts for the owner in the owner's own chats (Home Chat, chats the owner started), so the owner's phone and desktop keep working.
Devices Orca can't place as the owner never make a turn the owner's (STA-18013). This covers a message typed on a paired device on another account, an account Orca couldn't compare, or none, by a person or by an agent's CLI over that pairing. Such a turn no longer falls back to the chat's owner default. The denial carries to:
worker reports that read back to that turn;
bot requests that turn sends (whom it acts for, and "who asked": the receiving bot reads "someone Orca cannot name"; an owner's status, which asks for no work, no longer reads as asking beside it);
the Slack mirror's turn-end post when such a device opened the turn or typed a message the provider took into it. That includes a Codex turn/start that Codex steered into the turn already running: Orca now records that join, as it does for a steer.
Unverified connector requests never act for the owner (STA-18014).connector.act and connector.reply read the named chat's turn only when Orca verified the request came from that chat. Otherwise a post says none and a read sends no turnFor, as before fix(connector): a turn the owner typed acts for the owner in Slack actions #48431. The host's own delivery of a run's result is marked as host-internal and still reads the turn. connector.react now carries and verifies the calling chat's session like the other connector calls.
Why
#48431 made the owner-typed check accept a paired device's own: true, and started sending owner assertions on non-post verbs. That exposed three inputs nothing verifies:
the device's own account declaration;
the conversation default, for a device that failed the owner check;
connector requests that carry no session evidence.
Each fix fails closed at the single rule the attribution paths share (turnActsForOwner / botTurnFor), rather than at each caller. Checked against how comparable products handle this.
Known limit, kept on purpose: a device's declared account is still a claim. One that declares the owner's account is treated as the owner in the owner's own chats. That is a spoofing risk for a paired client that knows the owner's account id. Verified device-account proof is tracked in STA-18140.
Linked Issue
Fixes STA-18011, STA-18013, STA-18014. Follow-ups: STA-18140, STA-18141 (worker dispatch carries its dispatching turn's authority), STA-18142 (run-result attribution bound to the run's own turn), STA-18143 (reply by pane key vs session id).
Visual Proof
N/A: no UI change. This changes the attribution field Orca sends to Orca Cloud and the "who asked" text a receiving bot reads.
Testing
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
bot-request-asker.test.ts, real journal rows through readBotActingTurn:
a declared same-account device in a teammate's chat vs the owner's chat;
another-account, uncompared and unclaimed devices in Home Chat, owner chats, steered in and read back by a worker report;
paired vs local agent CLI;
request askers and "who asked" text through the receiver's firstMessageActsFor.
connector-act-turn-for.test.ts: connector.act read/post through the real botTurnFor (owner chat and teammate chat; verified, mismatched and unverified callers).
connectors/connector-turn-for-caller.test.ts: connector.reply by verified/mismatched/unverified caller, host-internal delivery, connector.react admission.
external-conversation-ended-turn.test.ts, external-conversation-turn-state.test.ts: both ended-turn readers, a consumed steer vs a send only scoped to the turn.
codex-structured-turn-start-join.test.ts: the real turn/start fallback, echoed into the running turn (join) vs a fresh turn.
Each new assertion was checked to fail with its fix reverted. pnpm typecheck:node and the CLI typecheck are clean.
Performance
None, because the added checks are linear scans over the few messages of one turn that Orca already reads (the same bounded journal window). The ended-turn reader reuses the answered-messages list it already builds. No new reads, polling or I/O.
Paired clients posting for a host bot chat without session evidence now say none.
A reaction from an older CLI omits the owner field.
Journal rows written by a paired agent's CLI now carry deviceId/own on the agent stamp. An older build refuses such rows as newer through the existing forward-compat fence, like any added field.
Back out with a plain revert.
Review
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
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
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)
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.
No actionable comments were generated in the recent review.
Walkthrough
The changes preserve paired-device identifiers and ownership claims in agent message metadata. Bot and ended-chat turn attribution now records when an unrecognized paired device contributed a message, and uses that information when determining owner attribution and request askers. Connector turn attribution distinguishes host calls from requests with verified session IDs. Codex dispatch correlation uses echoed turn IDs and registered running-turn IDs to classify starts as steers. Tests cover these attribution paths and orchestration compatibility evidence.
Merge Risk: Minimal · previous review 7167e
The change limits owner attribution to verified provenance and fixes steer classification for Codex dispatch joins. The two earlier open concerns are addressed at the current head, and no concrete merge-blocking risk remains. The reported tests and typechecks have not been independently re-run.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: owner attribution for bots now relies only on verified provenance. The changeset implements this across bot attribution, connector verification, and Codex turn joins. …
Description check
The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue (Fixes STA-18011, STA-18013, STA-18014), Visual Proof (N/A with reason), Testing, Performance (None, …
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 names the main change: owner attribution for bots now relies only on verified provenance. The changeset implements this across bot attribution, connector verification, and Codex turn joins. The title is specific and accurate, and the ticket references add context without obscuring the change.
Full details: Description check
Explanation
The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue (Fixes STA-18011, STA-18013, STA-18014), Visual Proof (N/A with reason), Testing, Performance (None, with reason), Risk (Medium, with rollback via plain revert), and the Checklist. The AI Disclosure section is left blank, which is acceptable for an internal contributor. The lint, typecheck, test, and build checkbox is unchecked, and the author notes that CI will cover it. The Linked Issue section cites ticket IDs, not GitHub issue numbers, so reviewers should confirm that these satisfy the linking requirement.
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.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Include the unrecognized-device contribution in the request-led… · bot-request-asker.ts:293-295
src/main/bots/bot-request-asker.ts:293-295 Minor · Data Integrity & Integration · Quick win
Include the unrecognized-device contribution in the request-led askedBy.
When a request-led turn has a message from a paired device Orca cannot place as the owner, the turn sets typedByAnother. The askedBy value still lists only the original request askers. The opener-led path records the same device as unknown, so the two paths disagree.
The stored askedBy is copied into the next outgoing request record and into the empty-reply retry claim. Those copies can name only the owner, even though askers and turnActsForOwner still apply the device veto correctly. Add the unknown contribution to askedBy when typedByAnother is set.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
Fixture field (external-conversation-ended-turn.test.ts): now dispatchState.
Request-led askedBy (bot-request-asker.ts, outside the diff range): when a paired device Orca can't place as the owner typed in a request-led turn, askedBy now adds someone Orca can't name, matching the opener-led path. A new test in bot-request-asker.test.ts covers a bot-request turn with such a device steered in. It fails without the fix.
For best results, initiate chat on the files or code changes.
Analysis chain
Script executed:
#!/bin/bashset -u
printf'%s\n''--- Checkout and reported commit ---'
git rev-parse --short HEAD
git show -s --format='%h %s' 5d8c65c7 2>&1||trueprintf'%s\n''--- Referenced file locations ---'
fd -a '^(external-conversation-ended-turn\.test\.ts|bot-request-asker\.ts|bot-request-asker\.test\.ts)$'.printf'%s\n''--- File outlines ---'forfin src/main/external-conversations/external-conversation-ended-turn.test.ts src/main/bots/bot-request-asker.ts src/main/bots/bot-request-asker.test.ts;doecho"--- $f ---"
ast-grep outline "$f" --items all 2>&1||truedoneprintf'%s\n''--- Relevant fixture, implementation, and test contexts ---'
rg -n -C 7 'dispatchState|typedByAnother|askedBy|request-led|request.led|steer|unknown' \
src/main/external-conversations/external-conversation-ended-turn.test.ts \
src/main/bots/bot-request-asker.ts \
src/main/bots/bot-request-asker.test.ts | head -n 700
Length of output: 45708
@AmethystLiang Thanks for the fixes. I checked commit 5d8c65c7: the fixture uses dispatchState, and the request-led path adds an unknown asker for the device. The new test covers that case.
I did not run the tests.
If you found this review helpful, would you consider giving us a shout-out on X?
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
…ate's chat (STA-18011)
A paired desktop's account is a plain claim. Matching the host's account
made a turn typed on it act for the owner even in a chat a teammate
started, so Slack actions said turnFor owner and Linear writes dropped the
"asked by" line. Only a send at the host's own window now overrides whom
the conversation acts for; the owner's devices keep acting for the owner in
the owner's own chats.
…urn the owner's (STA-18013)
A message typed on a paired device the host found on another account, or
couldn't compare, failed the owner-typing check but still read as the
owner's through Home Chat's or an owner-started chat's default. Its turn
then said turnFor owner on reads, searches and posts. Such a turn, and a
worker report that reads back to it, now never acts for the owner.
The same holds where that turn's authority travels: an agent's CLI over a
device's pairing keeps the device (and its own comparison) on its stamp; a
bot request the turn sends carries someone Orca can't name, both in whom it
acts for and in who asked (an owner's status, which asks for no work, no
longer reads as asking beside it); and the Slack mirror's turn-end post
says someone_else when such a device opened the turn or typed a message the
provider took into it, including a turn/start Codex steered into the turn
already running.
…r the owner (STA-18014)
connector.act and connector.reply read the named chat's turn whenever the
request carried no session evidence, as if it were the host's own call. A
paired client (whose session evidence the host refuses) could name a host
bot chat and get its owner assertion on reads, searches and posts. Only a
request Orca verified as that chat now reads its turn; one it verified as
none says none on a post and nothing on a read. The host's own delivery of
a run's result says so explicitly and still reads the turn.
connector.react now carries and verifies the calling chat's session like
the other connector calls, so a bot's own reaction keeps its attribution.
…nd item origins
Changes how `bot_requests.root_key` is computed for sends from three
kinds of turn that continue an earlier request instead of starting one.
Each is read only from records Orca wrote, never from message text:
- A group member's turn is keyed by the room line that started its
request (`group:<room>:<post>`), for every member on it: its own turn on
the post, an @mention hand-off, a peer's request.
- A turn only Orca's item mail woke (the owner's answer or comment on an
item), also when a worker's report woke the chat after it, keeps the
request the items it names were made for.
- A turn Orca's own continue opened keeps the request of the turn it
resumes. The continue is known by Orca's ids: the restart
continuation's note row, or the usage-limit continue's send id, which
carries the cut turn's tag.
The request's start (who, when, the owner's words) goes with the key, so
item origins on every bot agree. `send_key` (dedupe) is unchanged.
A room post's words become the request's text only when the owner typed
them: `bots.groups.send` stamps the post `typedByOwner` only when it came
from the host's own window, the rule chat messages use since stablyai#48774 (a
paired device's account is only its own claim). An automation's post, a
post from any paired device and lines saved before this change keep the
key with no words.
…8558) (#49548)
Index journal submissions lazily once per bot attribution read instead of running a linear find per candidate message (`O(U * J)` -> `O(J + U)` across `requestTurnAskedBy`, `typedByOwner`, and `leaveThreadRefusal`), and reuse `typedByAnother` from `readBotActingTurnWithin` so bot-request turns no longer run a duplicate `window.some(typedOnAnotherDevice)` pass.
Fixes STA-18558. Follow-up to #48774.
Separate follow-up: STA-18594.
…nd item origins
Changes how `bot_requests.root_key` is computed for sends from three
kinds of turn that continue an earlier request instead of starting one.
Each is read only from records Orca wrote, never from message text:
- A group member's turn is keyed by the room line that started its
request (`group:<room>:<post>`), for every member on it: its own turn on
the post, an @mention hand-off, a peer's request.
- A turn only Orca's item mail woke (the owner's answer or comment on an
item), also when a worker's report woke the chat after it, keeps the
request the items it names were made for.
- A turn Orca's own continue opened keeps the request of the turn it
resumes. The continue is known by Orca's ids: the restart
continuation's note row, or the usage-limit continue's send id, which
carries the cut turn's tag.
The request's start (who, when, the owner's words) goes with the key, so
item origins on every bot agree. `send_key` (dedupe) is unchanged.
A room post's words become the request's text only when the owner typed
them: `bots.groups.send` stamps the post `typedByOwner` only when it came
from the host's own window, the rule chat messages use since stablyai#48774 (a
paired device's account is only its own claim). An automation's post, a
post from any paired device and lines saved before this change keep the
key with no words.
…nd item origins
Changes how `bot_requests.root_key` is computed for sends from three
kinds of turn that continue an earlier request instead of starting one.
Each is read only from records Orca wrote, never from message text:
- A group member's turn is keyed by the room line that started its
request (`group:<room>:<post>`), for every member on it: its own turn on
the post, an @mention hand-off, a peer's request.
- A turn only Orca's item mail woke (the owner's answer or comment on an
item), also when a worker's report woke the chat after it, keeps the
request the items it names were made for.
- A turn Orca's own continue opened keeps the request of the turn it
resumes. The continue is known by Orca's ids: the restart
continuation's note row, or the usage-limit continue's send id, which
carries the cut turn's tag.
The request's start (who, when, the owner's words) goes with the key, so
item origins on every bot agree. `send_key` (dedupe) is unchanged.
A room post's words become the request's text only when the owner typed
them: `bots.groups.send` stamps the post `typedByOwner` only when it came
from the host's own window, the rule chat messages use since stablyai#48774 (a
paired device's account is only its own claim). An automation's post, a
post from any paired device and lines saved before this change keep the
key with no words.
…nd item origins
Changes how `bot_requests.root_key` is computed for sends from three
kinds of turn that continue an earlier request instead of starting one.
Each is read only from records Orca wrote, never from message text:
- A group member's turn is keyed by the room line that started its
request (`group:<room>:<post>`), for every member on it: its own turn on
the post, an @mention hand-off, a peer's request.
- A turn only Orca's item mail woke (the owner's answer or comment on an
item), also when a worker's report woke the chat after it, keeps the
request the items it names were made for.
- A turn Orca's own continue opened keeps the request of the turn it
resumes. The continue is known by Orca's ids: the restart
continuation's note row, or the usage-limit continue's send id, which
carries the cut turn's tag.
The request's start (who, when, the owner's words) goes with the key, so
item origins on every bot agree. `send_key` (dedupe) is unchanged.
A room post's words become the request's text only when the owner typed
them: `bots.groups.send` stamps the post `typedByOwner` only when it came
from the host's own window, the rule chat messages use since stablyai#48774 (a
paired device's account is only its own claim). An automation's post, a
post from any paired device and lines saved before this change keep the
key with no words.
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 bot's Slack and Linear actions tell Orca Cloud whether the bot is acting for its owner. Orca decided "owner" from signals it can't actually verify: an account a paired device says it is signed in to, a chat's owner default even when someone else's device typed the message, and connector requests that carried no proof of which chat sent them. Owner attribution now follows only provenance Orca verified itself.
What Changed
turn/startthat Codex steered into the turn already running: Orca now records that join, as it does for a steer.connector.actandconnector.replyread the named chat's turn only when Orca verified the request came from that chat. Otherwise a post saysnoneand a read sends noturnFor, as before fix(connector): a turn the owner typed acts for the owner in Slack actions #48431. The host's own delivery of a run's result is marked as host-internal and still reads the turn.connector.reactnow carries and verifies the calling chat's session like the other connector calls.Why
#48431 made the owner-typed check accept a paired device's
own: true, and started sending owner assertions on non-post verbs. That exposed three inputs nothing verifies:Each fix fails closed at the single rule the attribution paths share (
turnActsForOwner/botTurnFor), rather than at each caller. Checked against how comparable products handle this.Known limit, kept on purpose: a device's declared account is still a claim. One that declares the owner's account is treated as the owner in the owner's own chats. That is a spoofing risk for a paired client that knows the owner's account id. Verified device-account proof is tracked in STA-18140.
Linked Issue
Fixes STA-18011, STA-18013, STA-18014. Follow-ups: STA-18140, STA-18141 (worker dispatch carries its dispatching turn's authority), STA-18142 (run-result attribution bound to the run's own turn), STA-18143 (reply by pane key vs session id).
Visual Proof
N/A: no UI change. This changes the attribution field Orca sends to Orca Cloud and the "who asked" text a receiving bot reads.
Testing
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
bot-request-asker.test.ts, real journal rows throughreadBotActingTurn:firstMessageActsFor.connector-act-turn-for.test.ts:connector.actread/post through the realbotTurnFor(owner chat and teammate chat; verified, mismatched and unverified callers).connectors/connector-turn-for-caller.test.ts:connector.replyby verified/mismatched/unverified caller, host-internal delivery,connector.reactadmission.external-conversation-ended-turn.test.ts,external-conversation-turn-state.test.ts: both ended-turn readers, a consumed steer vs a send only scoped to the turn.codex-structured-turn-start-join.test.ts: the realturn/startfallback, echoed into the running turn (join) vs a fresh turn.rpc-caller-typed-by.test.ts: paired-agent stamping. CLIorchestration-compatibility-envelope.test.ts: react evidence locally, none remotely.Each new assertion was checked to fail with its fix reverted.
pnpm typecheck:nodeand the CLI typecheck are clean.Performance
None, because the added checks are linear scans over the few messages of one turn that Orca already reads (the same bounded journal window). The ended-turn reader reuses the answered-messages list it already builds. No new reads, polling or I/O.
Risk
Level: Medium
someone_else(reads are unchanged from before fix(connector): a turn the owner typed acts for the owner in Slack actions #48431).none.deviceId/ownon the agent stamp. An older build refuses such rows as newer through the existing forward-compat fence, like any added field.Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)