Repository navigation
Add Codex CLI support behind an agent adapter boundary - #5
Merged
Merged
Conversation
Everything loch needs from one agent harness — hook events and hooks file, reading a turn from the transcript, the store key for a transcript, session discovery and metadata, a transcript's cwds, where a restore goes and how it resumes, finding a transcript and forking it — is now behind agent::Agent, in three tiers (attribution, transport, conversation) whose later tiers have declining defaults. Claude Code moves onto it with no change in behaviour. tests/bundle.rs now pins the packed JSON and ref of a bundle, and that repacking reproduces the bytes. save and list on 100 real sessions gave identical refs and output before and after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
codex.rs implements every tier of agent::Agent for codex-cli: rollout discovery under $CODEX_HOME/sessions, the live cwd from the last turn_context (compared symlink-resolved, since Codex stores -C as given), session_meta's branch only where the session hasn't moved, turns bounded by the records naming their turn_id, restore filed by start date, and ask's fork as a byte-for-byte prefix of the rollout resumed with codex resume. install writes .codex/hooks.json (or with --local the user's) beside whatever is there, appending groups so the trust Codex keys by position stays valid, and reports needsReview: loch never writes Codex's hook trust. list, save and install take --agent; sessions, bundles and restores carry agent and agentVersion. A bundle's sessions name their agent only where it differs from the bundle's, so every Claude-only bundle keeps its ref. Verified end to end on real Codex sessions (CLAUDE.md, State): hooks and blame, a cancelled TUI turn, ask at a turn and to the end, and a cross-machine restore that resumed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
install's payload field `command` (the hooks' loch path) replaced the envelope's `command`, so `install --json` reported "command": "loch" instead of "install". The field is now `hookCommand`, and output::document drops any payload key that reuses an envelope key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e cases - A bundle holding any non-Claude session is version 2, which v0.2.0 refuses as bundle-unreadable instead of restoring a Codex session as a Claude transcript with ok: true (checked against a v0.2.0 build). Claude-only bundles stay version 1, byte for byte; both are pinned. - install with no --agent sets up Claude Code alone again; --agent codex or all opts in, so install --local never widens to the user-wide Codex file. - ask on a turn of an agent this build lacks is unsupported-agent. - A non-ASCII session_meta timestamp from a bundle no longer panics restore. - Agent::can_restore replaces probing restore_path with an empty transcript. - CLAUDE.md: the version rule, the install default and Ness note, and the cost of scanning every Codex rollout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Adds Codex CLI as loch's second harness. Three commits, meant to be read in order:
agent::Agent(src/agent.rs), in three tiers: attribution, transport and conversation. Later tiers default to declining. Claude Code moves onto it with no behaviour change.tests/bundle.rsnow pins the packed bytes and ref of a bundle. On 100 real sessions,saveandlistgave identical refs and output before and after.src/codex.rs,tests/codex.rs).install,blame,log,save,list,restoreandaskall work for Codex. Bundles of a single agent's sessions keep their bytes, so existing Claude refs are unchanged.command. This was a pre-existing bug:install --jsonreported"command": "loch". The hook path is nowhookCommand, andoutput::documentdrops any payload key that collides with an envelope key.Verified end to end on real codex-cli 0.166 sessions
"agent": "codex"and Codex's thread title.Stop. The next prompt closes it asinterruptedand keeps its edits.ask --at-turnforks at the end of that turn. Resumed, the fork knows that turn and nothing after it.--new-idinto another directory, and resumed. It came back clean and recalled the conversation.Full findings are in CLAUDE.md: Codex storage, and what a third harness costs.
Needs a decision or a heads-up
/hooks. loch reportsneedsReviewand never writes trust itself. Trusting through the TUI is untested; test runs used--dangerously-bypass-hook-truston scratch repos.install --localfor Codex writes~/.codex/hooks.json, which applies to every Codex project on the machine. Codex has no uncommitted per-project file.install's hook path moved fromcommandtohookCommand.unknown-agentandunsupported-agent.agent/agentVersionon sessions, andagents[]oninstall.schemastays 2.agentcan now becodex, withturn/conversationnull for those turns.~/.codex/hooks.jsonwholesale, it will drop loch's hooks.Gaps
ingestandbackfillstay Claude-only. A Codex session that moved directories reports no branch. Forks have no title.archived_sessionsisn't searched.🤖 Generated with Claude Code