Repository navigation
feat(agents): Codex and Gemini serve atif/1, from the CLI's rollout and its session transcript - #924
Open
earakely-scale wants to merge 15 commits into
Open
earakely-scale wants to merge 15 commits into
earakely-scale wants to merge 15 commits into
Conversation
earakely-scale
marked this pull request as ready for review
November 25, 2026 18:25
earakely-scale
force-pushed
the
edgararakelyan/fd-6082-y8-codex-gemini-atif
branch
from
November 26, 2026 04:34
1230fbf to
38655a1
Compare
The bridge tails the thread's rollout, and each sub-agent's, and feeds its records as the rollout aux file; the adapter writes a step per model response with its items' times and the response's own usage, embeds each sub-agent under its spawn_agent call, marks a resumed attempt, and turns a failed call into an error step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts proxy's calls The bridge tails the session transcript and feeds each model message once it is settled; the adapter writes a step per response with its thoughts, calls, results and images, takes each step's usage from the proxy call whose input it names, and writes the calls that wrote no message, and the refused ones, as steps of their own. Each proxy record now has a time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… images Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and answers hosted web searches A sub-agent forked with its parent's history begins its rollout with a copy of the parent's meta and turns, whose call ids the copy already holds: the tail leaves out the records of every turn the parent's rollout holds. A web search the provider runs has no output item, so its step waited on a result until the turn ended: the adapter answers it with its status. Adds the recorded fixtures and tests for both agents, and seeded conversations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cks a fork's parent for a new turn A Gemini response the proxy didn't count is joined only to an uncounted call no answered call comes ahead of, and leaves the calls not yet written alone, since they may be later messages'. A forked Codex sub-agent's record of a turn its parent's rollout didn't hold when the fork was found reads the parent's rollout again before taking the turn for the sub-agent's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…th a forked sub-agent Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h the tail leaves out Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lier task's sub-agent never takes a later spawn Stopping the rollout and transcript followers cancelled them, so a read still running in its thread moved past records whose batch was then dropped: the followers now finish that read and feed it before the final one. A sub-agent an earlier task saw kept matching a later spawn that reused its path, declaring it twice: only this task's sub-agents match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h atif/1 profile 1.2 Its adapter writes a compaction's token counts, which profile 1.2 holds, and now takes is_token_count and COMPACTION_TRIGGERS from the protocol rather than defining its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mage Its model calls now go through the turn's relay; the copies' steps still sum to each turn's reported usage, and each replay equals what the agent served. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n restored from one is A snapshot keeps its transcript's format, and the tail read only .json, so a restored .jsonl session's copy had its proxy calls' usage and nothing else. It now reads either: a .jsonl line per message, one written again replacing its earlier copy, a line not yet whole left out; and a transcript the CLI moves from .json to .jsonl is found again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ll in the read that finds it gone A move from .json to .jsonl after the last poll cleared the path and returned, and the turn's final read, its only one left, then fed nothing of what the turn wrote since. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earakely-scale
force-pushed
the
edgararakelyan/fd-6082-y8-codex-gemini-atif
branch
from
November 26, 2026 05:46
ca3fafd to
4109f34
Compare
…nded when its message was written The transcript runs a response behind, so the next call can be waiting when a message arrives; with the same input as the message's own call the proxy couldn't count, it took the message, and its counts with it. A call that ended after the CLI wrote the message is a later one's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
read_file gives a model that takes media in a tool's response the file in the function response's parts, which the copy left out, keeping only its placeholder text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been 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.
Codex and Gemini now serve
atif/1when a run prescribes it, as Claude Code has since #854. Their native trajectories stay the default. Before this, a prescribed run fell back to native for these two agents, so their judges and live followers read the CLI's stdout events, which carry no times, no per-call usage, no thoughts and (for Gemini) no tool results.What changes
Codex (
agents/codex/codex_atif.py,codex_bridge.py)$CODEX_HOME/sessions/.../rollout-*.jsonl) while the CLI runs, and each sub-agent's rollout as it appears, at any depth. It feeds the records the adapter reads as therolloutaux file (RolloutTail,rollout_aux). When the CLI exits, the follower finishes any read in progress and feeds it, then reads once more. The exec JSON events on stdout stay the native log.token_usage_record. A response that wrote nothing gets a step for its usage alone, so the steps add up to the turn's usage.mcp__browser__browser_navigate).summary, else the ciphertext is kept asredacted, elseomitted.spawn_agentcall that started it. The bridge marks each sub-agent's records with the thread that spawned it. The spawn's result and the sub-agent's records are held until both have arrived, in either order. A sub-agent an earlier task saw never takes a later spawn that reuses its path.fork_turns: "all") begins its rollout with a copy of the parent's meta and turns, the parent's own replies among them, under their ids. The tail leaves out the records of every turn the parent's rollout holds, so the sub-agent's trajectory holds only what it did. A turn the parent's rollout didn't hold when the fork was found has the parent's rollout read again before it's taken for the sub-agent's own.task_started, and its steps carry the attempt's number. A failed or refused model call ends its attempt'stask_completewith an error, which becomes a step with no model call holding that error.Gemini (
agents/gemini/gemini_atif.py,gemini_bridge.py,a2a_server.py)~/.gemini/tmp/<project>/chats/session-*.json, rewritten whole, or.jsonl, a line per message, as a session restored from a snapshot may be). It feeds each model message once a later message follows it, since the CLI adds a message's calls and results after writing it, and the last message at the turn's end (SessionTail,session_aux). A resumed session's earlier messages aren't fed again.summaryreasoning.read_filegives the model), is a media file. An error response is anerrorresult, and a cancelled call without a result iscanceled.agentenv.model_callwhose input it names (the prompt plus any tool-use prompt, as the proxy counts it), of the calls that had ended when its message was written. The CLI writes a message a few milliseconds after its call ends, and the next call ends after that.timestamp).The cards. Both offer
atif/1beside their native format, which stays the default. Their images and install lists carry the adapters.Claude Code's protocol floor (
agents/claude-code/requirements.txt,claude_code_atif.py)is_token_countandCOMPACTION_TRIGGERSfrom the protocol, rather than its own copies, which feat(verifiers): always_on's judge reads a compaction as one, natively and from atif/1, and asks about context loss #916 kept until the floor could rise.Choices to review
Testing
.jsonlsession, a message written again in one, and a transcript moved from.jsonto.jsonljust before the final read.run_codexandrun_geminiboth feed while the CLI runs and once more after it exits, and a read still in flight when following stops is fed before the final one.tst/data/codex_atif,tst/data/gemini_atif), through each agent's image built from this branch, withtst/manual/codex_gemini_atif/record.py:sync_env_clockwithagent_clock, frozen in 2031): the model randateand an MCP tool through the egress proxy, and the judge passes it from the copy. The copy's times stay the rollout's real time, as the server's do.valid, and every live follow's pages match the final copy..jsonltranscripts half the time, some moved from.jsonmid-turn or as the turn's last write (which the previous version failed within 180 seeds).agent-env run, atif/1 prescribed, each turn followed live, each turn graded by a direct judge reading its copy:snapshot_agent_state, thendeploy_agentwith the snapshot).valid, and every live follow's pages match the final copy, the Codex sub-agent's included./compactbetween turns, withtst/manual/claude_code_atif/record.py):🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no new blocking issues remain.Summary
Codex and Gemini now offer
atif/1beside their native formats, using the CLI’s saved records for richer steps.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR C[Codex rollout] --> CT[RolloutTail] CT --> CA[CodexAtif] G[Gemini transcript] --> GT[SessionTail] GT --> GA[GeminiAtif] P[Proxy call records] --> GA CA --> A[Live ATIF copy] GA --> AReviews (14) · Last reviewed commit: "fix(agents): Gemini's copy keeps a file ..." · Reviewed by Greptile