fix(sandbox): refresh install fingerprint after boot fast-forward - #5410
Merged
Merged
Conversation
stepClone captured currentBranchHead (via gitSetup's checkout) before maybeFastForwardToBase ran, so the install-skip cache fingerprinted against the pre-fast-forward commit. A later cycle landing back on that same pre-ff commit would then match the stale fingerprint and skip a needed install, even though the fast-forward had since moved the lockfile forward. Move the HEAD refresh to after the fast-forward so the fingerprint reflects what was actually installed against.
decocms Bot
pushed a commit
that referenced
this pull request
Jul 30, 2026
PR: #5410 fix(sandbox): refresh install fingerprint after boot fast-forward Bump type: patch - @decocms/sandbox (packages/sandbox/package.json): 1.28.2 -> 1.28.3 - deploy/helm/sandbox-env (chart 0.9.50) (deploy/helm/sandbox-env/values.yaml deploy/helm/sandbox-env/Chart.yaml): image.tag/appVersion -> 1.28.3 Deploy-Scope: both
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.
Bug found while reading
packages/sandbox/daemon/setup/orchestrator.tsafter the recent auto-fast-forward feature (#5390) and the no-install reporting fix (#5398).Bug:
stepClone()callsgitSetup(config)(which checks out the branch and callsrefreshBranchHead()to snapshotcurrentBranchHead) and only afterward callsmaybeFastForwardToBase(config.repoDir).stepInstall()'s install-skip cache (installState.isInstalledFor(config, this.currentBranchHead)) and itsmarkInstallSucceededcall both key off that samecurrentBranchHeadfield. Since the field is captured before the fast-forward runs, it's fingerprinting against the pre-fast-forward commit even though the fast-forward may have just advanced the branch (and its lockfile) further.Failure scenario: an idle sandbox on branch
feat/x(no local commits) resumes on boot.feat/xis behindorigin/main. The fast-forward advancesfeat/xtoorigin/mainbefore install runs, and install correctly picks up the new lockfile from disk — but the success is recorded under the stale, pre-fast-forward commit SHA. On a later boot/resume cycle wherefeat/xlands back at that same pre-ff commit (e.g. base hasn't moved further yet), the install-skip cache matches that stale fingerprint and skips the install entirely, even though a fresh fast-forward in that same cycle may have just changed the lockfile again.Fix: move the
refreshBranchHead()call to run aftermaybeFastForwardToBase()instepClone, so the fingerprint reflects the actual commit that was installed against (removed the now-redundant call insidegitSetup, its only caller).Regression test: added
SetupOrchestrator install fingerprint after boot fast-forwardinorchestrator.test.ts— sets up a real local bare repo withmaintwo commits ahead offeat/x, clonesfeat/x, drives the orchestrator through abranch-changetransition, and asserts the branch-head value passed intoinstallState.isInstalledForequals the actual post-fast-forwardgit rev-parse HEAD. Verified the test fails (captures the pre-fast-forward SHA) on the pre-fix code and passes after the fix.To verify:
cd packages/sandbox/daemon && bun test setup/orchestrator.test.ts -t "post-fast-forward"Checks run locally:
bun run fmt,bunx tsc --noEmitinpackages/sandbox(clean), and the single targeted test file above (14/15 pass; the one pre-existing failure — "reinstalls the pre-push hook after an install script clobbers it" — fails identically on main due to a missingcorepackbinary in this local sandbox, unrelated to this change). Full CI runs the rest of the suite.Summary by cubic
Fixes a stale install fingerprint after boot-time fast-forward by re-reading
HEADafter the fast-forward. This ensures the install cache keys off the post-FF commit and avoids skipping needed installs when the lockfile changes.stepClone(), runmaybeFastForwardToBase()beforerefreshBranchHead(), and remove the redundant refresh ingitSetup(), so the fingerprint uses the post-fast-forward SHA.installState.isInstalledForreceives the post-FFHEAD.Written for commit e2dd153. Summary will update on new commits.