test(review): pin the tool-subagent plugin fiber's lifecycle ownership; doc nits
Codex round-2 findings: - A committed test now proves the REAL plugin fiber (not a direct apply) owns the provider-lifecycle listeners: disposing a mounted tool's fiber unmounts the tool and leaves the provider intact, and a fiber disposed while WAITING never zombie-mounts when its provider arrives later. - TODO(subagent-dup-toolname) records the invalid-config blast radius of two waiting fibers sharing a toolName (the duplicate throw propagates through subagent/provider-added and rolls back the provider). - CONTEXT.md drops its creation-history sentence; the RFC's acceptance checklist becomes present-tense shipped invariants (docs/AGENTS.md writing rules).
This commit is contained in:
@@ -213,6 +213,13 @@ export function apply(ctx: Context, config: Config): void {
|
||||
// Listeners first, then the presence check: both run synchronously, so no
|
||||
// registration can slip between them; the `disposeTool === undefined` guard
|
||||
// makes a same-tick added-event after a successful mount a no-op.
|
||||
// TODO(subagent-dup-toolname): two WAITING fibers configured with the same
|
||||
// toolName collide only when their provider finally arrives — the duplicate
|
||||
// tool-name throw then propagates through `subagent/provider-added` and
|
||||
// rolls back the PROVIDER registration, so an invalid config blasts the
|
||||
// backend's fiber instead of the misconfigured tool's. Config-time detection
|
||||
// would need a cross-fiber registry of intended tool names; revisit if a
|
||||
// real deployment ever hits it.
|
||||
ctx.on('subagent/provider-added', (provider) => {
|
||||
if (provider.name === config.provider && disposeTool === undefined) mount(provider)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user