Skip to content

[Bug]: Claude PermissionRequest hook dispatches "agent-task-complete" notification while agent is still waiting on user #5698

Description

@gaoshang212

Operating system

Windows

Orca version

1.4.77

Details

Short summary: Orca's managed Claude hook installs a PermissionRequest handler, which is normalized to the waiting state. The completion coordinator treats waiting as a completion signal and immediately dispatches an agent-task-complete system notification — even though the agent has not finished and is in fact waiting for the user to approve a tool call. Every time Claude requests permission for a Bash/Edit/etc. tool, the user sees a "task complete" toast/sound, while the agent is still mid-task.

What happened?

While Claude was in the middle of a multi-step task, I received repeated "task complete" notifications. The notifications fired at the exact moments Claude was about to call a tool that required permission. The agent was not done.

Root cause (verified against main @ 048fc8c):

  1. Orca auto-injects 7 events into ~/.claude/settings.json on every launch, including PermissionRequest — src/main/claude/hook-settings.ts:27-51. shouldInstallManagedHooks is hard-coded to true (src/main/startup/configure-process.ts:215-223), so the user cannot opt out without disabling agentStatusHooksEnabled entirely.
  2. normalizeClaudeEvent maps PermissionRequest → state: 'waiting' — src/shared/agent-hook-listener.ts:1939-1940.
  3. isCompletionHookState treats done | waiting | blocked as completion inputs — src/renderer/src/components/terminal-pane/agent-completion-coordinator.ts:45-47:
    function isCompletionHookState(state: ParsedAgentStatusPayload['state']): boolean {
      return state === 'done' || state === 'waiting' || state === 'blocked'
    }
  4. In observeHookStatus, only state === 'done' && workingStatusObserved goes through the 1.5 s HOOK_DONE_QUIET_MS debounce window (line 622). The waiting / blocked branch falls through to dispatchCompletion('hook', ...) immediately at lines 640-644 — no quiet window, no working → idle cross-check.
  5. That dispatch flows to agent-hook-completion-notifications.ts:153 → notifications:dispatch → new Notification(...).show().

So Claude requesting permission for a tool — a fundamentally mid-task signal — fires a "task complete" notification.

How can we reproduce it?

  1. Run Claude Code inside an Orca terminal pane, with default Orca settings (agentStatusHooksEnabled: true, agentTaskComplete notification source on).
  2. Give Claude a task that will require a Bash / file-edit / permission-prompted tool call (e.g. ask it to run npm install or edit a file outside the allow-list).
  3. When Claude requests permission for the tool, Orca fires an agent-task-complete system notification, while the agent is still working and merely waiting on user input.
  4. Approve and let Claude continue; another notification fires at the next permission prompt.

Suggested fix (minimal):

Either restrict isCompletionHookState to done only:

function isCompletionHookState(state: ParsedAgentStatusPayload['state']): boolean {
  return state === 'done'
}

…or route waiting / blocked through a distinct agent-attention-needed notification source with its own settings toggle (so the existing UI affordances for "needs attention" don't go away, but the user can disable the toast independently of "task complete").

Tests to add in agent-hook-completion-notifications.test.ts:

  • working → waiting does not dispatch agent-task-complete.
  • working → waiting → working → done dispatches exactly once on done.
  • working → blocked follows the chosen policy.

Open question: blocked semantics across non-Claude agents (Codex, Devin, OpenClaude, Hermes, Gemini, etc.) should be verified before flipping it off — the listener mappings live in src/shared/agent-hook-listener.ts. If blocked ever means "terminated", it should still surface as a completion-like event; if it means "waiting for user", it should be excluded just like waiting.

Related:

Activity

  1. added
    size/s
    on Jun 18, 2026
  2. added
    bug
    on Jun 25, 2026
  3. added a commit that references this issue on Jun 28, 2026
    211138e
  4. brennanb2025 commented on Jun 28, 2026

    @brennanb2025
    Contributor

    will be in next release, usually within 24 hours

  5. added a commit that references this issue on Jun 28, 2026
    4e7fa0d
  6. added theissue type on Jul 12, 2026
  7. added 2 commits that reference this issue on Oct 15, 2026
    017e4b1
    d632263
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugos:Windowssize/s

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions