Skip to content

feat(events): promote session/end and prompt/submit canonical route families (#258 v2 s1) - #351

Merged
ScriptedAlchemy merged 4 commits into
mainfrom
feat/258-events-s1
Sep 3, 2026
Merged

feat(events): promote session/end and prompt/submit canonical route families (#258 v2 s1)#351
ScriptedAlchemy merged 4 commits into
mainfrom
feat/258-events-s1

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

First staged slice of the #258 v2 event-route promotion: canonical session/end and prompt/submit families compiled into native host hooks with the full G10 evidence bar (pinned per-host contract, decode fixtures, fail-closed projection, honest capability rows).

Support matrix

Target session/end prompt/submit
Claude SessionEnd, observe-only UserPromptSubmit, deny + additionalContext
Codex SessionEnd, observe-only (no output schema at rust-v0.147.0) UserPromptSubmit, deny + additionalContext
Cursor sessionEnd, observe-only; cloud honestly unavailable (no editor-lifetime session boundary) beforeSubmitPrompt, deny only (continue:false + user_message; no context channel)
plugin supported, resolved per invoking host supported, resolved per invoking host
portable unavailable (Agent Plugins 1.0.0 defines no hooks) unavailable

Evidence pins

  • Claude: hooks reference retrieved 2026-09-02 (SessionEnd has no decision control and discards JSON output; UserPromptSubmit documents decision:block + reason + hookSpecificOutput.additionalContext, no prompt-rewrite channel). Live Claude Code 2.1.257 non-interactive captures for both events; scrubbed envelopes checked in under tests/fixtures/events/.
  • Codex: rust-v0.147.0 generated schemas byte-pinned under adapters/schemas/codex/generated/ with upstream SHA-256 digests (user-prompt-submit input+output; session-end input only — the tag has no session-end output schema, so no output is projected). Live codex-cli 0.147.0 captures for both events.
  • Cursor: hooks reference (pinned 2026-08-28 revision) documents beforeSubmitPrompt (continue + optional user_message, matcher evaluates against literal UserPromptSubmit) and fire-and-forget sessionEnd; cloud-agent unavailability recorded as an availability dimension. Live capture attempt blocked by missing Cursor authentication — recorded as a dated evidence bullet; the official contract is the pinned source.

Design decisions

  • Both families are route-only: sessionEnd/promptSubmit live in a separate eventRouteOnlyHookEvents vocabulary and are not added to config-facing canonicalHookEvents, so no new config.hooks.* handler keys exist.
  • projectEventDocument fails closed: session/end rejects deny/replacement/context everywhere; prompt/submit rejects prompt replacement everywhere and context on Cursor.
  • validateNativeEventEnvelope pins per-host required fields (Codex requires turn_id/model/permission_mode and reason const other; Cursor requires prompt + typed attachments).
  • Adapter revisions after serial adjudication over feat(codex): complete plugin manifest metadata contract #350: claude 1.20.0, codex 1.4.0, cursor 1.6.0, plugin 1.19.0, portable 1.4.0 (portable gains two honest unavailable rows).

Gates (local, after rebase onto 15a7854)

  • pnpm typecheck clean; pnpm lint 0 errors / 0 warnings (1027 files)
  • pnpm test:route-unit 27/27; pnpm test:projection 63/63
  • Scoped suites (adapter-capability-states, adapter-metadata, hooks, lifecycle-replay-service/routes, cursor-adapter, event-project, route-graph, target-hook-contract, codex-plugin-validation): all pass
  • Changeset: minor

Part of #258.

Vendor the Codex 0.147.0 wire schemas, including the absence of a SessionEnd output schema, and retain scrubbed Claude/Codex binary captures for lifecycle replay.
Keep sessionEnd and promptSubmit out of canonicalHookEvents so config handler hooks remain unchanged; only normalized filesystem event routes use the new internal identities. Project exactly the blocking, context, and observe-only channels pinned for each host.
Exercise discovery, native envelope validation, projection, adapter planning, capability state, and lifecycle replay for session/end and prompt/submit, and document the route-only public contract.
Codex and plugin adapter revisions collided with #350's bumps on rebase;
re-adjudicate to 1.4.0/1.19.0 and bump portable to 1.4.0 for its two new
honest eventRoute rows. The four-render fixture replay test gets an explicit
30s timeout following the integration-config precedent.
@changeset-bot

changeset-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 12c7903

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

@ScriptedAlchemy
ScriptedAlchemy merged commit 9b165ba into main Sep 3, 2026
4 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 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-03T01:20:39.820176Z 12c7903 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.

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