Skip to content

Add result-focused agent notification mode - #19887

Closed
hbjk1030-cmyk wants to merge 1 commit into
stablyai:mainfrom
hbjk1030-cmyk:feat/result-focused-agent-notifications
Closed

hbjk1030-cmyk wants to merge 1 commit into
stablyai:mainfrom
hbjk1030-cmyk:feat/result-focused-agent-notifications

Conversation

@hbjk1030-cmyk

@hbjk1030-cmyk hbjk1030-cmyk commented Sep 10, 2026 •

Copy link
Copy Markdown

ELI5

Orca can keep showing every agent step in Activity while only asking for attention when there is a useful result, a question or approval request, or a failure.

What Changed

  • Added an Agent notification mode setting with legacy All completions and attention and opt-in Results and action required choices.
  • Added one shared structured intent classifier for progress, result, action-required, and failure states.
  • Applied the policy before Activity unread state and before renderer, main-process, tray, sound, native desktop, and mobile delivery side effects.
  • Preserved terminal bell, test notifications, manual Mark Unread, and legacy behavior when the new setting is absent.
  • Stored intent with agent history so old progress rows remain visible without becoming attention events.
  • Added documentation, search metadata, localization catalog entries, unit/integration coverage, and settings E2E coverage.

Why

Intermediate shell commands, searches, test runs, and waiting transitions are useful history, but they should not interrupt users who only want results or situations requiring action. A structured policy keeps those rows visible while consistently suppressing their attention side effects without brittle message-text matching.

Linked Issue

Fixes #19880

Visual Proof

The screenshots use synthetic E2E settings state and contain no private task content.

Theme Before After
Light Before, light theme After, light theme
Dark Before, dark theme After, dark theme

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • pnpm lint: pass

  • pnpm typecheck: pass

  • pnpm build: pass on macOS

  • Focused notification suite: 94/94 pass across 8 files

  • Notification settings Electron E2E: 1/1 pass

  • Full Vitest suite: 77,878 pass, 388 skip, 5 fail. The same five failures reproduce unchanged on the baseline worktree and depend on the local shell / installed Claude CLI: one shell recipe cleanup assertion, two real Claude structured CLI expectations, one Claude trust prompt integration, and one installed Claude path expectation.

AI Disclosure

Implemented and reviewed with OpenAI Codex (GPT-5).

Review

  • Security: no new external input, credential, or filesystem boundary; persisted setting values are validated during normalization.
  • Cross-platform: policy logic is shared TypeScript with no platform-specific API. Production desktop, web, and macOS native builds pass.
  • Remote SSH: intent classification operates on existing normalized agent status and orchestration metadata, so local and remote activity use the same path.
  • Mobile: main-process fanout applies the same policy before mobile delivery; covered by a regression test.
  • Agent/integration compatibility: missing settings preserve legacy behavior, unknown or missing intent fails quiet only in the opt-in result-focused mode, and terminal bell/test notification behavior is unchanged.
  • Performance: constant-time classification over the existing bounded attention category list; Activity cache keys include the two new policy inputs.
  • UI: the setting follows the existing notification hierarchy, disables with its parent controls, persists across reload, and was checked in light and dark themes.

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

No new security, platform, remote SSH, or backward-compatibility issue found in self-review. The feature is opt-in; existing users retain the current notification behavior.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes
  • 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 (full test has five baseline-identical environment failures documented above; CI will provide a clean environment)

Author

X (Twitter): N/A

@hbjk1030-cmyk
hbjk1030-cmyk marked this pull request as ready for review September 10, 2026 11:45
@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

Adds the results-and-actions agent notification mode. Structured intent classification distinguishes progress, results, action requests, and failures. Progress events remain visible in Activity but do not mark workspaces unread or trigger desktop, tray, sound, or mobile delivery. Manual unread marking remains supported. The new setting is normalized, localized, searchable, documented, persisted, and covered by unit, integration, and end-to-end tests.

Severity of issue fixed: Medium

Merge Risk: 🔵 Low · up to 4ae61

The new mode control is visible but disabled until Agent Task Complete is enabled, which is a minor settings UX mismatch. Notification behavior is otherwise ready to merge with bounded follow-up.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 25 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 primary change: adding a result-focused agent notification mode.
Description check ✅ Passed The description covers the required sections, explains the change and rationale, links issue #19880, includes visual proof, documents testing and known baseline failures, and completes the relevant ch…
Linked Issues check ✅ Passed The implementation satisfies the coding objectives in issue #19880. It adds both notification modes, uses structured intent classification, preserves Activity visibility, filters progress side effects…
Out of Scope Changes check ✅ Passed The changes are within scope for issue #19880. Documentation, localization, search metadata, settings UI, persistence normalization, Activity behavior, delivery filtering, and related tests directly s…
Full details: Docstring Coverage

Explanation

Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 25 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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 73e93dfa-3cb1-4da3-b0f7-398119f23047

📥 Commits

Reviewing files that changed from the base of the PR and between f2d5711 and 4ae6183.

