Skip to content

[Feature]: Mark Orca's managed Claude Code status hooks async (or keep a user-set async) so status reporting does not block tool calls #26718

Closed

Description

@MitchellkellerLG

Problem or use case

Orca writes its Claude Code hooks into ~/.claude/settings.json as synchronous entries:

{
  "type": "command",
  "command": "<home>/.orca/agent-hooks/claude-hook.cmd",
  "timeout": 10
}

for PreToolUse, PostToolUse, Stop and the other events. Orca rewrites these entries when it starts, so a user who adds "async": true loses it on the next launch.

Claude Code waits for synchronous hooks before it continues. These hooks only report status to Orca, so nothing depends on their result, yet every tool call waits for them. On Windows each one is Git Bash (two bash.exe processes) -> cmd.exe -> curl.exe. On this machine the Orca shim measured about 590 ms per event through bash under load, and while Orca's main thread is blocked the curl waits up to its 1.5 s timeout. At about 1,000 Claude tool calls per hour, each with a pre and a post hook, that adds up to many minutes of waiting per hour for status reporting.

Proposed solution

Write the status hooks with "async": true (Claude Code then runs them without blocking), at least for PreToolUse and PostToolUse, or preserve a user-set async field when rewriting. Keep synchronous only the events where Orca must act before Claude continues, such as PermissionRequest, if any.

Alternatives or additional context

Claude Code also supports http hooks. Orca already runs a local HTTP endpoint, so an http hook would avoid the process chain entirely. Related: #18875 (closed; the PowerShell wrapper that used to sit in front of the same hook).

Activity

  1. localhedge commented on Oct 19, 2026

    @localhedge

    Adding measurements from a second Windows machine (Windows 11, Orca 1.4.222, Claude Code 2.1.303), in case they help.

    Cost in normal use. Over 19 days the Orca hook ran on about 83,000 Claude tool calls. Pre and post together took a median of 0.22 s per tool call, about 9.5 hours in total. For Read, Edit, Write and Grep the hooks took 4 to 30 times longer than the tool itself. The hook also gets slower when many agents are busy:

    other Orca hook runs within ±1 s median p90
    0 104 ms 377 ms
    6 to 10 112 ms 443 ms
    11 to 20 144 ms 753 ms
    more than 20 211 ms 908 ms

    async works, and Orca still gets the events. I added "async": true by hand to the managed PreToolUse and PostToolUse entries and ran claude -p in a fresh Orca pane making six true Bash calls. The median was 0.355 s per call with the synchronous hooks and 0.178 s with async. In a second run with sleep 4 calls, the pane's entry in last-status.json went from UserPromptSubmit to PreToolUse (Bash), then PostToolUse, then Stop with state done, as expected.

    Why a user cannot keep it. Reconcile drops the managed entries and appends fresh { type, command, timeout } objects, so the flag is gone after the next start or update. The status check compares only command, shell and args, so preserving a user-set async would not cause reinstall loops.

    What depends on these two events, from reading the 1.4.222 bundle: pane status (working, waiting on AskUserQuestion, back to working after a permission prompt), the Agents panel, notifications, stats and automation completion. Orchestration mailbox delivery and terminal wait --for tui-idle read the terminal title instead, so they should not be affected. The one risk I see is ordering: a late async PostToolUse that arrives after an AskUserQuestion PreToolUse could flip a waiting pane back to working.

    I have not tested 1.4.230's native claude-hook.exe (#27719). It should cut the process cost of each run, but the call still waits for Orca's HTTP reply, which is the part that grows under load.

  2. added a commit that references this issue on Oct 26, 2026
    79a6be4
  3. added a commit that references this issue on Oct 26, 2026
    1df8501
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions