Skip to content

Rust: subagent lifecycle hooks are logged as unknown #2781

Description

@hackberry-lab

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.

Activity

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