Skip to content

Add durable per-message notification opt-out for orchestration send - #23424

Closed
JasonJarvan wants to merge 1 commit into
stablyai:mainfrom
JasonJarvan:JasonJarvan/ao-message-no-notify
Closed

JasonJarvan wants to merge 1 commit into
stablyai:mainfrom
JasonJarvan:JasonJarvan/ao-message-no-notify

Conversation

@JasonJarvan

Copy link
Copy Markdown

ELI5

An external agent transport can save a message in Orca's inbox without Orca also interrupting the recipient. The message remains available when the recipient explicitly checks its inbox.

What Changed

  • Add orchestration send --no-notify / RPC notify: false, backed by a durable message column (schema v43).
  • Exclude opted-out messages at the shared automatic notification selector used by PTY and structured sessions, including after restart, routing and send replay. Keep explicit reads and waiting checks working.
  • Preserve default notification behavior. Require orchestration.message-notify.v1 before the CLI sends an opt-out request, so older runtimes cannot silently ignore it.
  • Limit opt-out to point-to-point status / handoff mail hosted by the connected runtime. Reject groups, lifecycle messages and federated cross-runtime sends.

Why

A transport that both archives mail and directly presents its body otherwise causes a second native mailbox prompt. A per-message policy at the existing selection point avoids a global runtime switch and keeps external transport details out of Orca. This suppresses automatic prompts; callers still need processing deduplication because explicit inbox reads can return the archived message.

Linked Issue

Closes #23417. Related to #16822; this implements a per-message option rather than a per-run/global policy.

Screenshot / Demo

N/A — CLI, storage and runtime behavior only.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated

Linux automated validation:

  • Focused notification, DB, RPC and CLI suite: 8 files, 89 tests passed.
  • After test typing fixes: affected CLI/structured suites, 2 files, 23 tests passed.
  • Moved the PTY test into a focused file to satisfy max-lines; the extracted test passed and all pre-commit lint/format hooks passed.
  • Node and CLI typechecks passed.
  • Changed-code quality: zero new findings.
  • Generated RPC catalog, bundled skill guides and skill manifest checks passed. No live receiver prompts, runtime upgrade or UI launch was performed. Windows/macOS and SSH were not exercised locally; federation opt-out fails closed.

AI Disclosure

Implemented with Codex GPT-6 Astra; remaining coding fixes and independent review use Grok grok-4.7-build-fast at the contributor's request.

Review

Independent Grok spec and code-quality reviews both passed with no blocking findings. Reviews covered automatic delivery paths, durable migrations, explicit consumption, retries and compatibility.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

The external AO integration and runtime deployment wait for upstream acceptance.

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)
  • 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)

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

End-to-end implementation of a durable per-message notification opt-out; I read the full 24-file diff, traced both automatic delivery lanes, verified the migration/version-skew path, and ran the focused plus adjacent test suites locally.

  • Durable column — messages.notify INTEGER NOT NULL DEFAULT 1 CHECK(notify IN (0,1)) in create-core-tables-sql.ts, migrate-v43.ts, the v43 version-skew entry, and MessageInsert.notify; insertMessage writes 0 only for an explicit notify: false, so defaults and pre-migration rows keep automatic notification.
  • Selection filter — getUndeliveredUnreadMessages gains notify = 1, which is the batch selector shared by the PTY lane (deliverPendingMessages, mailbox-pointer-delivery) and the structured lane (structured-mailbox-pointer-delivery via selectOrchestrationPointerBatch). Explicit reads go through getUnreadMessages (unfiltered), and mailbox routing mutates only to_handle, so check, waiting checks, restart, routing, and receipt replay all preserve behavior.
  • RPC contract — SendParams.notify plus a superRefine that rejects anything other than point-to-point status/handoff; sendRemoteMessage and sendFederatedControlMail fail closed for federated targets before enqueuing a relay, so a silent message can never be attached to a cross-runtime relay.
  • CLI gate — --no-notify is a boolean flag; the handler validates the value and, only when opting out, requires orchestration.message-notify.v1 on status.get before issuing the send.
  • Docs and generated artifacts — CLI reference, command spec, skill guide, and the generated src/cli/bundled-skill-guides.ts are all in sync (the diff formatter marked the generated file as binary; it does contain the new section).

