Prevent workspace file watching from stalling the daemon (#2858)

* fix(server): pin workspace file watchers to native backends

Backend auto-detection could select an IPC watcher whose subscription lock deadlocked the Node worker pool during watcher reconfiguration. Select the host-native backend explicitly so filesystem work, logging, and relay DNS cannot be starved by that path.

* test(server): cover native watcher production boundary

Route the existing real filesystem observation test through the same subscription function used by the daemon. This proves native watcher selection and reconfiguration with actual file events instead of only testing the platform selector.

* test(server): synchronize native watcher readiness

Replace fixed startup sleeps with a real tracked-file event barrier. Native backends can resolve their subscription before the initial stream is fully drained, so the integration test now begins assertions only after an event has been delivered and refreshed.

* fix(server): measure native workspace watchers
This commit is contained in:
Mohamed Boudra
2026-08-04 13:09:30 +02:00
committed by GitHub
parent df32e6ddcd
commit 7b6965856b
4 changed files with 62 additions and 8 deletions
@@ -17,6 +17,7 @@ import {
} from "../src/utils/run-git-command.js";
import { CheckoutDiffManager } from "../src/server/checkout-diff-manager.js";
import {
subscribeToWorkspaceFileChanges,
WorkspaceGitServiceImpl,
type WorkspaceGitRuntimeSnapshot,
} from "../src/server/workspace-git-service.js";
@@ -94,7 +95,7 @@ function createTrackedSubscriber(failWorktreeRoot: string | null) {
if (failWorktreeRoot && path.resolve(args[0]) === failWorktreeRoot) {
throw new Error("measurement watcher setup failure");
}
const subscription = await parcelWatcher.subscribe(...args);
const subscription = await subscribeToWorkspaceFileChanges(...args);
subscriptions.add(subscription);
return {
unsubscribe: async () => {