Repository navigation
feat: structured codex agents in labs, driven through codex's app server - #79
Merged
Merged
Conversation
With Labs › Structured agents on (it covered Claude Code alone before), a new Codex agent runs as `codex app-server` under `berthd agent-host`, and the new Codex driver (internal/box/codexdriver.go) speaks its JSON-RPC: - it opens the thread (initialize, thread/start, or thread/resume with the conversation's thread id when it is carried on) - prompts go in as turn/start, carrying the session's mode (approval policy and sandbox), model and effort; interrupt is turn/interrupt - command and file-change approvals come to the chat as Allow / Always allow / Deny, Codex's questions as question cards, and anything else Codex asks gets an error so no turn waits for ever - turn state comes from turn and item notifications, the draft from agentMessage deltas, and berthd's own Codex hooks stay quiet - the conversation is read from the host's log (internal/transcript/codexhost.go), tool details included - resume and the conversation list work for Codex conversations as for Claude's Boxes list driver.codex; sessions and tasks take driver: "codex". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Stacked on #78 (base
resume-conversations). Merge #78 first, and GitHub retargets this PR tomain.Phase 5 of
design/structured-agents/plan.md: the Codex driver, behind the same Labs switch, now called Structured agents.Driver (
internal/box/codexdriver.go)codex app-serverruns underberthd agent-host, and berthd speaks its JSON-RPC (shapes from the spike's recordings and the generated schema):Handshake:
initialize/initialized, thenthread/start(cwd, approval policy, sandbox, model), orthread/resumewith the conversation's thread id (frommeta.jsonor the log) when carried on. It runs again whenever its host starts.Turns: each prompt is
turn/start, carrying the session's mode, model and effort. Modes:defaultuntrustedreadOnlybypassPermissionsSetModetakes effect from the next turn. Interrupt isturn/interrupt.Server requests:
item/commandExecution/requestApprovalanditem/fileChange/requestApprovalproduceask.choicesand the usual Allow (accept) / Always allow (acceptForSession) / Deny (decline) buttons.item/tool/requestUserInputbecomes a question card, answered via/answer.Turn state:
item/starteduserMessage (afterAwaitSent), approvals,serverRequest/resolvedandturn/completed(interrupted / failed). Codex's own berthd hooks stay quiet (BERTH_DRIVER).Draft: from
item/agentMessage/delta.Conversation: read from the host's log by a new parser (
internal/transcript/codexhost.go) that maps app-server items onto the existing conversation helpers: user messages, replies, commands as Run/Read/Search, file changes as edits, MCP calls, and questions with their answers.Detailgives a command and its output.Resume and the conversation list (feat: a structured claude agent's conversation can be resumed, after its agent ends or its session is gone #78) work for Codex conversations:
relaunchchooses the agent frommeta.json. Codex has no terminal switch (switchstays empty).App
The Labs switch is now Structured agents and covers Codex picks on boxes listing
driver.codex. Structured Codex sessions open as conversations. Resumed panes show the right agent.Tests
TestAStructuredCodexSessionIsDrivenThroughItsAppServer, with a stand-in app server (python3) following the recorded protocol:approvalPolicy: neverso nothing is asked-race.TestAStructuredCodexSessionsLogReadsAsItsConversationuses a recorded, anonymised app-server log, plus a command's details.TestALiveCodexSessionWorks(opt-inBERTH_LIVE_CODEX=1,BERTH_LIVE_CODEX_MODEL): real Codex replies, then runs a shell command under bypass. It passed locally in 9.6s.go test -race ./...,go vet ./..., app checks and build,tsc -p e2eand the docs build all pass.Next: phase 6, the generic ACP driver (opencode, Gemini, Cursor).
🤖 Generated with Claude Code