Skip to content

fix(coding-agent): enforce parent extension policy for subagents - #141

Merged
Issacboy123 merged 1 commit into
mainfrom
fix/enforce-subagent-parent-policy
Aug 29, 2026
Merged

Issacboy123 merged 1 commit into
mainfrom
fix/enforce-subagent-parent-policy

Conversation

@Issacboy123

@Issacboy123 Issacboy123 commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Child sessions do not load parent extensions, so spawning a child could bypass execution-mutating hooks registered by the root session. This PR makes controller-bound spawning fail before child creation whenever the current parent extension runner contains an incompatible hook.

Reasoning

The root session remains the authority for extension policy, while the controller owns child admission. Passing a private callback between those boundaries lets every spawn inspect the current extension runner, including after reloads, without exposing runner internals or copying parent extensions into children. Checking both tool entry and controller admission prevents side effects before rejection while preserving unbound programmatic controllers and observation-only hooks.

Changes

  • Added deterministic detection for registered resources_discover, input, context, before_agent_start, before_provider_request, before_provider_headers, session_before_compact, tool_call, tool_result, and message_end hooks.
  • Rejected incompatible tool-driven spawns before argument validation, provenance capture, child session creation, reservation, persistence, or provider work.
  • Rechecked parent policy in bound controller spawning while leaving unbound controller spawning and non-spawn child actions unchanged.
  • Added focused coverage for every incompatible hook, ordered combinations, reload-time policy changes, observation-only hooks, side-effect prevention, and unbound controllers.
  • Documented the fail-closed spawning rule in the SDK and usage guides and recorded the fix in the changelog.

Testing

  • node ../../node_modules/vitest/dist/cli.js --run test/suite/subagent-registration.test.ts
  • node ../../node_modules/vitest/dist/cli.js --run test/suite/subagent-services.test.ts test/suite/subagent-registration.test.ts test/suite/subagent-coordination.test.ts test/suite/subagent-parent-messaging.test.ts test/subagent-controller.test.ts
  • npm run check

@Issacboy123 Issacboy123 self-assigned this Aug 28, 2026
@Issacboy123 Issacboy123 added bug Something isn't working coding-agent labels Aug 28, 2026
@Pepps233
Pepps233 self-requested a review August 28, 2026 15:34
@Issacboy123
Issacboy123 merged commit 33bd2b6 into main Aug 29, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working coding-agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants