orca icon indicating copy to clipboard operation
orca copied to clipboard

[Bug]: Non turn-end notification spam

Open ryanmargono opened this issue 6 months ago • 8 comments

Operating system

macOS

Orca version

No response

Details

Getting notifications on non-terminal turn ends, causing too much noise and having to disable to feature. Ie, after tool calls or reasoning, I will get a notification. Should be the case (or a preference) where I am only notified on a terminal agent turn or if theres an issue.

ryanmargono avatar Jun 01 '26 08:06 ryanmargono

Also reproduces with Cursor CLI over SSH remote

I see the same noisy notification behavior, not only on local terminals.

Setup

  • Client: Windows, Orca 1.4.38.0
  • Worktree: SSH remote worktree → Ubuntu (not local host PTY)
  • Agent: cursor-agent / Cursor CLI running on the remote host over SSH

What I see

  • Notifications fire after intermediate steps (tool calls, reasoning, subagent/tool output), not only when the agent has fully finished a user-visible turn.
  • Enough noise that I had to turn notifications off, which defeats the purpose of long-running remote agents.

Expected

  • Notify on terminal turn end (agent done / waiting for input), or on error/blocker — same as described in the original report.
  • Ideally a preference: "notify only on terminal turn" vs "every hook/status event" (remote Cursor hooks may amplify this on SSH).

