Launch Codex loops with their graph briefing - #349
Merged
Merged
Conversation
The notify override carried its reporter script inline, leaving the launch ~650 bytes before any goal, so every Codex loop shed its briefing. The script now lives in a hooks file (written locally, and by the remote ensure on the host) and the override only names it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
# Conflicts: # graphcode/Tests/ZmxSessionLauncherTests.swift
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.
Problem
Every Codex loop launched without its graph briefing, at any goal length.
zmxtypes the launch command into a tty, andZmxSessionLauncherbudgets that line at 800 bytes. The Codex-c notify=…override carried its whole reporter script inline as TOML. That put the command at ~657 bytes with a 1-character goal, so adding the briefing (--add-dirplus the pointer preamble) always overran. The fallback then dropped the briefing. A 4000-character goal still overran even after the prompt moved to a file.Fix
The notify script moves into a hooks file,
codex-notify.sh, and the override now only names it:PresenceHooks.write(forBackend: .codex)writes the script to the support directory. The override isnotify=["/bin/sh","<path>"].PresenceHooks.remoteWriteFragment(forBackend: .codex)writes the script on the host. The ensure dial and the app's remote connect both already run this fragment. The override isnotify=["/bin/sh","-c","exec /bin/sh \"$HOME/.graphcode/hooks/codex-notify.sh\" \"$0\""], so$HOMEexpands on the host.The script is the same as before, except it reads the event JSON from
$1. Resume launches go through the samepresenceArgumentspath, so they shrink as well. Claude Code, Copilot, OpenCode and pi are unchanged.Tests
ZmxSessionLauncherTests.aCodexLoopLaunchesBriefedAtEveryGoalLengthcovers a Codex loop at short, medium and long goals, for a local project and for anssh://project. The medium goal is sized from the measured briefed baseline so it fills the line to its edge; the long goal is ~4000 characters. Each launch must fit the typed line, keep the briefing and keep the notify override.origin/main: exit 65, 10 issues (no headroom; briefing missing at all three lengths; long goal overruns the line).RemoteLoopSurvivalTests.copilotAndCodexRestoreWithTheirOwnResumeSyntaxchecked for the sessions path inside the old inline override. It now checks that the resume command namescodex-notify.sh, and that the hooks write the restore runs first (restorePreparation) banks the thread ID into the sessions directory.CodexPresenceTestsnow actually runs the script both ways, local path and the remote$HOMEform, against a fakezmx. It checks that the thread ID lands in<node>.idand thatpresence=idleis reported.Gate
On
1a379307(= remote head,origin/mainwith #347 merged in), private DerivedData:xcodebuild test(full)origin/main(fbf323ad, with #347)graphcode-cli/graphcodedbuild1bd3b04a; later commits touch tests only, plus the merge of #347)scripts/cli-smoke.sh(SwiftPM build)#347 is merged into this branch with a merge commit (no force-push). The only conflict was
ZmxSessionLauncherTests.swift, where both tests are kept.ZmxSessionLauncher.swiftis identical toorigin/main, so #347's order (prompt to file before dropping the briefing) stands.