Skip to content

feat: codex sessions speak progress, approvals and answers - #417

Merged
znat merged 2 commits into
feature/claude-voicefrom
voice/codex-events
Nov 7, 2026
Merged

znat merged 2 commits into
feature/claude-voicefrom
voice/codex-events

Conversation

@znat

@znat znat commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Codex sessions now speak. A Codex prompt starts a turn, each tool call gives a short progress line, an approval request says "I need your OK", and the end of a turn speaks last_assistant_message through the same rewrite as Claude. The rewrite and the explain prompt get the turn's context from the Codex rollout file. Claude Code's behaviour does not change.

This is A2 of the Codex and mini-swe-agent voice train. Nothing installs Codex hooks yet (A3), so this changes nothing on a Mac until a Codex hook sends agent=codex.

Review first: CodexSpeakable.swift, the CodingAgent methods and receive in ClaudeVoice.swift.

Event mapping
Codex event What is said
UserPromptSubmit Nothing. Same as Claude: pin the window, stop the session's speech, start a turn, make the reminder.
PreToolUse CodexSpeakable.progress. Bash has only command, so the line comes from what the command is: search and listing tools say "I'm looking through the code", git diff "I'm looking at the changes", swift test or pytest "I'm running the tests", a build "I'm building", anything else "I'm running a command". apply_patch names its files from the *** Update/Add/Delete File: headers: "I'm editing ClaudeVoice.swift", "I'm writing a.swift and b.md", "I'm editing 3 files". The command text is never said. With claude.explain on, the explain model still gets the command and the latest commentary, as for Claude.
PermissionRequest "I need your OK to run a command.", "I need your OK to edit main.rs.", or "I need your OK to go on.", through the same whenFree path as Claude's Notification.
Stop last_assistant_message, through the existing answer path. The rollout gives the prompt and the turn before.
Anything else Ignored, logged once per agent and event name.
Any event with a non-empty agent_id string Ignored, logged once. A null agent_id is the main thread. A Codex subagent thread would otherwise speak as its own session.
Rollout reader

CodexSpeakable.lastTurn reads the last 512 KB of the rollout (128 KB for an explanation), with the same tail read as the Claude reader. It reads only event_msg lines, in both history modes Codex writes:

  • newer: item_completed with UserMessage and AgentMessage (phase commentary or final_answer);
  • older: user_message and agent_message.

It returns the same TurnEnd as the Claude reader. prompt is the last user message. answer is the last final message, else task_complete.last_agent_message, never commentary. latestText is the newest message of either kind, so the explain prompt hears Codex's commentary. earlier is the turn before. response_item user messages are skipped: they also carry the context Codex injects.

The four transcript reads switch on the session's agent through CodingAgent.lastTurn and latestSummary.

.jsonl.zst is skipped. Codex compresses cold rollouts with zstd. macOS has no zstd decoder: the SDK's compression.h lists zlib, LZMA, Brotli, LZFSE and LZBITMAP only, and zstd on this Mac comes from Homebrew. No package dependency decodes it either. A .zst transcript is not read, and the app logs it once per file. The live session's rollout is plain .jsonl, so this should not matter in practice (inferred from the Codex source, compression.rs targets cold files).

Other changes
  • ClaudeSpeakable.tail(of:bytes:) holds the tail read that lastTurn and latestSummary both had. The Codex reader uses it too.
  • ClaudeVoice.transcript(_:) replaces three copies of the transcript_path read.
  • ignoredAgents became skipped, one log-once set for agents, events and unreadable transcripts.
  • nilIfEmpty is no longer private.
Checks. 206/206, up from 155
  • swift build -c release: builds, no new warnings in the changed files.
  • scripts/check-claude-voice.sh: 206/206. New:
    • 16 Codex progress cases (search, tests behind cd and a variable, python -m pytest, build, ls tests, git diff, git commit, unknown command, patches with 1, 2 and 3 files, delete, spawn_agent, update_plan, request_user_input, MCP browser);
    • 3 waiting cases for PermissionRequest;
    • 6 codex_turns fixtures (newer and older history modes, commentary only, earlier turn, injected context, no prompt in the tail), each checking answer, prompt, latest and earlier;
    • 2 Codex summary cases;
    • a Codex rollout read from a file whose tail starts inside a line;
    • .jsonl.zst is not read, .jsonl is;
    • agent=codex is Codex's;
    • a null agent_id is the main thread, a string agent_id is a subagent.
  • Every fixture is built from the documented shapes (Codex 0.167 source and docs), with invented values. No local session content is in the repo.
  • swiftlint lint on the four Swift files: 0 violations.
  • Local CodeRabbit CLI: 0 findings on each commit.

No live Codex session was run. A3 installs the hooks, and the live check comes with it.

What this leaves for later PRs
  • A3 (voice/codex-installer): write ~/.codex/hooks.json with UserPromptSubmit, PreToolUse, PermissionRequest and Stop. The app already handles those four.
  • A4 (voice/codex-glow): the window. For now the pid walk is unchanged. Codex desktop sessions should find ChatGPT.app. TUI sessions under the shared daemon likely find no host (inferred, not run), so they get no glow. Without a host, watching falls back to inFront: a terminal in claudeHosts in front whose window title names the project. ChatGPT.app is not in claudeHosts. Progress lines need watching; answers and approvals do not.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jptb12hNR5fNp7ZEWwqC9y

Codex hook events are now spoken. A Bash call says what kind of command
it is, never the command. An apply_patch call names its files. A
PermissionRequest says "I need your OK". Stop speaks
last_assistant_message through the existing rewrite. Other Codex events
and subagent events are ignored and logged once.

A rollout reader gives the rewrite and the explain prompt the turn's
prompt, commentary and the turn before, from the tail of the .jsonl.
A .jsonl.zst rollout is skipped: macOS has no zstd decoder.

Signed-off-by: Nathan Zylbersztejn <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Jptb12hNR5fNp7ZEWwqC9y
@greptile-apps

greptile-apps Bot commented Nov 7, 2026

Copy link
Copy Markdown

Automatic reviews are disabled for this repository. Configure in Code Review Settings.

@znat

znat commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4bbf506b-f1f0-436d-bd29-7f61f8dd2c6d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@znat

znat commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Remote CodeRabbit is rate-limited on this PR. The local CodeRabbit CLI reviewed commit 308f913 against the base dcce2ae: 0 findings. That pass is the CodeRabbit gate for this PR.

JSONSerialization reads a null field as NSNull, not nil. A main-thread
Codex event with "agent_id": null was dropped as a subagent's, which
would mute every Codex session. Only a non-empty string marks a
subagent now.

Signed-off-by: Nathan Zylbersztejn <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Jptb12hNR5fNp7ZEWwqC9y
@znat
znat merged commit 951e9ca into feature/claude-voice Nov 7, 2026
6 checks passed
@znat
znat deleted the voice/codex-events branch November 7, 2026 17:04
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