Notes: getUndeliveredUnreadMailboxHandles / hasUndeliveredDirectMessageForRun intentionally stay unfiltered because they drive restore and direct-to-run-mailbox routing, not notification. Focused tests (5 files / 43 tests) and adjacent mailbox/db suites (7 files / 73 tests) pass locally.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 7a254895-aac7-406e-b71b-b209a3f77dcb

📥 Commits

Reviewing files that changed from the base of the PR and between 27b823f and 96e031a.

📒 Files selected for processing (24)
  • docs/site/content/docs/cli/orchestration.mdx
  • skill-guides/orchestration/references/messaging-and-gates.md
  • src/cli/bundled-skill-guides.ts
  • src/cli/handlers/orchestration-send-no-notify.test.ts
  • src/cli/handlers/orchestration/message-send-handler.ts
  • src/cli/specs/orchestration.ts
  • src/main/runtime/orchestration-mailbox-silent-mail-notification.test.ts
  • src/main/runtime/orchestration/db/contract-constants.ts
  • src/main/runtime/orchestration/db/messages/message-inbox.ts
  • src/main/runtime/orchestration/db/messages/message-insert.ts
  • src/main/runtime/orchestration/db/messages/message-notify.test.ts
  • src/main/runtime/orchestration/db/schema/create-core-tables-sql.ts
  • src/main/runtime/orchestration/db/schema/migrate-v43.ts
  • src/main/runtime/orchestration/db/schema/migrate.ts
  • src/main/runtime/orchestration/orchestration-schema-version-skew.ts
  • src/main/runtime/orchestration/structured-mailbox-pointer-delivery.test.ts
  • src/main/runtime/orchestration/types.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/send-control-mail.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/send-no-notify.test.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/send-point-to-point.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/send-remote.ts
  • src/main/runtime/rpc/methods/orchestration/schemas.ts
  • src/shared/cli-argument-boundary.ts
  • src/shared/protocol-version.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The orchestration send --no-notify option stores a durable notification policy for supported point-to-point status and handoff messages. The CLI checks for the required runtime capability, and the RPC rejects unsupported message types and routes. The runtime excludes opted-out messages from automatic mailbox notifications while keeping them available through explicit reads. Database schema, migration, and regression tests cover persistence and delivery behavior.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 96e03

The notification opt-out is mergeable after normal checks; no unresolved issue is established by the supplied evidence.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 96e03

The opt-out is limited to local point-to-point status and handoff messages, and ordinary messages retain their existing notification behavior. Alternate mailbox consumption paths warrant compatibility review, but no material security bypass was established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The new choice affects presentation of messages in the connected runtime’s mailbox, not federated relay or group delivery: those routes reject notify=false.

Trust Boundaries and Controls

  • observed — The RPC schema constrains sender-supplied notify=false, and remote sends fail before relay enqueue. The CLI capability check is an additional compatibility control, not the sole RPC validation.

Resilience and Maintainability Implications

  • inferred — Persisting the choice and re-querying through the filtered automatic selector support suppression after restart and nudge replay. Separate role-mailbox and legacy retrieval paths leave the full presentation guarantee dependent on how their consumers are invoked.

Hardening Proposals

  • proposed — Establish whether role-mailbox and legacy recovery consumers can initiate automatic presentation; if so, apply the notification policy at those presentation boundaries without removing silent messages from explicit reads.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 21 files. (2 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: a durable per-message notification opt-out for orchestration send.
Description check ✅ Passed The description covers the required sections and explains the user-facing behavior, implementation, motivation, linked issue, testing, compatibility limits, and checklist status. It uses “Screenshot /…
Linked Issues check ✅ Passed Issue [#23417] coding requirements are met. SendParams validates notify: false for point-to-point status and handoff messages only. The CLI checks orchestration.message-notify.v1 before send…
Out of Scope Changes check ✅ Passed The changed files support issue [#23417]. They implement CLI and RPC validation, capability advertisement, durable schema storage and migration, automatic notification filtering, routing rejection, do…
Full details: Docstring Coverage

Explanation

Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 21 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@JasonJarvan

Copy link
Copy Markdown
Author

Closing this stale PR: it has heavily diverged from current main and I won't be rebasing it further. Keeping #23417 open for upstream tracking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support per-message durable notification opt-out for orchestration send

1 participant