📒 Files selected for processing (27)
  • docs/site/content/docs/notifications.mdx
  • src/main/ipc/notifications-delivery-gating.test.ts
  • src/main/ipc/notifications-mobile-fanout.test.ts
  • src/main/ipc/notifications.ts
  • src/main/persistence/applying-settings/onboarding-normalization.test.ts
  • src/main/persistence/applying-settings/onboarding-normalization.ts
  • src/renderer/src/components/activity/activity-event-build-cache.ts
  • src/renderer/src/components/activity/activity-event-builder-sources.ts
  • src/renderer/src/components/activity/activity-event-builder.live-cap.test.ts
  • src/renderer/src/components/activity/activity-event-builder.ts
  • src/renderer/src/components/activity/activity-pane-events.ts
  • src/renderer/src/components/activity/use-agent-pane-threads.ts
  • src/renderer/src/components/settings/AgentNotificationModeSetting.tsx
  • src/renderer/src/components/settings/NotificationsPane.test.tsx
  • src/renderer/src/components/settings/NotificationsPane.tsx
  • src/renderer/src/components/settings/notifications-search.ts
  • src/renderer/src/components/terminal-pane/use-notification-dispatch.test.ts
  • src/renderer/src/components/terminal-pane/use-notification-dispatch.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/store/slices/agent-status-batch.test.ts
  • src/renderer/src/store/slices/agent-status-live-entry-builder.ts
  • src/shared/agent-notification-policy.test.ts
  • src/shared/agent-notification-policy.ts
  • src/shared/agent-status-types.ts
  • src/shared/constants.ts
  • src/shared/notification-settings-types.ts
  • tests/e2e/notification-settings.spec.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

}
/>

<AgentNotificationModeSetting

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Render the mode setting only when agent task notifications are enabled.

AgentNotificationModeSetting is visible when agentTaskComplete is false. The required behavior is to reveal this setting after the user enables Agent Task Complete. Wrap this component in an agentTaskComplete condition.

Proposed fix
-      <AgentNotificationModeSetting
-        value={notificationSettings.agentNotificationMode ?? 'all'}
-        disabled={!notificationSettings.enabled || !notificationSettings.agentTaskComplete}
-        onChange={(agentNotificationMode) =>
-          void updateNotificationSettings({ agentNotificationMode })
-        }
-      />
+      {notificationSettings.agentTaskComplete ? (
+        <AgentNotificationModeSetting
+          value={notificationSettings.agentNotificationMode ?? 'all'}
+          disabled={!notificationSettings.enabled}
+          onChange={(agentNotificationMode) =>
+            void updateNotificationSettings({ agentNotificationMode })
+          }
+        />
+      ) : null}

@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.

Important

The classifier has no signal for an agent that crashes (or exits without emitting done), so crashes are classified as progress and silently suppressed in the new opt-in mode — the mode misses the exact "failure" it promises to surface.

Reviewed changes

  • New shared policy — classifyAgentNotificationIntent and shouldSurfaceAgentNotification in src/shared/agent-notification-policy.ts, plus an optional agentNotificationMode setting ('all' | 'results-and-actions') defaulting to 'all'.
  • Policy applied at every delivery surface — before Activity unread state, renderer dispatch, and main-process tray/native/mobile delivery, while preserving terminal bell, test notifications, and manual Mark Unread.
  • Intent persisted on history — notificationIntent captured on AgentStateHistoryEntry at transition time so past rows keep classifying correctly after live fields are cleared.
  • Settings UI, i18n, docs, and tests — new AgentNotificationModeSetting select, search metadata, en.json entries, docs, and unit/integration/E2E coverage.

The classification logic is clean and well-tested, and the policy is applied consistently across the renderer and main-process boundaries with correct cache-key invalidation and a safe legacy fallback when the setting is absent. One gap is flagged inline.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

}
const agentNotificationIntent =
event.source === 'agent-task-complete'
? classifyAgentNotificationIntent(agentStatus)

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.

An agent that crashes (or exits without emitting done) is classified as progress and silently suppressed in result-focused mode. When agentCompletionSource === 'process-exit' and the stored status is still working, agentStatus is forced to undefined, so classifyAgentNotificationIntent returns progress and this early return drops the OS notification, sound, and markWorktreeUnread. The most common real failure for a non-orchestrated agent therefore produces zero attention in a mode whose purpose is to surface failures.

Technical details
# Process-exit completions are classified `progress`, not `failure`

## Affected sites
- src/renderer/src/components/terminal-pane/use-notification-dispatch.ts:112 — `agentStatus` is forced to `undefined` for `process-exit` when the stored status isn't `done`
- src/renderer/src/components/terminal-pane/use-notification-dispatch.ts:127 — `classifyAgentNotificationIntent(undefined)` returns `progress`
- src/shared/agent-notification-policy.ts:41 — `!entry` (and a non-orchestrated `working`) falls through to `progress`

## Required outcome
- A confirmed process exit with no `done` hook should surface in result-focused mode (as `failure`), or at minimum not be silently dropped when the stored entry's `orchestration.dispatchStatus === 'failed'`.

## Suggested approach (optional)
- In `dispatchTerminalNotification`, when `agentCompletionSource === 'process-exit'` and there is no `done` snapshot, classify from `freshStoredAgentStatus` (which carries `orchestration.dispatchStatus`) instead of `undefined`; and/or add a process-exit-without-`done` branch to `classifyAgentNotificationIntent` returning `failure`.

## Open questions for the human (optional)
- Is a process-exit with no `done` always a failure, or can it be a benign clean exit with a missed hook? If the latter, should it be `failure` only when `orchestration.dispatchStatus === 'failed'`?

@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thank you @hbjk1030-cmyk. A result-focused mode is what we were after too. We shipped it as defaults plus one switch: #36941 adds a separate Agent Needs Input toggle and a phone "Only when an agent needs me" preference, and #36992 stops progress-only turns from announcing "finished". Closing this as superseded.

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.

[Feature]: Add a result-focused agent notification mode

2 participants