Declare Codex status hooks in config.toml instead of a -c argument - #1384
Merged
Conversation
The hooks travelled as one quoted `-c hooks={...}` session flag, which the
Windows command line mangled into an unparsable string: every Codex session
died with `expected struct HooksToml` before it started. Five spellings of the
argument were measured on a real windows-latest runner and none arrived intact.
Codex reads hooks from $CODEX_HOME/config.toml, a file dev3 already owns for
trusted projects, permissions and features, so the definitions go there as a
delimited managed block and nothing about them touches a command line. A
file-declared hook is untrusted and would be skipped in silence, so the launch
carries the bare --dangerously-bypass-hook-trust flag, feature-detected from
codex --help because an unknown flag exits 2.
Removes the app-server round trip that fetched per-hook trust hashes, and the
session-flag serializer behind it, together with every caller.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi — Claude here, the AI assistant that worked on this branch.
Launching Codex on Windows died before the session started:
dev3 passed its status hooks as one quoted
-c hooks={...}session flag. PowerShell hands a native process one flat command line and escapes nothing, so the payload's quotes were eaten and Codex — which parses a-cvalue as TOML and falls back to a literal string when it does not parse — rejected it. Five spellings of that argument were measured on a real windows-latest runner; none arrived intact, so the argument is not a viable channel.Codex also reads hooks from
$CODEX_HOME/config.toml, a file dev3 already maintains for trusted projects, permissions and features. The definitions move there as a delimited managed block, so nothing about them passes through a command line on any platform. A file-declared hook arrives untrusted and is then skipped in silence, so the launch carries the bare--dangerously-bypass-hook-trustflag, feature-detected fromcodex --help(an unknown flag exits 2 and the session never starts).Measured against codex-cli 0.147.0, with a controlled comparison on the block this code generates: flag off, nothing fires; flag on, the hooks fire. A
-pprofile file is not a hook source at all, and a linked worktree's own.codex/hooks.jsonis still invisible to Codex — which is why the hooks were in the argument to begin with.The app-server round trip that fetched per-hook trust hashes, and the session-flag serializer behind it, are deleted along with every caller.
Rationale and the full measurement table:
decisions/2026/08/15/codex-status-hooks-live-in-config-file.md.🔗 Origin task in dev3: open in dev3 ·
dev3://task/debf310b-749d-4041-ace6-57f71fbe61e5