Repository navigation
Codex autopilot, PR 1: owner record reader, start marks and fail-closed merge command, all inactive (T663) - #447
Merged
Merged
Conversation
…e (T663) The reader reads the owner's latest autopilot switch from Codex's record of the session and refuses every record that it cannot prove. The SessionStart hooks save a start mark for startup, resume, clear and fork, never compact. Tests use real Codex 0.164.0 records of the T662 proof, scrubbed and trimmed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
skills/sage/merge.mjs takes a pull request number and a head SHA. It runs only from the root thread, with the one-time merge permit of its exact tool call (taken by an atomic rename), and only when Codex's record still shows the owner's on switch and no Esc in the turn. No hook saves a merge permit yet, so it refuses every call, and the gate still refuses every recognized merge. T677 turns it on. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…k is required, the merge is bound to a repository (T663) F-T663-2: the owner record reader replays the owner's switches with core's switchModes, so an on counts only while sage mode is on, and the off form of the mode phrase ends autopilot. F-T663-5: autopilotSwitch takes the start mark itself and refuses a missing one; an owner message needs one metadata item for each content item. F-T663-4: the merge permit names the repository; gh runs with --repo, in an empty private folder of sage, without GH_HOST, GH_REPO and the enterprise tokens. F-T663-6 and F-T663-7: plain limit and refusal texts, each with a next step. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…T663-8) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-T663-15) Co-Authored-By: Claude Opus 5.5 <[email protected]>
… offs with an image, plain refusals (T663) - F-T663-10: a start mark saves only for the root thread, by the gate's threadOf; a start that cannot show its record is the root thread's never puts line 0 over a mark. - F-T663-12: a resume whose record cannot be counted saves no mark and removes the old one. - F-T663-13, F-T663-16: the limit lines name the folder that failed and the next step. - F-T663-11: an off phrase sent with an image counts, as it switches the sage hook off. - F-T663-14: each record refusal gives a plain cause and one step, the detail last. 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. The first of two pull requests for a Codex autopilot that merges (T663; the plan is PE R2589, the proof is T662). It adds three parts to the Codex plugin and turns none of them on. The owner sees no change: the Codex gate still refuses every merge, and no hook saves a merge permit, so the new merge command refuses every call. PR 2 (T677) adds the gate's admission and the guide.
Entry point (order 36). The owner installs the sage plugin in the Codex desktop app or the CLI, sends the mode phrase, then the autopilot on phrase. After PR 2, verified pull requests merge after their clean cycles.
The three parts
packages/sage-codex/hooks/owner-record.mjstranscript_path), with core'sexactPhraseandPHRASES. On counts only from a message whose every item has provenance user, in a turn with trigger user or exec. Off counts from any owner message; the mode off phrase also turns autopilot off. Only messages after the boundary count: the later of the lastsession_metaline and the start mark.session_meta, a Codex version outside 0.164 to 0.166 in the strict form, a boundary that does not fit the recordpackages/sage-codex/hooks/start-mark.mjs,session-start-hook.mjs(startup, resume, clear),sage-codex-hook.mjs(fork)marks/<stateKey>.jsonin the mode folder with an atomic rename: session, source, record line count,process.ppid. Never on compact, never for a child.packages/sage-codex/skills/sage/merge.mjs<pr> <40-char sha>; root thread only (CODEX_THREAD_IDequalsCODEX_SESSION_ID); takes the one-time merge permit ofCODEX_TOOL_CALL_ID(permits/<sha256(id)>.json) by atomic rename; re-reads the record from the permit's boundary right before gh; refuses on aturn_abortedevent of the permit's turn; thenexecFileSync("gh", ["pr","merge",pr,"--squash","--delete-branch","--match-head-commit",sha])with no shell and withoutGH_HOSTandGH_REPOgate-hook.mjsis unchanged, and so ischeckMerge.Tests
scripts/fixtures/codex-native/autopilot-record.test.mjs(14 tests): each reader case above, on real Codex 0.164.0 records of the T662 proof (owner-records.json: scrubbed of every local path and trimmed, with the probe phrases replaced by sage's phrases), and the start marks through the built hooks as Codex runs them: startup, resume, clear and fork save one; compact and a child save none; a failed save gives the limit line.scripts/fixtures/codex-native/autopilot-merge.test.mjs(9 tests): each merge command case above, as a process with a fake gh. PATH holds only the fakes folder and node runs by its absolute path, so no real gh can run; the first test proves the fake by its absolute path and by name. The last test shows that on this head no path merges: the gate refuses every gh merge also when the mode reader and the merge check say yes, and the merge command finds no merge permit.Not checked here
The desktop app (0.166.0-alpha.6) and a real Codex run: they are the QA proof of PR 2.
🤖 Generated with Claude Code