Repository navigation
feat: codex sessions speak progress, approvals and answers - #417
Conversation
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
|
Automatic reviews are disabled for this repository. Configure in Code Review Settings. |
|
@coderabbitai review |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Action not completed
|
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
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_messagethrough 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, theCodingAgentmethods andreceiveinClaudeVoice.swift.Event mapping
UserPromptSubmitPreToolUseCodexSpeakable.progress.Bashhas onlycommand, 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 testorpytest"I'm running the tests", a build "I'm building", anything else "I'm running a command".apply_patchnames 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. Withclaude.explainon, the explain model still gets the command and the latest commentary, as for Claude.PermissionRequestwhenFreepath as Claude'sNotification.Stoplast_assistant_message, through the existinganswerpath. The rollout gives the prompt and the turn before.agent_idstringagent_idis the main thread. A Codex subagent thread would otherwise speak as its own session.Rollout reader
CodexSpeakable.lastTurnreads the last 512 KB of the rollout (128 KB for an explanation), with the same tail read as the Claude reader. It reads onlyevent_msglines, in both history modes Codex writes:item_completedwithUserMessageandAgentMessage(phasecommentaryorfinal_answer);user_messageandagent_message.It returns the same
TurnEndas the Claude reader.promptis the last user message.answeris the last final message, elsetask_complete.last_agent_message, never commentary.latestTextis the newest message of either kind, so the explain prompt hears Codex's commentary.earlieris the turn before.response_itemuser messages are skipped: they also carry the context Codex injects.The four transcript reads switch on the session's agent through
CodingAgent.lastTurnandlatestSummary..jsonl.zstis skipped. Codex compresses cold rollouts with zstd. macOS has no zstd decoder: the SDK'scompression.hlists zlib, LZMA, Brotli, LZFSE and LZBITMAP only, andzstdon this Mac comes from Homebrew. No package dependency decodes it either. A.zsttranscript 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.rstargets cold files).Other changes
ClaudeSpeakable.tail(of:bytes:)holds the tail read thatlastTurnandlatestSummaryboth had. The Codex reader uses it too.ClaudeVoice.transcript(_:)replaces three copies of thetranscript_pathread.ignoredAgentsbecameskipped, one log-once set for agents, events and unreadable transcripts.nilIfEmptyis no longerprivate.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:cdand 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);waitingcases forPermissionRequest;codex_turnsfixtures (newer and older history modes, commentary only, earlier turn, injected context, no prompt in the tail), each checking answer, prompt, latest and earlier;.jsonl.zstis not read,.jsonlis;agent=codexis Codex's;agent_idis the main thread, a stringagent_idis a subagent.swiftlint linton the four Swift files: 0 violations.No live Codex session was run. A3 installs the hooks, and the live check comes with it.
What this leaves for later PRs
voice/codex-installer): write~/.codex/hooks.jsonwithUserPromptSubmit,PreToolUse,PermissionRequestandStop. The app already handles those four.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,watchingfalls back toinFront: a terminal inclaudeHostsin front whose window title names the project. ChatGPT.app is not inclaudeHosts. Progress lines needwatching; answers and approvals do not.🤖 Generated with Claude Code
https://claude.ai/code/session_01Jptb12hNR5fNp7ZEWwqC9y