Rust: subagent lifecycle hooks are logged as unknown

Author: hackberry-labCreated Sep 27, 2026Updated Sep 27, 2026

Bug

When Rust SDK hooks are enabled and the Copilot CLI starts or stops a task sub-agent, the CLI sends hooks.invoke requests with hookType values subagentStart and subagentStop. The Rust SDK logs both as unknown:

unknown hook type hook_type="subagentStart"
unknown hook type hook_type="subagentStop"

The generated HookType enum already declares both values, but rust/src/hooks.rs::dispatch_hook does not match them. The public SessionHooks API also has no dedicated callbacks for these lifecycle hooks.

Reproduction

  1. Create a Rust SDK session with hooks enabled.
  2. Invoke the built-in task tool so a sub-agent starts and completes.
  3. Observe the warnings from github_copilot_sdk::hooks.

Expected behavior

The SDK recognizes these valid callback-only lifecycle hook names and returns the standard empty output when no public callback is registered. Truly unknown hook names must continue to use the warning path.

Proposed fix

Handle subagentStart and subagentStop as pass-through hooks in dispatch_hook, with a focused unit test covering both names.