Notes

  • Remote hooks are installed under ~/.cursor/hooks.json on the SSH target (Orca's Cursor hook install path), so status events may be more granular over SSH than on a simple local PTY.
  • Happy to capture logs or a short screen recording if that helps triage SSH + Cursor CLI.

vthuan1889 avatar Jun 01 '26 12:06 vthuan1889

same here for codex cli running locally within orca. Frequent tool-use (bash etc.)/mid turn notifications.

Image

totally-tim avatar Jun 09 '26 14:06 totally-tim

I can reproduce this with Codex CLI running locally inside Orca on Windows.

This appears broader than PermissionRequest / waiting / blocked states. I am getting agent-task-complete desktop notifications while Codex is visibly still in a working turn and while the active tool is still running.

Setup:

  • OS: Windows
  • Agent: Codex CLI running locally inside Orca terminal
  • Worktree: local repo
  • Notification shown by Orca:
    • Title: danmaku_monitor / main - Codex finished
    • Body: Using Bash: npm run test:submit

Actual behavior:

While the Orca terminal still shows Codex as working, Orca emits a desktop notification saying Codex finished.

Visible terminal state at the same time:

  • Working (6m 59s · esc to interrupt)
  • command still associated with the turn: npm run test:submit
  • another observed case: Using Bash: node scripts/check-hook-registry.js

The local Orca hook status snapshot also showed the pane still in an intermediate working state, not a final turn completion:

  • hookEventName: PreToolUse
  • payload.state: working
  • agentType: codex
  • toolName: Bash
  • toolInput: npm run test:submit

Expected behavior:

Orca should not send a Codex finished / agent-task-complete notification until the Codex turn is actually complete, or until the agent is waiting for actionable user input.

Notes:

This is distinct from a separate terminal-bell notification path. I have also seen Bell in main / Attention requested, but the case described here is not a bell notification. It is the Codex finished completion notification firing mid-turn.

So this looks like a remaining false-positive completion detector case, likely around Bash/tool activity or terminal title/status transitions, not only waiting / blocked hook states.

mitsuksw avatar Jul 08 '26 07:07 mitsuksw

Same for me, Claude Code cli on windows.

hatton avatar Jul 12 '26 15:07 hatton

Repro status: has_repro (working→idle completion path is intentional + over-fires)

Verified on tree c3a9a5e8a6 + multi-user confirmations in-thread (Codex local, Claude Code, Cursor SSH).

agent-task-complete OS notifications are driven by working→idle title transitions (pty-connection.ts / parked-terminal-byte-watcher.ts / agent-task-complete-policy.ts), not by a strict “agent turn fully finished” signal. Unit coverage explicitly fires completion on intermediate working→idle edges:

pnpm exec vitest run --config config/vitest.config.ts \
  src/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.test.ts \
  -t "working→idle"

Agents that flip title/status to idle between tool calls (or during reasoning) therefore spam desktop notifications. There is a global kill-switch (notifications.agentTaskComplete) but no “only final turn / only when blocked” preference as requested.

Re-run

rg -n "agent-task-complete|isAgentTaskCompleteOsNotificationEnabledFromState" \
  src/renderer/src/components/terminal-pane/agent-task-complete-policy.ts \
  src/renderer/src/components/terminal-pane/pty-connection.ts

nwparker avatar Jul 27 '26 04:07 nwparker

Complementary root cause for the wording, which I don't think is captured yet — separate from the over-firing path in the triage above.

nwparker's analysis explains why agent-task-complete fires mid-turn (working→idle title transitions). This is why the notification that fires says "finished" rather than "working", and it's an independent one-line fix.

The status vocabulary doesn't match between the two layers

Orca's hook ingest records state: "working" for PostToolUse. From ~/.config/orca/agent-hooks/last-status.json while an agent was mid-turn:

PostToolUse   state=working   toolName=Bash   worktree=<redacted>
SubagentStop  state=done      toolName=Bash   worktree=<redacted>

But the notification title builder (buildAgentTaskCompleteNotificationOptions, in the shipped 1.4.173 bundle) only branches on two states and defaults everything else to "finished":

const statusText =
  args.agentState === "blocked" || args.agentState === "waiting" ? "needs input"
  : args.agentState === "done" && args.agentInterrupted ? "stopped"
  : "finished";

"working" matches neither guard, so it falls through to the default. It isn't in the state vocabulary that layer knows either — the quoted state literals elsewhere in the bundle are idle / running / busy / done / blocked / waiting, with no working.

Why the body reads Using <tool>

That's the several Using B… screenshots in this thread. buildAgentTaskCompleteRichBody prefers lastAssistantMessage, which is empty mid-turn, so it falls back to:

if (toolName && toolInput) return `Using ${toolName}: ${toolInput}`;

And hasAgentNotificationSnapshot returns true when any of agentType / agentState / agentPrompt / agentToolName / agentToolInput / … is set — agentToolName alone is enough — so a mid-tool-call notification takes the rich path rather than the fallback one.

Net result on every tool call: title <worktree> - Claude finished, body Using Bash: …, while the agent is demonstrably still working.

Worth fixing independently of the over-firing

Even once the working→idle over-fire is fixed, any notification dispatched in a non-terminal state will still be labelled "finished". Two defensive changes:

  1. Give statusText an explicit branch for working/running/busy (or invert the default so only state === "done" produces "finished").
  2. Reconcile the hook-ingest vocabulary (working) with the notification layer's (running/busy) — the mismatch is what makes the default branch reachable at all.

Environment: Orca 1.4.173, Linux, Claude Code 2.1.238. Happy to test a fix.

pumfleet avatar Aug 21 '26 14:08 pumfleet

Adding the mobile side of this, with measurements from a paired Android device (desktop 1.4.178-rc.2, mobile 0.0.47 debug) — I can reproduce the confluence of the two streams on the wire.

What I measured: driving the production dispatch path (notifications:dispatch with an agent snapshot, exactly what use-notification-dispatch.ts sends) for the same worktree a few seconds apart, the phone received:

frame type=notification title="main - Claude needs input"  source=agent-task-complete seq=6
frame type=notification title="main - Claude finished"     source=agent-task-complete seq=7

Both were posted as local notifications (channel orca-desktop) and both appear in the notification shade. So on mobile the over-firing and the wording problem compound: the phone renders every notification frame with no filtering (mobile/src/notifications/mobile-notifications.ts:263-283), and the only mobile control is a single all-or-nothing switch — "Agent notifications", pref orca:pushNotificationsEnabled (mobile/app/notifications.tsx:86), whose copy already promises both cases ("when an agent needs your input or finishes a task").

Mobile cannot self-serve a fix even with a local setting: the frame sent to the phone carries only type/source/title/body/worktreeId/notificationId (src/main/ipc/notifications.ts:139-146; asserted in notifications-mobile-fanout.test.ts). agentState is already available at that dispatch boundary and already drives the title wording (src/main/ipc/notification-options.ts:60-66), but it is not on the wire — so the phone cannot tell "needs input" from "finished" client-side. The 5s per-worktree cooldown applies to the mobile fanout too (notification-burst-cooldown.ts), which throttles bursts but not per-step prompts.

Suggestion for the mobile angle, whichever way the over-firing fix lands: include agentState in the mobile frame (a new optional field is the compatible route for mixed client/host versions), and/or split the mobile switch into "needs input" vs "task complete" — #14426 asks for the opposite emphasis (notify more on input-needed), which a per-source split would satisfy in both directions.

Android notification shade: "main - Claude finished" and "main - Claude needs input" both posted under the same agent-task-complete source

blade035 avatar Aug 31 '26 20:08 blade035

Same thing here on macOS, Orca 1.4.218 with Claude Code 2.1.287, plus a few Codex workers dispatched through orchestration.

For me it's mostly the Claude side. When Claude is coordinating workers, it keeps ending its turn to wait for a worker reply or a background task. Each of those turn ends plays the completion sound. A few seconds later it wakes up again, and I get another ping. From my point of view the session isn't done at all, it's just paused.

Out of curiosity I went through mobile-notification-dismissals.json. Out of ~780 Claude notifications, 141 came within 30 seconds of the previous one on the same pane, and 438 within two minutes. Codex workers barely show up (44 total), so the noise is coming almost entirely from the Claude coordinator panes.

I don't want to turn off completion notifications completely, because they're really useful when something actually finishes. Something like "only notify if the pane stays idle for N seconds", or a per-worktree mute, would fix it for me. #19880 sounds like the same idea.

tvl3rAn avatar Oct 02 '26 07:10 tvl3rAn