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): stop Orca item mail from suggesting a reply that always fails - #50618
When someone answers or comments on a bot's item, Orca sends the bot a short mail about it. Orca itself sends that mail, from a sender called "Orca Items". The mail ended with a "here is how to reply" command, but Orca Items has no inbox, so that command failed every time. Now Orca's own item mail leaves the command out. Mail from real bots still shows it.
What Changed
Before: every current item mail from orca:items (answers, comments, status changes) ended with [Reply: orca orchestration reply --id msg_item_… --from … --body "..."]. Running it gave terminal_not_found: Terminal orca:items has no live pane or durable Run/Dispatch mailbox. No reply was sent.
After: that line is left out when the sender is orca:items. The subject, body, payload and any follow-up line stay the same. All other mail keeps its Reply line.
Mechanism: two separate formatters add the generic Reply line to any current mail that has no follow-up action. Both now check the sender:
formatMessageBannerWithContent in message-formatting.ts (the banner used for model delivery and host-formatted checks)
formatLegacyAwareCheckMessages in orchestration-check-output.ts (the CLI's raw-row fallback for orca orchestration check --full)
BOT_ITEM_MAIL_SENDER moved into a new module with no imports, src/shared/bots/bot-item-mail-sender.ts, so the shared CLI formatter does not pull in native-chat transcript code. All 8 importers now import it from there.
The compact check view prints Reply only for question mail. Item mail is status, so that view was never affected.
Why
A reply always goes back to the original sender. orca:items is Orca's reserved sender and has no pane or mailbox, so the reply RPC refuses it before writing anything. The guard checks the sender, not the msg_item_ id prefix, because bot-written item requests use the same prefix and can receive replies. Only Orca can send as orca:items: callerMailProvenance refuses it from callers, and federation rewrites it to unknown. So the check cannot be spoofed to hide a real reply line.
Alternative we rejected: have replyFollowUp return an "information" follow-up for orca:items. That line would tell the bot there is nothing to act on, which is wrong for an owner's answer. It also would not cover the CLI's raw-row fallback. Omitting the line is smaller and more accurate. The orca bot item comment path still covers the case where a bot wants to respond on the item.
N/A. This changes the text of mail that agents read. No UI changes. Before and after text from the regression tests:
Before (on main):
──── From: ORCA:ITEMS (orca:items) (status) ────
Subject: Review the sidebar change
Please look at the diff.
[Reply: orca orchestration reply --id msg_item_reply_fixture --from orca_session_id:11111111-1111-4111-8111-111111111111 --body "..."]
────────────────────────────────────────────────────────────
After: the same banner without the [Reply: …] line. Bot-sent mail with the same msg_item_ id still shows its Reply line.
Testing
On macOS:
Added two regression tests, one for each formatter: message-formatting.test.ts, and a new colocated orchestration-check-output.test.ts. Each test compares an orca:items row with a bot-session row that has the same msg_item_ id and type. The Orca row must have no Reply line, and the bot row must keep it, so a guard that is too broad also fails.
With the source files from main, both tests fail and print the Reply line. With this change they pass. A separate probe covered run:, dispatch:, orca_session_id: and terminal recipients. It failed on main and passes here.
Targeted vitest runs pass: orchestration-check-output, message-formatting, bot-group-mail-root, bots-items-self-echo-mail, bots-items-answer-attachments (5 files, 18 tests). Earlier runs on nearby suites also passed: the formatting and structured-mail directories, CLI orchestration messages, and agent-session message views.
Static checks on the 14 touched files are clean: oxlint, oxfmt, the anti-slop oxlint config, code-quality native plugins, ast-grep, and the changed-code quality gate.
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. Formatting runs once per mail, in main or the CLI. It is not a hot path, and the change adds a single string comparison. Benchmark, old → new, µs/op: banner (bot) 0.334 → 0.338, banner (item) 0.285 → 0.218, check (bot) 2.605 → 2.471, check (item) 2.348 → 2.294, 200 KB body banner 30.6 → 31.9, 200 KB body check 3154 → 2895. All within noise. No new I/O, polling or subprocess work.
Risk
Level: Low
If the sender check were too broad, a bot could lose a Reply line it can actually use. The bot-sender control in each test guards against that. Mail saved earlier with the old line still displays and parses correctly. An older host's formatted text still includes the line, but that is harmless because the refusal writes nothing. To back out, revert this commit.
Review
Check the sender guard in both formatters, and the bot-sender control row in each test.
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: the orca:items sender cannot be spoofed, as described in Why.
Cross-platform, SSH and mobile: this is a text-only change in shared formatters, with no platform-specific code. Mixed versions: an older CLI talking to a fixed host may still show the line in raw check --full. That is harmless.
Fix by @hjKim1597. The commits were squashed with authorship kept, and the follow-up review cleanup is credited as co-author.
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 change defines BOT_ITEM_MAIL_SENDER as the shared identifier for orca:items. Both the message banner formatter and orchestration-check output omit the generic reply instruction for mail from this sender. Tests verify that bot-session mail retains the instruction.
Severity of issue fixed: Medium
Merge Risk: Minimal · up to f9236
Item-update mail from the Orca items sender will no longer suggest a reply command that fails. Other senders keep the hint. Merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: Orca item mail from the orca:items sender no longer suggests a reply command, which always fails. The fix(bots) prefix and the 'stop ... suggesting a reply that always…
Description check
The description follows the repository template closely: ELI5, What Changed, Why, Linked Issue (Fixes #50613), Visual Proof (N/A with reason and reproduction text), Testing, Performance, Risk with lev…
Linked Issues check
[#50613] requires that item-update mail from orca:items omit the failing [Reply: ...] line, and that mail from real bots keep it. Both places named in the issue now check the sender. In message-format…
Out of Scope Changes check
The whole-PR diff for the two formatter files changes only the reply-line condition and adds the import needed for it. The subject, body, and payload paths are unchanged in the inspected hunks. The co…
Full details: Title check
Explanation
The title names the main change: Orca item mail from the orca:items sender no longer suggests a reply command, which always fails. The fix(bots) prefix and the 'stop ... suggesting a reply that always fails' wording match the changeset (sender guard in message-formatting.ts and orchestration-check-output.ts, plus the constant move). It is specific and descriptive, and it is 72 characters, within a typical limit.
Full details: Description check
Explanation
The description follows the repository template closely: ELI5, What Changed, Why, Linked Issue (Fixes #50613), Visual Proof (N/A with reason and reproduction text), Testing, Performance, Risk with level, AI Disclosure, Review, Agent skill boundary, Notes, and Checklist. It explains the before and after behavior, the mechanism in both formatters, the alternatives considered, and the rollback path. Minor gaps: the Linked Issue line is a maintainer-compatible reference but the PR is from a contributor context, the Testing section has a checked manual-testing box that is unchecked, and the final pnpm checklist item is unchecked, which the template allows when CI covers it.
Full details: Linked Issues check
Explanation
[#50613] requires that item-update mail from orca:items omit the failing [Reply: ...] line, and that mail from real bots keep it. Both places named in the issue now check the sender. In message-formatting.ts, the banner branch adds msg.from_handle !== BOT_ITEM_MAIL_SENDER to the authority === 'current' reply condition. In orchestration-check-output.ts, formatLegacyAwareCheckMessages adds the same check to the !legacyReadOnly reply branch. The guard keys on sender, so answers, comments, and status changes from orca:items are all covered. Bot senders keep the line. The constant file src/shared/bots/bot-item-mail-sender.ts exists at the reviewed head with value 'orca:items'. Limitation: the new test cases in message-formatting.test.ts and orchestration-check-output.test.ts were not read directly. Their results rest on the PR description and the change summary. The source guards were verified in the whole-PR diff against merge base b07e37b.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff for the two formatter files changes only the reply-line condition and adds the import needed for it. The subject, body, and payload paths are unchanged in the inspected hunks. The constant move to src/shared/bots/bot-item-mail-sender.ts, with re-export from bot-item-note-runs.ts, supports the CLI formatter guard. The summary lists importers that switch to the new module, and these are consistent with that move. Those importer edits and the test files were not read directly. They were assessed from the summary only. No unrelated functional change was found in the inspected hunks.
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.
Item mail is sent from Orca's reserved sender orca:items, which has no
pane or mailbox, so the [Reply: ...] hint on it always failed with
terminal_not_found. The mail banner and the CLI check --full fallback now
omit that hint when the sender is orca:items; mail from bots keeps it.
BOT_ITEM_MAIL_SENDER moves to the import-free bot-item-mail-sender module
so the shared CLI formatter does not pull in native-chat code.
Fixesstablyai#50613
Co-authored-by: Neil <[email protected]>
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Data Integrity & Integration · Quick win
Re-export BOT_ITEM_MAIL_SENDER from bot-item-note-runs.ts, as the PR description states, or update the description.
The PR description says the constant "remains re-exported for existing importers." This module no longer exports it. No repository file imports the constant through this path today, so nothing fails now. A future importer that uses this path will fail to compile. Add the re-export so the compatibility the PR describes holds.
Suggested fix
--- "a/src/shared/bots/bot-item-note-runs.ts"+++ "b/src/shared/bots/bot-item-note-runs.ts"@@ -7,7 +7,8 @@
import { isNativeChatOrcaCard } from '../native-chat/native-chat-orca-card'
import { nativeChatRowRendersContent } from '../native-chat/transcript/row-content/native-chat-row-content'
import { nativeChatRowRendersProse } from '../native-chat/transcript/folding/native-chat-trailing-run'
import { BOT_ITEM_MAIL_SENDER } from './bot-item-mail-sender'
+export { BOT_ITEM_MAIL_SENDER } from './bot-item-mail-sender'
import type { BotItemNoteItem, BotItemNoteView } from './bot-item-note'
/** Item mail ids: only Orca's item code mints one, as no send, ask or reply takes a caller's message id. */
Committable suggestion
IMPORTANT
Review the replacement and indentation, then test before committing.
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 someone answers or comments on a bot's item, Orca sends the bot a short mail about it. Orca itself sends that mail, from a sender called "Orca Items". The mail ended with a "here is how to reply" command, but Orca Items has no inbox, so that command failed every time. Now Orca's own item mail leaves the command out. Mail from real bots still shows it.
What Changed
orca:items(answers, comments, status changes) ended with[Reply: orca orchestration reply --id msg_item_… --from … --body "..."]. Running it gaveterminal_not_found: Terminal orca:items has no live pane or durable Run/Dispatch mailbox. No reply was sent.orca:items. The subject, body, payload and any follow-up line stay the same. All other mail keeps its Reply line.formatMessageBannerWithContentinmessage-formatting.ts(the banner used for model delivery and host-formatted checks)formatLegacyAwareCheckMessagesinorchestration-check-output.ts(the CLI's raw-row fallback fororca orchestration check --full)BOT_ITEM_MAIL_SENDERmoved into a new module with no imports,src/shared/bots/bot-item-mail-sender.ts, so the shared CLI formatter does not pull in native-chat transcript code. All 8 importers now import it from there.questionmail. Item mail isstatus, so that view was never affected.Why
A reply always goes back to the original sender.
orca:itemsis Orca's reserved sender and has no pane or mailbox, so the reply RPC refuses it before writing anything. The guard checks the sender, not themsg_item_id prefix, because bot-written item requests use the same prefix and can receive replies. Only Orca can send asorca:items:callerMailProvenancerefuses it from callers, and federation rewrites it tounknown. So the check cannot be spoofed to hide a real reply line.Alternative we rejected: have
replyFollowUpreturn an "information" follow-up fororca:items. That line would tell the bot there is nothing to act on, which is wrong for an owner's answer. It also would not cover the CLI's raw-row fallback. Omitting the line is smaller and more accurate. Theorca bot item commentpath still covers the case where a bot wants to respond on the item.Linked Issue
Fixes #50613
Visual Proof
N/A. This changes the text of mail that agents read. No UI changes. Before and after text from the regression tests:
Before (on
main):After: the same banner without the
[Reply: …]line. Bot-sent mail with the samemsg_item_id still shows its Reply line.Testing
On macOS:
Added two regression tests, one for each formatter:
message-formatting.test.ts, and a new colocatedorchestration-check-output.test.ts. Each test compares anorca:itemsrow with a bot-session row that has the samemsg_item_id and type. The Orca row must have no Reply line, and the bot row must keep it, so a guard that is too broad also fails.With the source files from
main, both tests fail and print the Reply line. With this change they pass. A separate probe coveredrun:,dispatch:,orca_session_id:and terminal recipients. It failed onmainand passes here.Targeted vitest runs pass:
orchestration-check-output,message-formatting,bot-group-mail-root,bots-items-self-echo-mail,bots-items-answer-attachments(5 files, 18 tests). Earlier runs on nearby suites also passed: the formatting and structured-mail directories, CLI orchestration messages, and agent-session message views.Static checks on the 14 touched files are clean: oxlint, oxfmt, the anti-slop oxlint config, code-quality native plugins, ast-grep, and the changed-code quality gate.
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. Formatting runs once per mail, in main or the CLI. It is not a hot path, and the change adds a single string comparison. Benchmark, old → new, µs/op: banner (bot) 0.334 → 0.338, banner (item) 0.285 → 0.218, check (bot) 2.605 → 2.471, check (item) 2.348 → 2.294, 200 KB body banner 30.6 → 31.9, 200 KB body check 3154 → 2895. All within noise. No new I/O, polling or subprocess work.
Risk
Level: Low
If the sender check were too broad, a bot could lose a Reply line it can actually use. The bot-sender control in each test guards against that. Mail saved earlier with the old line still displays and parses correctly. An older host's formatted text still includes the line, but that is harmless because the refusal writes nothing. To back out, revert this commit.
Review
Check the sender guard in both formatters, and the bot-sender control row in each test.
Agent skill upstream boundary
Notes
orca:itemssender cannot be spoofed, as described in Why.check --full. That is harmless.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)