fix(events): correct Claude and Codex subagent hooks - #194
Conversation
🦋 Changeset detectedLatest commit: 2404a00 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 078a1a055e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ' if (target === "codex") {', | ||
| ' if (input.transcript_path !== null && typeof input.transcript_path !== "string") fail("native transcript_path must be a string or null");', | ||
| ' } else {', | ||
| ' requireString(input, "transcript_path");', |
There was a problem hiding this comment.
Detect Codex before validating nullable transcript paths
For event routes compiled under the composite plugin target, the wrapper bakes target as "plugin", so this condition takes the Claude branch even when Codex invokes the shared wrapper. The pinned Codex input schemas explicitly allow transcript_path: null; a valid Codex subagent event with that value is therefore rejected before the route runs. Resolve the actual invoking host in composite event-route wrappers, as the universal native-hook wrapper already does.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0111033. Composite event-route wrappers now resolve the invoking host using the same explicit-host/PLUGIN_ROOT contract as universal wrappers before native validation. The artifact target remains plugin only for IPC endpoint identity. The new composite replay runs the Codex SubagentStart fixture with transcript_path: null and verifies it reaches the route as host codex.
| if (target === 'codex') { | ||
| throw new TypeError('agent/stop additional context is not supported by the Codex SubagentStop output schema.'); |
There was a problem hiding this comment.
Resolve the host before projecting SubagentStop context
When a unified plugin event route returns Agent.Context for agent/stop, its target remains "plugin", so this Codex guard is skipped and the fallback emits Claude's hookSpecificOutput.additionalContext. The pinned Codex SubagentStop output schema has additionalProperties: false and no hookSpecificOutput, so Codex receives invalid exit-0 JSON instead of the documented unsupported-effect error. Propagate the actual Claude/Codex runtime host into route projection.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0111033. The resolved Claude/Codex host is now propagated in the event-runtime request and standalone projection, while unresolved plugin projection fails closed. Regression coverage verifies Claude SubagentStop emits its supported hookSpecificOutput.additionalContext and the same composite route rejects that effect for Codex instead of emitting invalid JSON.
Replace the stale unavailable evidence with pinned native contracts and keep event projection honest about start/stop control semantics.
Keep the example's route-only tests in their registered pool and align provider and Workbench assertions with the landed semantic event route.
Resolve Claude and Codex invocations before validating or projecting shared plugin event routes so host-specific wire contracts remain intact.
0111033 to
2404a00
Compare
Summary
unavailableevidence for Claude Code and CodexSubagentStart/SubagentStophooks/hooks.jsonlocationTest plan
pnpm buildpnpm test:route-unitpnpm lintpnpm typecheckCloses the support-matrix evidence error tracked in #97.