From 5a72a8e00b0fcd4e95523ab37b74f8321f1dd586 Mon Sep 17 00:00:00 2001 From: Khaliq Date: Fri, 19 Jun 2026 11:48:06 +0200 Subject: [PATCH] fix(factory): relax first-reconcile mount-ready timeout to 60s MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A CLI mount over a large `.integrations` tree can take well over 10s to complete its FIRST reconcile (early cycles hit `context deadline exceeded` while it materializes the tree), so the 10s `waitForStateFile` wait reported a spurious "relayfile mount did not become ready within 10000ms" on a mount that was simply still bootstrapping — and the daemon then warned "writeback may not propagate" even though the mount came up and reconciled seconds later. Bump the default to 60s (named `DEFAULT_STATE_READY_TIMEOUT_MS`); callers can still override via `stateWaitTimeoutMs`. 49 mount tests green; build clean. Co-Authored-By: Claude Opus 4.8 --- src/mount/local-mount-preflight.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mount/local-mount-preflight.ts b/src/mount/local-mount-preflight.ts index beb97d0..24f78b0 100644 --- a/src/mount/local-mount-preflight.ts +++ b/src/mount/local-mount-preflight.ts @@ -6,6 +6,15 @@ import { checkMountStaleness, coercePid, resolveRelayfileCli, resolveRelayfileMo const STATE_FILE = '.integrations/.relay/state.json' +// How long to wait for a freshly-spawned mount to write a valid state.json +// (workspace match + a live pid). A CLI mount over a large `.integrations` tree +// can take well over 10s to complete its FIRST reconcile (early cycles hit +// `context deadline exceeded` while it materializes the tree), so a 10s wait +// reported a spurious "did not become ready" on a mount that was simply still +// bootstrapping. 60s covers that without blocking startup indefinitely. Callers +// can still override via `stateWaitTimeoutMs`. +const DEFAULT_STATE_READY_TIMEOUT_MS = 60_000 + interface EnsureLocalMountOptions { stateWaitTimeoutMs?: number stateWaitPollMs?: number @@ -144,7 +153,7 @@ function runRelayfile(command: string, args: string[], startDir: string, workspa async function waitForStateFile( stateFilePath: string, workspaceId: string, - timeoutMs = 10_000, + timeoutMs = DEFAULT_STATE_READY_TIMEOUT_MS, pollMs = 200, acceptableWorkspaceIds: readonly string[] = [], ): Promise {