Skip to content

Report Codex hook readiness and document managed activation - #211

Open
Stephen Belanger (Qard) wants to merge 1 commit into
mainfrom
fix/codex-hook-readiness
Open

Stephen Belanger (Qard) wants to merge 1 commit into
mainfrom
fix/codex-hook-readiness

Conversation

@Qard

Copy link
Copy Markdown
Collaborator

Codex skips untrusted or modified plugin hooks before Braintrust receives events, so a successful plugin installation can leave tracing inactive. Make that activation boundary visible in setup/update output and bt trace doctor codex.

Doctor now starts a bounded, read-only Codex app-server probe for the current working directory and inspects config/read, hooks/list, and local plugin/list results. It reports missing installation/hooks, disabled configuration, pending review, configuration errors, trusted definitions, or an unknown/unsupported inspection state. The probe limits response bytes, times out after five seconds, and reaps its child. Trusted definitions explicitly do not establish capture or delivery.

Codex CLI 0.163.0 exposes hook trust through hooks/list but its generated app-server protocol has no hook-approval method. Preserve user review through /hooks, keep marketplace definitions unchanged, and document the supported administrator-managed hook policy for enterprise activation. The recipe includes all lifecycle events and avoids duplicate plugin/managed capture. No private trust-file mutation or invocation-wide bypass is introduced.

SDK-583

Validation on macOS:

  • Full all-feature Rust suite passed (289 library tests, plus integration suites; optional external-agent tests remain ignored by default).
  • Explicit installed-Codex test passed with CLI 0.163.0 in an isolated home: missing installation -> packaged plugin installed twice -> all ten packaged hooks require review. No user trust or settings were changed.
  • Fixtures cover trusted/managed/untrusted/modified/disabled/missing/error/unknown states, unrelated plugins, protocol notifications/errors/EOF, and setup/doctor human and JSON output.
  • All-target/all-feature Clippy with warnings denied, formatting, git diff --check, and managed-policy TOML parsing passed.

No live enterprise policy rollout or end-to-end Braintrust delivery is claimed by these checks. Runtime deployment requires updating and releasing the embedding bt CLI; distribution documentation ships through the normal Codex plugin release process.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 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-10-20T18:52:31.418045Z 3f136c6 PR opened
ℹ️ About Codex in GitHub

Your 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.

@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: 3f136c6e82

ℹ️ 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 (@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 (@codex) address that feedback".

Comment on lines +24 to +27
"subagentStart",
"subagentStop",
"stop",
];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Include Interrupt in managed hook readiness

When a user cancels an active turn, Codex dispatches the separate Interrupt lifecycle event rather than Stop; Codex 0.163.0 includes it in the official hook registry. Because this required-event list and the new managed-policy recipe omit Interrupt, the freshly flushed turn_aborted transcript record is not observed until some later hook, leaving interrupted turn, LLM, and tool spans open when the session remains idle while doctor still reports trusted. Use source-specific requirements so managed capture includes Interrupt (and the managed-only SessionEnd) without treating the existing packaged plugin as incomplete.

Useful? React with 👍 / 👎.

Comment on lines +287 to +288
} else if readiness.trusted_count == readiness.hook_count {
(CodexHookState::Trusted, "Braintrust hook definitions are enabled and trusted for this working directory. This does not confirm hook execution or Braintrust delivery.")

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 Reject simultaneous plugin and managed capture

If an administrator deploys the managed policy before every user removes the installed plugin—or a later bt trace enable codex reinstalls it—selected contains both complete hook sets and this condition reports Trusted. Codex explicitly loads all matching hooks from multiple sources, so each lifecycle event is forwarded twice; this is exactly the duplicate-capture state the new deployment guide tells users to avoid. Detect the simultaneous plugin and managed definitions and report a configuration error or warning instead of readiness.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
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