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
- Create a Rust SDK session with hooks enabled.
- Invoke the built-in
task tool so a sub-agent starts and completes.
- 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.
Bug
When Rust SDK hooks are enabled and the Copilot CLI starts or stops a task sub-agent, the CLI sends
hooks.invokerequests withhookTypevaluessubagentStartandsubagentStop. The Rust SDK logs both as unknown:The generated
HookTypeenum already declares both values, butrust/src/hooks.rs::dispatch_hookdoes not match them. The publicSessionHooksAPI also has no dedicated callbacks for these lifecycle hooks.Reproduction
tasktool so a sub-agent starts and completes.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
subagentStartandsubagentStopas pass-through hooks indispatch_hook, with a focused unit test covering both names.