Skip to content

fix(events): correct Claude and Codex subagent hooks - #194

Merged
ScriptedAlchemy merged 3 commits into
mainfrom
fix/codex-subagent-events
Sep 1, 2026
Merged

fix(events): correct Claude and Codex subagent hooks#194
ScriptedAlchemy merged 3 commits into
mainfrom
fix/codex-subagent-events

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

  • correct the stale unavailable evidence for Claude Code and Codex SubagentStart / SubagentStop
  • map and validate native subagent wire fields, fail closed on unsupported start blocking, and project stop continuation through each documented host contract
  • pin Codex 0.147.0 generated input/output schemas, replay Claude/Codex fixtures, and verify plugin-bundled hooks at the documented hooks/hooks.json location
  • preserve root-independent rendered-skill model digests after rebasing over the concurrent Skill IR changes on main

Test plan

  • pnpm build
  • pnpm test:route-unit
  • affected integration files: hooks, plugin bundle, generated route server, target hook contract (48/48)
  • affected event/capability unit regressions
  • rendered-skill root-independence regression
  • pnpm lint
  • pnpm typecheck
  • full unit suite passed before the latest main rebase (2090 passed, 5 skipped); after rebase, the focused new-main root-independence failure was fixed and verified, while a subsequent full-pool run had only unrelated 5-second timeout flakes

Closes the support-matrix evidence error tracked in #97.

@changeset-bot

changeset-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2404a00

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agent-bundle Minor

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T20:31:25.031276Z 078a1a0 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Sep 1, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@194
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/create-agent-bundle@194
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@194

commit: 2404a00

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +359 to +362
' 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");',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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.

Comment on lines +151 to +152
if (target === 'codex') {
throw new TypeError('agent/stop additional context is not supported by the Codex SubagentStop output schema.');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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.
@ScriptedAlchemy
ScriptedAlchemy force-pushed the fix/codex-subagent-events branch from 0111033 to 2404a00 Compare September 1, 2026 21:27
@ScriptedAlchemy
ScriptedAlchemy merged commit 4955f2f into main Sep 1, 2026
10 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the fix/codex-subagent-events branch September 3, 2026 05:26
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.

1 participant