Skip to content

Launch Codex loops with their graph briefing - #349

Merged
scgopi merged 6 commits into
mainfrom
fix/codex-briefing-fits
Sep 13, 2026
Merged

scgopi merged 6 commits into
mainfrom
fix/codex-briefing-fits

Conversation

@scgopi

@scgopi scgopi commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Problem

Every Codex loop launched without its graph briefing, at any goal length.

zmx types the launch command into a tty, and ZmxSessionLauncher budgets 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-dir plus 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:

  • Local: PresenceHooks.write(forBackend: .codex) writes the script to the support directory. The override is notify=["/bin/sh","<path>"].
  • Remote: 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 is notify=["/bin/sh","-c","exec /bin/sh \"$HOME/.graphcode/hooks/codex-notify.sh\" \"$0\""], so $HOME expands on the host.

The script is the same as before, except it reads the event JSON from $1. Resume launches go through the same presenceArguments path, so they shrink as well. Claude Code, Copilot, OpenCode and pi are unchanged.

Tests

  • ZmxSessionLauncherTests.aCodexLoopLaunchesBriefedAtEveryGoalLength covers a Codex loop at short, medium and long goals, for a local project and for an ssh:// 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.
    • Fails on origin/main: exit 65, 10 issues (no headroom; briefing missing at all three lengths; long goal overruns the line).
    • Passes with the fix.
  • RemoteLoopSurvivalTests.copilotAndCodexRestoreWithTheirOwnResumeSyntax checked for the sessions path inside the old inline override. It now checks that the resume command names codex-notify.sh, and that the hooks write the restore runs first (restorePreparation) banks the thread ID into the sessions directory.
  • CodexPresenceTests now actually runs the script both ways, local path and the remote $HOME form, against a fake zmx. It checks that the thread ID lands in <node>.id and that presence=idle is reported.

Gate

On 1a379307 (= remote head, origin/main with #347 merged in), private DerivedData:

Step Result
xcodebuild test (full) exit 0: 1756 tests / 185 suites / 0 failures
New test on pre-fix origin/main (fbf323ad, with #347) exit 65, 10 issues; #347's test passes there
graphcode-cli / graphcoded build exit 0 / exit 0 (on 1bd3b04a; later commits touch tests only, plus the merge of #347)
scripts/cli-smoke.sh (SwiftPM build) exit 0, 5/5 commands (pre-merge)
swiftlint / swift-format --strict 0 errors / clean
Linux build pass

#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.swift is identical to origin/main, so #347's order (prompt to file before dropping the briefing) stands.

scgopi and others added 6 commits September 13, 2026 11:07
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
@scgopi
scgopi merged commit 691f657 into main Sep 13, 2026
1 check passed
@scgopi
scgopi deleted the fix/codex-briefing-fits branch September 13, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant