Skip to content

fix(plugins): detect Codex Plan mode from the transcript - #399

Merged
umputun merged 4 commits into
masterfrom
codex-plan-mode-transcript
Oct 21, 2026
Merged

umputun merged 4 commits into
masterfrom
codex-plan-mode-transcript

Conversation

@umputun

@umputun umputun commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Codex fills the Stop hook payload's permission_mode from the approval policy (default or bypassPermissions), never plan, so the revdiff-planning Codex hook skipped every plan and automatic review never ran. Codex records the mode only in the transcript, on the turn's task_started event as collaboration_mode_kind.

  • the hook now also treats a turn as Plan mode when the session-matched transcript's task_started record for the event's turn_id carries collaboration_mode_kind: plan. The permission_mode == "plan" check stays
  • a transcript that is missing, belongs to another session or names another mode skips the turn silently, so Build/default replies quoting <proposed_plan> stay ignored and normal turns never warn
  • a transcript-confirmed plan turn whose transcript has undecodable bytes now warns instead of crashing the hook
  • README, site docs, plugin README and CLAUDE.md describe the transcript check
  • separate commit wraps the TIOCPTYGNAME errno in app/ptybridge, flagged by golangci-lint 2.15.0 wrapcheck
  • backlog note for the now-redundant permission_mode check

Fixed #398

Codex fills the Stop payload's permission_mode from the approval policy
("default" or "bypassPermissions"), never "plan", so the revdiff-planning
Stop hook skipped every Codex plan. The hook now also accepts a turn whose
transcript task_started event, matched by turn_id, carries
collaboration_mode_kind "plan". The transcript is located with the same
session checks as the message fallback; when it is missing, mismatched or
names another mode, the turn is skipped silently.

Fixed #398
golangci-lint 2.15.0 reports the bare syscall.Errno return under wrapcheck.
A transcript-confirmed Plan turn now reaches the message fallback, so an
undecodable byte past the first read buffer raised UnicodeDecodeError out
of the hook instead of warning. README and the site still said missing or
mismatched event data warns; for Codex such a turn is now skipped silently.
… hook

the #398 fix keeps a `permission_mode == "plan"` branch that Codex never satisfies. Recorded so the cleanup can be decided later.
Copilot AI balanced review requested due to automatic review settings October 18, 2026 17:13

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying revdiff with  Cloudflare Pages  Cloudflare Pages

Latest commit: a925862
Status: ✅  Deploy successful!
Preview URL: https://51ad2a5e.revdiff.pages.dev
Branch Preview URL: https://codex-plan-mode-transcript.revdiff.pages.dev

View logs

@umputun
umputun merged commit 7a2dba8 into master Oct 21, 2026
7 checks passed
@umputun
umputun deleted the codex-plan-mode-transcript branch October 21, 2026 06:07
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.

revdiff-planning: Codex Stop hook never reviews plans because Plan mode is not reported in permission_mode

2 participants