Fix remote Main loops closing on connect: the pane launches a sketch, not graphcoded (#253) - #256
Merged
Merged
Conversation
…aunches a sketch (#253) A Main (sketch) loop opened on a remote project — a Codespace in the report — never reached its agent. The connect dial's missing-session branch keyed on `loopType == .turnBased` and sent every other type to wait for graphcoded, but a sketch is attended exactly like a turn-based loop: `runsUnattended` is goal-or-time only, so the daemon deliberately never ensures one and nothing ever started it. Over gh, where every nonzero exit flattens to 1, the retry loop redialed, found no session and no boot marker, and closed the pane with "Remote session ended while disconnected" — the transcript in the issue. The ownership split (8a27eb1, 192e450) predates the sketch type (5f7e85b), which never taught the remote dial about itself. Local sketches were unaffected. - `LoopType.runsUnattended` is the one rule for who launches; `LoopNode`'s property delegates to it. - Both remote dials gate the pane-owned restore on `!runsUnattended`, so a sketch gets the same resume-or-fresh launch a turn-based loop gets, on connect and behind a proven reboot. - Regression tests for the Claude and Copilot sketch dials. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pxwzz1AZnVE3peZ8qMejLa
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.
Fixes #253.
What was wrong
A Main (sketch) loop opened on a remote project never reached its agent. The reporter's transcript shows the whole failure:
The remote connect dial in
GhosttyTerminalView+Remote.remoteAgentScriptssplits a missing session by owner: a turn-based loop restores itself, everything else waits forgraphcoded. That split was written when the only attended type was turn-based (8a27eb1, 192e450, Aug 11–12). The sketch type landed three days later (5f7e85b) as a second attended type (runsUnattendedis goal-or-time only, so the daemon deliberately never ensures a sketch) and never taught the remote dial about itself.So a remote sketch:
exit 255. Nothing will ever start it.ghflattens every nonzero exit to 1, which the reconnect loop retries.exit 0, pane closes.Local sketches were unaffected: the local pane has no such gate.
The fix
LoopType.runsUnattendedis now the single rule for who launches a loop;LoopNode.runsUnattendeddelegates to it.!loopType.runsUnattended, so a sketch gets the same resume-or-fresh launch a turn-based loop gets, on connect and behind a proven reboot.RemoteLoopSurvivalTestsfor the Claude and Copilot (the reporter's backend) sketch dials.Verification
xcodebuild testin a worktree: 1508 tests in 156 suites passed (1506 before, +2 added), both new tests green.swiftlint0 errors,swift format lint --strictclean on the changed files.🤖 Generated with Claude Code
https://claude.ai/code/session_01Pxwzz1AZnVE3peZ8qMejLa