Skip to content

fix(rust): accept subagent lifecycle hooks - #2783

Open
hackberry-lab wants to merge 2 commits into
github:mainfrom
hackberry-lab:fix/rust-subagent-lifecycle-hooks
Open

hackberry-lab wants to merge 2 commits into
github:mainfrom
hackberry-lab:fix/rust-subagent-lifecycle-hooks

Conversation

@hackberry-lab

Copy link
Copy Markdown

Summary

  • recognize subagentStart and subagentStop as valid callback-only lifecycle hooks in the Rust dispatcher
  • return the existing empty pass-through response without logging an unknown-hook warning
  • cover both recognized names and retain a negative classification check for unrelated hook names

The public SessionHooks API remains unchanged. Sub-agent lifecycle activity continues to be available through the session event stream; this change only prevents valid CLI callbacks from being misclassified as unknown.

Fixes #2781

Validation

  • cargo test --features test-support hooks::tests::dispatch_subagent_lifecycle_hooks_returns_empty -- --exact
  • cargo +nightly-2026-04-14 fmt --all -- --config-path .rustfmt.nightly.toml --check
  • cargo clippy --all-targets --no-default-features --features test-support,local-runtime,derive -- --no-deps -D warnings -D clippy::unwrap_used -D clippy::disallowed_macros -D clippy::await_holding_invalid_type
  • cargo test --no-default-features --features test-support,derive -- --test-threads=4 --nocapture
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --no-default-features --features local-runtime,derive

Treat subagentStart and subagentStop as recognized pass-through hooks so valid CLI lifecycle callbacks do not emit unknown-hook warnings. Add focused classification and dispatch coverage.\n\nRefs github#2781
@hackberry-lab
hackberry-lab requested a review from a team as a code owner September 27, 2026 19:01
Copilot AI balanced review requested due to automatic review settings September 27, 2026 19:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused change correctly avoids the unknown-hook path while preserving existing behavior for unrelated hooks.

Review effort: Balanced
Findings: None

What changed in this PR

Recognizes valid Rust subagent lifecycle callbacks without changing the public hooks API.

Changes:

  • Passes through subagentStart and subagentStop with empty output.
  • Tests both lifecycle names and an unrelated name.
File Description
rust/​src/​hooks.rs Adds lifecycle-hook classification, dispatch handling, and tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rust: subagent lifecycle hooks are logged as unknown

3 participants