Hooks: permission_mode never reports "plan" during a Plan-mode turn
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
What version of Codex CLI is running?
codex-cli 0.153.2
What subscription do you have?
Pro
Which model were you using?
gpt-5.6-sol
What platform is your computer?
macOS 26.6.2, arm64
What terminal emulator and version are you using (if applicable)?
agterm
Codex doctor report
It's clean
What issue are you seeing?
hook can't tell it's in Plan mode. The docs list permission_mode values as "default", "acceptEdits", "plan", "dontAsk", "bypassPermissions", and since there's no separate collaboration-mode field for hooks, "plan" is the only advertised way to know. But in a real Plan-mode turn the field carries the approval policy instead.
Here's a Stop payload from a turn that produced a complete <proposed_plan> block:
{
"keys": ["cwd", "hook_event_name", "last_assistant_message", "model",
"permission_mode", "session_id", "stop_hook_active",
"transcript_path", "turn_id"],
"permission_mode": "default",
"hook_event_name": "Stop",
"stop_hook_active": false,
"last_assistant_message": null
}
permission_mode is "default". The session was definitely in Plan mode - the same turn's transcript entry carries collaboration_mode_kind, and the assistant message has a complete <proposed_plan> block.
What steps can reproduce the bug?
- Register
stop hookthat dumps its stdin, e.g. command = "tee -a /tmp/stop-events.jsonl >/dev/null", and trust it via/hooks /planto switch to Plan mode- Ask for anything that produces a plan and let the turn finish
- cat /tmp/stop-events.jsonl — permission_mode is the approval policy, never "plan"
What is the expected behavior?
permission_mode returns "plan" on a Plan-mode turn
Additional information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the Stop hook payload is constructed and how permission_mode is populated or serialized. Compare that value with the session transcript's collaboration_mode_kind during the documented /plan reproduction. Done means a Plan-mode turn reports permission_mode as "plan" while the existing approval-policy values remain correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100