Repository navigation
fix(scripts): fork install waits until no agent turn is working - #51
Merged
Merged
Conversation
Quitting T3 Code (Fork) ends every agent session and terminal inside it, so fork:install cut off whatever agents were doing, and when an agent ran it from inside the app the quit could kill the installer between removing the old app and copying the new one. When the app is running, the install step now moves to a detached process and the command returns. It reads the app's database read-only and waits until no run is preparing, queued, starting or running, then quits, replaces and relaunches the app. Runs waiting on an approval or answer keep their question across the restart, so they don't hold it up. --now skips the wait, and a newer run replaces an install still waiting.
maschwenk
marked this pull request as ready for review
November 11, 2026 00:01
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.
fork:install used to quit T3 Code (Fork) right away, which kills every agent session, terminal and dev server inside it. if an agent ran it from inside the app it was worse: the quit kills the installer itself, possibly after it deleted the old app and before it copied the new one in
now when the app is running, the build still happens in the foreground (so build errors show up where you ran it), then the install step moves to a detached background process and the command returns. that process reads the app's
statev2.sqliteread-only every 5s and waits until no run ispreparing,queued,startingorrunning, two checks in a row since a finished turn can hand straight to a queued one. then it quits, replaces and relaunches like beforewaiting(approval or question for you) dont hold it up. they keep the question across the restart and you answer it after--nowskips the wait but still installs from the background processrelease/fork/install.log, and if the background install fails it pops a macos alert since nobody is watching ittradeoff: background tasks (dev servers, monitors) dont count as working, otherwise a long-running dev server would block the restart forever. t3 already tells the agent its background work got cancelled after a restart
checked against a fake app in /tmp with a copy of the script (fake app path + a harmless bundle id, so the real app was never touched): the handoff comes out detached (ppid 1, own process group), it waited on the 5 working turns in my real db read-only and named them in the log, a second run stopped the first, and with a controlled db it went ahead ~5s after the last busy run finished and swapped the app. the real quit/relaunch of T3 Code (Fork) hasn't been run with this yet
claude opus 5.5 in claude code did the work