Repository navigation
Codex autopilot, PR 2: harden the must-hold items, then turn autopilot on (T677) - #455
Merged
Merged
Conversation
…677) Part A of T677: the must-hold items of the T663 reviews, before autopilot turns on. - F-T663-11, F-T663-18: an off phrase sent with a local image counts. Codex wraps the image in its own tag items (a real Codex 0.164.0 record, made in a scratch home and scrubbed into owner-records.json), and the reader drops them, as the hook gets the text. - F-T663-27: an off counts from any user message, whatever its metadata, and from Codex's UserMessage event. An on still counts only under the strict rules. - F-T663-23: the mode phrase with an image turns sage mode on, as in the hook. - F-T663-19, F-T663-25: a start of another thread before its record exists, or with no record path, changes no mark. Line 0 is saved only for the root thread's own new record (its file name holds the session id). - F-T663-20: the limit line names the mode folder when it cannot make the marks folder. F-T663-26: the limit line says that merges wait in this session, and both next steps. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d (T677) Part B of T677. In Codex 0.164 to 0.166, "autopilot on" turns autopilot on again. The chief merges only with sage's merge command, in its one exact form, from the main thread. The gate admits it only when, in order: - the mode file has sage mode and autopilot on (R2611, F-T663-24); - the Codex that runs is 0.164 to 0.166, by its own --version through the codex-arg0 link (F-T663-1: a resume by a newer Codex writes no version); - the owner record reader finds the owner's on after the start mark, and the mark's pid is the Codex process that runs now (F-T663-9, F-T663-22); - the call itself is in Codex's record after the mark; - node and gh are outside every folder that the sandbox can write (R2611); - gh names the repository, and checkMerge (unchanged) passes with the trusted PATH. Then it saves the call's one-time permit, with the repository, cwd, mode file and gh file. PermissionRequest allows only with a matching unused permit for the same session, turn, exact command and cwd (R2611). Every run of merge.mjs in another form is refused (F-T663-21), and a gh merge never runs. merge.mjs takes its permits from the Codex home where the plugin is installed, never from the caller's SAGE_HOME, CODEX_HOME or HOME (F-T663-21), runs the permit's gh file, and checks the record and the mode file again before gh. The mode hook records autopilot again, with the merge command and the branch protection note. The guide has "Autopilot in Codex": Esc stops a merge now unless its call to GitHub started, an off sent with Enter stops merges from the next step, Tab waits for the turn end, and the limits (F-T663-3, F-T663-17). The legacy typedModes replay goes: the owner record reader replaces it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lders as a dependency (T677) CI on Linux failed 8 gate tests: there the test's scratch folder is under /tmp, which the gate counts as writable by Codex's sandbox, so it skipped the fake Codex binary and the fake gh. The fixed temporary folders (/tmp, /private/tmp, /var/tmp) are now a gate dependency with that default; the tests give none, and one test gives the fakes' folder to prove that the list applies. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The desktop app sends turnTrigger composer for a typed message (its send path sets turnTrigger ?? "composer"); a queued message is composer_queue, and Codex's own turns name theirs. The reader now counts an on from a composer turn too, and still none from a turn with no trigger. The test uses a scrubbed real record of the desktop app's Codex binary (0.166.0-alpha.6) over app-server stdio. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… network approval for GitHub's API only (F-T677-1 to F-T677-4, T677) The gate and the merge command run gh's real file with the name gh (argv0), so a launcher that picks its tool by name (snap, mise) runs gh, and no link that the sandbox can change runs. The permit names that real file and the trusted PATH; the trusted PATH drops missing folders; repo view and the merge run with it. A PermissionRequest whose description is a network approval is allowed only for https://api.github.com:443. New tests: a link outside the sandbox's folders to a gh inside them, a launcher by name, missing PATH folders and gh's PATH, and network hosts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mits in plain words (F-T677-5 to F-T677-9, F-T677-11, T677) The help says that a merge whose call to GitHub started still completes after Esc, that autopilot stays on, that an off sent with Enter does not stop an admitted merge, and that a phrase queued with Tab waits. The off reply in Codex adds that an admitted merge can still complete (in the Codex package, not core). The guide, the README and the skill name the Codex versions and the node and gh folders that a merge needs, the missing-binary refusal, the app's queue, and the action after a resume in the app. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… a turn, the cause of a lost Codex folder (F-T677-13, F-T677-15 to F-T677-17, T677) - F-T677-16: the gate and the record reader take Codex 0.164 to 0.167, with a pre-release of one or more numbers (the desktop app's 0.167.0-alpha.3.2). 0.168 and later still refuse. A scrubbed real 0.167 record of the desktop binary is in owner-records.json (app-steer). - F-T677-13, F-T677-15: an on counts only from the turn's first user message that is not Codex's own context. A message that joins a running turn (turn/steer, or turn/start while a turn runs) gets that turn's id, so its on counts for nothing; an off still counts from any message. - F-T677-17: when the hook's PATH has no codex-arg0 folder, the refusal names the cause: a login profile that sets PATH without its earlier value. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nversation stops the main session's merges; tested range 0.164 to 0.167 (F-T677-24, F-T677-20, T677) - A subagent's prompt has the main thread's session id (Codex source and real 0.164.0 and 0.167.0-alpha.3.2 records), so its off phrase switches the main thread's mode file, also sage mode for the mode's off phrase. - A fork's off also turns autopilot off in the session that its record names (forked_from_id). - A thread with no readable record, such as a side conversation, cannot name its parent: its off turns autopilot off in every mode file of the folder. - The owner gets one line in that thread. An on from such a thread still counts for nothing. - The tested range of the start status, the fault lines, the guide and the README is now 0.164 to 0.167, autopilot's window. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ns autopilot off in every session (F-T677-29, T677) - A fork's record names only the thread it came from, which can be a fork too, and a subagent of a fork has the fork's session id. So an off in a fork of a fork, or in a fork's subagent, reached only the fork, and the first session kept merging. - Now an off from a subagent's thread, a fork or a thread with no record turns autopilot off in every mode file of the folder, as a side conversation did. The mode's off phrase in a subagent's thread also turns sage mode off in its session. - One line in that thread says so, and how to turn autopilot on again. An on from such a thread still counts for nothing. - Tests: a fork of a fork and a fork's subagent, in the mode hook and through the gate and the merge command. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… merge (F-T677-30, T677)
- When a multi-agent v2 subagent reports back, Codex writes an inter_agent_communication_metadata line into the main record. The record reader did not know that type, so every later merge refused. In sage mode the leads are subagents, so autopilot stopped after the first report.
- The reader now accepts that line only with its real payload, { trigger_turn: boolean }; any other payload refuses. The line is no user message, so it never counts as the owner's on.
- Tests on two real records, scrubbed: Codex CLI 0.164.0 and the desktop app's Codex 0.167.0-alpha.3.2, each with a v2 subagent's report, a later admitted merge and an off.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What this is. PR 2 of the Codex autopilot (T677, after T663's PR 1, #447). It first closes every must-hold item of the T663 reviews (Part A), then turns autopilot on in Codex 0.164 to 0.166 (Part B). The entry point: the owner installs the sage plugin in the Codex desktop app or the CLI, sends the mode phrase, then the on phrase.
What the owner sees. The same as in Claude Code: after a task's clean cycles and a passing merge check, the chief merges with sage's merge command, with no prompt for the merge. Press Esc to stop a merge now (unless its call to GitHub started); the off phrase sent with Enter stops merges from Codex's next step; a Tab-queued off waits for the turn end. The guide's new section "Autopilot in Codex" has the rules and the limits.
Part A (harden), one test per item:
Part B (turn on): the gate's admission (root thread, mode file, running version, record reader with the start mark and its pid, the call in the record, trusted node and gh, repository, checkMerge unchanged, then the one-time permit), PermissionRequest, the mode hook's on reply with the merge command and the branch protection note, the chief's bindings, the skill and the guide. The legacy typedModes replay is removed.
Checks.
npm run build,npm run check, and each changed or covering test file alone (see the run's report). QA runs the live scratch proof with the CLI and the desktop binary next.🤖 Generated with Claude Code