feat(t3x): auto-build the desktop app from origin/main in a dedicated worktree - #28
Merged
Conversation
The desktop watcher compared the local checkout's HEAD against the last-built marker but never fetched, so the installed app only updated when local main was manually pulled — and any agent switching branches in that checkout could change what gets built and installed. Add --ref <remote>/<branch>: each tick fetches the remote, pins a dedicated build worktree (T3X_AUTOBUILD_WORKTREE, default <repo>-build) to that ref's sha with a detached forced checkout, and builds there. The main checkout is never read for builds. - Source of truth is the remote-tracking ref (worktrees share refs); the worktree is only checkout machinery, created on first use. - Fresh worktree bootstrap: install deps when node_modules is missing, not only when the lockfile diff says so — a new worktree with an unchanged lockfile would otherwise always fail its first build. - Fetch failure writes fetch-failed status and retries next tick without advancing the marker. - --ref forwards through the caffeinate re-exec and is emitted by --print-launchd; the emitted WorkingDirectory stays the main repo because launchd refuses a job whose working directory is missing. - Guard against pointing the build worktree at the repo itself (the forced checkout would clobber the working tree). Zero upstream seams: everything lives under scripts/t3x/ + docs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Why
The desktop auto-build watcher never fetched — it compared the local checkout's HEAD against the last-built marker, so the installed app only updated after a manual
git pull, and any agent switching branches in~/Developer/t3codecould change (or break) what gets built and installed.Raj asked for the watcher to track
origin/mainso local agents can work on repo branches without affecting the app (seedocs/superpowers/specs/2026-07-27-autobuild-origin-main-design.md).What
New
--ref <remote>/<branch>mode forscripts/t3x/auto-build-desktop.sh:git fetch→ resolve the remote-tracking sha → pin a dedicated build worktree (T3X_AUTOBUILD_WORKTREE, default<repo>-build) to it with a detached forced checkout → build there. The main checkout is never read for builds.node_modulesis missing, not only on a lockfile diff (a new worktree with an unchanged lockfile would otherwise always fail its first build).fetch-failedstatus, marker not advanced, retried next tick under the existing backoff.--refforwards through the caffeinate re-exec and is emitted by--print-launchd(+T3X_AUTOBUILD_WORKTREEenv). EmittedWorkingDirectorystays the main repo — launchd refuses a job whose working directory doesn't exist yet.Deployment (separate, machine-side): the
dev.t3x.autobuildLaunchAgent gains--ref origin/main --relaunchso unattended installs reopen the app and the Tailscale surface self-heals.Testing
bash -n; flag validation (ref format, unknown remote, self-worktree guard)origin/main's sha; bootstrap install triggered; failure wrotebuild-failedand did not advance the marker; stale worktree re-synced on next run--print-launchdoutput passesplutil -lintZero upstream seams — everything under
scripts/t3x/+docs/.🤖 Generated with Claude Code