@runuai/host 0.9.5 → 0.9.6

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.
@@ -3172,6 +3172,38 @@ async function dockerStart(containerName: string): Promise<boolean> {
3172
3172
  return true;
3173
3173
  }
3174
3174
 
3175
+ /**
3176
+ * Repair the shared node data root before any recovered-container init.
3177
+ * Older task-up versions created the OpenCode leaf as root and accidentally
3178
+ * left this parent root-owned, which prevented code-server from creating its
3179
+ * managed User profile. `install -d` creates or repairs the exact directory
3180
+ * without recursively changing unrelated application state beneath it.
3181
+ */
3182
+ async function repairNodeDataRoot(containerName: string): Promise<boolean> {
3183
+ const res = await dockerCli([
3184
+ "exec",
3185
+ "-u",
3186
+ "root",
3187
+ containerName,
3188
+ "/usr/bin/install",
3189
+ "-d",
3190
+ "-o",
3191
+ "node",
3192
+ "-g",
3193
+ "node",
3194
+ "-m",
3195
+ "0755",
3196
+ "/home/node/.local/share",
3197
+ ]);
3198
+ if (res.status !== 0) {
3199
+ console.error(
3200
+ `[orchestrator] recovery: ${containerName} could not repair /home/node/.local/share ownership: ${res.stderr.trim() || `docker exec exited ${String(res.status)}`}`,
3201
+ );
3202
+ return false;
3203
+ }
3204
+ return true;
3205
+ }
3206
+
3175
3207
  async function dockerPort(
3176
3208
  containerName: string,
3177
3209
  containerPort: number,
@@ -3372,6 +3404,9 @@ async function recoverOneTask(
3372
3404
  });
3373
3405
  return true;
3374
3406
  }
3407
+ // uai-init seeds code-server's profile beneath this shared data root. Heal
3408
+ // containers created by older hosts before running it as node.
3409
+ await repairNodeDataRoot(containerName);
3375
3410
  // Correctly-owned Codex creds BEFORE uai-init / any agent respawn: the boot
3376
3411
  // reinject sweep only targets containers already running, so a container
3377
3412
  // recovered here would otherwise keep whatever it held when it exited —
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runuai/host",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Uai host — runs ephemeral AI coding tasks in Docker on a machine you control.",
5
5
  "license": "MIT",
6
6
  "author": "Diogo Perillo <diogo.perillo@gmail.com>",
@@ -1244,6 +1244,21 @@ managed_clean_env=(
1244
1244
  "PATH=/usr/bin:/bin"
1245
1245
  )
1246
1246
 
1247
+ # OpenCode and code-server share ~/.local/share. OpenCode credentials are
1248
+ # copied as root below, so creating only its leaf with `mkdir -p` can leave the
1249
+ # shared parent root-owned (live 2026-08-04). Then node cannot create
1250
+ # code-server's User profile and the editor silently falls back to its light,
1251
+ # full-chrome defaults. Repair both explicitly on every start/resume; GNU
1252
+ # `install -d` also corrects an existing directory with the wrong owner.
1253
+ if ! docker exec -u root "${managed_exec_env[@]}" "$app_container" \
1254
+ /usr/bin/install -d -o node -g node -m 0755 \
1255
+ /home/node/.local/share \
1256
+ /home/node/.local/share/opencode >/dev/null; then
1257
+ emit_err "CONTAINER_INIT_FAILED" \
1258
+ "Uai could not prepare the task's node-owned application data directory. Retry the task; the editor cannot load its settings until this succeeds." \
1259
+ "prepare container application data"
1260
+ fi
1261
+
1247
1262
  # Git rejects a repository owned by another uid even when its shared group is
1248
1263
  # writable. Trust only the selected worktrees in this task container—never `*`
1249
1264
  # and never the host cache. The task-private ~/.gitconfig makes these entries
@@ -1404,8 +1419,7 @@ docker exec -u root "$app_container" \
1404
1419
  # binary is baked into the image; here we copy the arch-independent auth+config.
1405
1420
  # ADR-076 EXTRA accounts (isolated dirs) are copied later from the host-agent
1406
1421
  # (provisionEngineAccounts) since they live in the sealed DB, not on disk here.
1407
- docker exec -u root "$app_container" \
1408
- mkdir -p /home/node/.local/share/opencode >/dev/null 2>&1 || true
1422
+ # The shared parent and this leaf were created with node ownership above.
1409
1423
  for oc_item in auth.json config.json; do
1410
1424
  if [ -e "$UAI_OWNER_HOME/.local/share/opencode/$oc_item" ]; then
1411
1425
  docker cp "$UAI_OWNER_HOME/.local/share/opencode/$oc_item" \