@runuai/host 0.9.136 → 0.9.137

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -125,10 +125,40 @@ export function sharedFilesMountPlans(
125
125
  * could not be mounted (the task still starts, like the machine copy path),
126
126
  * null when clean or when there is nothing to mount.
127
127
  */
128
+ /** One mount pass per workspace at a time. Task-up (the cloud's wake) and
129
+ * the sidecar's own resume pass both mount on a runner restart, and the
130
+ * shell's `mountpoint -q` guard is not atomic across two racers: live
131
+ * 2026-09-12 both ran in the same second — /files/org got two stacked
132
+ * mounts and the loser on /files/me failed with "fuse: mountpoint is not
133
+ * empty", surfaced to the human as a warning although the files were
134
+ * mounted. The second pass now waits and finds the healthy mount. */
135
+ const mountPasses = new Map<string, Promise<unknown>>();
136
+
137
+ async function serializedByWorkspace<T>(workspacePath: string, run: () => Promise<T>): Promise<T> {
138
+ const previous = mountPasses.get(workspacePath) ?? Promise.resolve();
139
+ const next = previous.catch(() => undefined).then(run);
140
+ mountPasses.set(workspacePath, next);
141
+ try {
142
+ return await next;
143
+ } finally {
144
+ if (mountPasses.get(workspacePath) === next) mountPasses.delete(workspacePath);
145
+ }
146
+ }
147
+
128
148
  export async function mountSharedFilesFromLease(
129
149
  handle: TaskEnvironmentHandle<unknown>,
130
150
  workspacePath: string,
131
151
  task: { sharedFiles?: string },
152
+ ): Promise<string | null> {
153
+ return serializedByWorkspace(workspacePath, () =>
154
+ mountSharedFilesFromLeaseNow(handle, workspacePath, task),
155
+ );
156
+ }
157
+
158
+ async function mountSharedFilesFromLeaseNow(
159
+ handle: TaskEnvironmentHandle<unknown>,
160
+ workspacePath: string,
161
+ task: { sharedFiles?: string },
132
162
  ): Promise<string | null> {
133
163
  const mode: SharedFilesMode =
134
164
  task.sharedFiles === "rw" ? "rw" : task.sharedFiles === "off" ? "off" : "ro";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runuai/host",
3
- "version": "0.9.136",
3
+ "version": "0.9.137",
4
4
  "description": "Uai host — runs ephemeral AI tasks in containers on a machine you control.",
5
5
  "license": "MIT",
6
6
  "author": "Uai Tech <team@runuai.com>",