Repository navigation
fix(sandbox): make the daemon's publish hooks-dir creation async - #5497
Merged
Merged
Conversation
publish() called mkdtempSync while running on the daemon's single-threaded Bun event loop, blocking it for the duration of the syscall — the same class of bug already fixed for the discard route (#5471) and decofile-block validation (#5481). Continue that conversion here: mkdtemp (fs/promises), awaited from the already-async publish() path.
pedrofrxncx
enabled auto-merge (squash)
July 31, 2026 15:18
decocms Bot
pushed a commit
that referenced
this pull request
Jul 31, 2026
PR: #5497 fix(sandbox): make the daemon's publish hooks-dir creation async Bump type: patch - @decocms/sandbox (packages/sandbox/package.json): 1.28.6 -> 1.28.7 - deploy/helm/sandbox-env (chart 0.9.54) (deploy/helm/sandbox-env/values.yaml deploy/helm/sandbox-env/Chart.yaml): image.tag/appVersion -> 1.28.7 Deploy-Scope: both
This was referenced Jul 31, 2026
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.
Continues the daemon's sync-fs → async-fs hardening pass (#5471 discard, #5481 decofile-block validation) for the same reason: any blocking
*Syncfs call on the daemon's single-threaded Bun event loop stalls the/healthprobe Studio polls, which can get the sandbox marked dead.Bug:
publish()'sgetEmptyHooksDir()calledmkdtempSync(creating the emptycore.hooksPathdir used to skip lefthook/husky on the publish commit) from inside the already-asyncpublish()handler, blocking the loop for the syscall's duration on the first publish of the daemon's lifetime.Fix: swap
mkdtempSync(node:fs) formkdtemp(node:fs/promises),awaited at the one call site insidepublish(). Behavior-preserving — same memoized dir, same path, same commit args; only the creation is now async. Net diff: +6/-5.Verify:
cd packages/sandbox && bunx tsc --noEmit(clean) andbun test packages/sandbox/daemon/routes/git.test.ts(51 pass, including the publish-path tests that exercise this helper).Locally ran:
bun run fmt, targetedtsc --noEmitinpackages/sandbox, the single test file above, andbunx oxlint packages/sandbox/daemon/routes/git.ts(0 warnings/errors). Full CI validates the rest.Summary by cubic
Made hooks directory creation in the sandbox daemon’s publish path async to avoid blocking the Bun event loop. This keeps the
/healthprobe responsive and prevents the sandbox from being marked dead.mkdtempSync(node:fs) with awaitedmkdtemp(node:fs/promises) inpublish()and passed it tocore.hooksPath.Written for commit 549fe42. Summary will update on new commits.