@crvouga/homelab 0.23.7 → 0.23.9

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.
@@ -3,55 +3,62 @@
3
3
  hosts: localhost
4
4
  connection: local
5
5
  gather_facts: false
6
+ vars:
7
+ t3_activation_script: |
8
+ ObjC.import('AppKit');
9
+ ObjC.bindFunction('kill', ['int', ['int', 'int']]);
10
+ function run(argv) {
11
+ const [bundleId, path, version, convergePid] = argv;
12
+ // Ansible runs this task under a detached async supervisor when
13
+ // converge itself is running inside the desktop being replaced.
14
+ const pid = Number(convergePid);
15
+ while (pid && $.kill(pid, 0) === 0) delay(1);
16
+
17
+ const running = () => $.NSRunningApplication.runningApplicationsWithBundleIdentifier(bundleId);
18
+ const matches = (app) => ObjC.unwrap(app.bundleURL.path) === path &&
19
+ ObjC.unwrap($.NSBundle.bundleWithURL(app.bundleURL).objectForInfoDictionaryKey('CFBundleShortVersionString')) === version;
20
+ const apps = running();
21
+ if (Number(apps.count) > 1) throw Error('Multiple T3 desktops are running');
22
+ if (Number(apps.count) === 1) {
23
+ const app = apps.objectAtIndex(0);
24
+ if (matches(app)) return;
25
+ if (!app.forceTerminate) throw Error('Could not terminate T3');
26
+ for (let n = 0; !app.isTerminated && n < 100; n++) delay(0.1);
27
+ if (!app.isTerminated) throw Error('T3 did not exit');
28
+ }
29
+ const open = $.NSTask.alloc.init;
30
+ open.launchPath = '/usr/bin/open';
31
+ open.arguments = $([path]);
32
+ open.launch;
33
+ open.waitUntilExit;
34
+ if (Number(open.terminationStatus) !== 0) throw Error('Could not open T3');
35
+ for (let n = 0; n < 15; n++) {
36
+ const live = running();
37
+ if (Number(live.count) === 1 && matches(live.objectAtIndex(0))) return;
38
+ delay(1);
39
+ }
40
+ throw Error('The verified T3 desktop did not start');
41
+ }
6
42
  tasks:
7
- - name: Terminate the running desktop and wait for its exit
43
+ - name: Activate and verify the pinned manager desktop
8
44
  ansible.builtin.command:
9
45
  argv:
10
46
  - /usr/bin/osascript
11
47
  - -l
12
48
  - JavaScript
13
49
  - -e
14
- - |
15
- ObjC.import('AppKit');
16
- function run(argv) {
17
- const apps = $.NSRunningApplication.runningApplicationsWithBundleIdentifier(argv[0]);
18
- if (Number(apps.count) === 0) return;
19
- if (Number(apps.count) !== 1) throw Error('Multiple T3 desktops are running');
20
- const app = apps.objectAtIndex(0);
21
- if (ObjC.unwrap(app.bundleURL.path) === argv[1]) return;
22
- if (!app.forceTerminate) throw Error('Could not terminate T3');
23
- for (let n = 0; n < 100; n++) {
24
- if (app.isTerminated) return;
25
- delay(0.1);
26
- }
27
- throw Error('T3 did not exit');
28
- }
29
- - '{{ bundle_id }}'
30
- - '{{ desktop_path }}'
31
- changed_when: true
32
- - name: Open the verified manager desktop
33
- ansible.builtin.command:
34
- argv: [/usr/bin/open, '{{ desktop_path }}']
35
- changed_when: true
36
- - name: Wait for Launch Services to report the verified desktop
37
- ansible.builtin.command:
38
- argv:
39
- - /usr/bin/osascript
40
- - -l
41
- - JavaScript
42
- - -e
43
- - |
44
- ObjC.import('AppKit');
45
- function run(argv) {
46
- const apps = $.NSRunningApplication.runningApplicationsWithBundleIdentifier(argv[0]);
47
- if (Number(apps.count) !== 1 || ObjC.unwrap(apps.objectAtIndex(0).bundleURL.path) !== argv[1])
48
- throw Error('Waiting for the verified desktop');
49
- }
50
+ - '{{ t3_activation_script }}'
50
51
  - '{{ bundle_id }}'
51
52
  - '{{ desktop_path }}'
53
+ - '{{ desktop_version }}'
54
+ - '{{ converge_pid }}'
55
+ async: '{{ 7200 if converge_pid | int else 0 }}'
56
+ poll: 0
57
+ register: t3_activation
52
58
  when: not ansible_check_mode
53
- register: launched
54
- retries: 15
55
- delay: 1
56
- until: launched.rc == 0
57
- changed_when: false
59
+ changed_when: true
60
+
61
+ - name: Report the detached activation job
62
+ ansible.builtin.debug:
63
+ msg: 'T3 activation job {{ t3_activation.ansible_job_id }}'
64
+ when: not ansible_check_mode and converge_pid | int != 0
@@ -6,7 +6,7 @@
6
6
  name = "homelab-ansible"
7
7
  version = "0"
8
8
  requires-python = "==3.15.2"
9
- dependencies = ["ansible-core==2.22.0"]
9
+ dependencies = ["ansible-core==2.22.1"]
10
10
 
11
11
  [tool.uv]
12
12
  package = false
@@ -227,6 +227,7 @@
227
227
  "intervalSeconds": 2,
228
228
  "refusedExitCode": 75
229
229
  },
230
+ "diskGuardScript": "/usr/local/lib/personal-fleet-disk-guard.py",
230
231
  "diskGuardWriteMiB": 32,
231
232
  "diskGuardIntervalSeconds": 5,
232
233
  "diskGcIdleDays": 7,
@@ -270,6 +271,7 @@
270
271
  "dockerLogMaxFiles": "3",
271
272
  "inodeWarnFreePercent": 10,
272
273
  "inodeFailFreePercent": 2,
274
+ "diskGcScript": "/usr/local/lib/personal-fleet-disk-gc.py",
273
275
  "diskGcMemoryMaxMiB": 2048,
274
276
  "diskGcGitTempHours": 1,
275
277
  "diskGcFetchMaxMiB": 256
@@ -343,6 +343,14 @@
343
343
  checksum_algorithm: sha256
344
344
  register: disk_guard_source
345
345
  when: development_source is defined
346
+ - name: Install the tracked disk guard outside pruned revisions
347
+ ansible.builtin.copy:
348
+ src: '{{ playbook_dir }}/disk-guard.py'
349
+ dest: '{{ resourceSafety.diskGuardScript }}'
350
+ owner: root
351
+ group: root
352
+ mode: '0644'
353
+ when: development_source is defined and disk_guard_source.stat.exists
346
354
  - name: Declare the disk guard service
347
355
  ansible.builtin.copy:
348
356
  dest: /etc/systemd/system/personal-fleet-disk-guard.service
@@ -357,7 +365,7 @@
357
365
  StartLimitIntervalSec=0
358
366
  [Service]
359
367
  Type=simple
360
- ExecStart=/usr/bin/python3 -I -B {{ disk_guard_source.stat.path }} --path / --path {{ development_home }} --floor-mib {{ worker_disk_guard_floor_mib }} --inode-floor-percent {{ resourceSafety.inodeFailFreePercent }} --managed-cgroup /sys/fs/cgroup/system.slice/personal-fleet-disk-gc.service --write-mib {{ resourceSafety.diskGuardWriteMiB }} --interval {{ resourceSafety.diskGuardIntervalSeconds }}
368
+ ExecStart=/usr/bin/python3 -I -B {{ resourceSafety.diskGuardScript }} --path / --path {{ development_home }} --floor-mib {{ worker_disk_guard_floor_mib }} --inode-floor-percent {{ resourceSafety.inodeFailFreePercent }} --managed-cgroup /sys/fs/cgroup/system.slice/personal-fleet-disk-gc.service --write-mib {{ resourceSafety.diskGuardWriteMiB }} --interval {{ resourceSafety.diskGuardIntervalSeconds }}
361
369
  Restart=always
362
370
  RestartSec=5
363
371
  OOMScoreAdjust=-1000
@@ -392,6 +400,16 @@
392
400
  checksum_algorithm: sha256
393
401
  register: disk_gc_source
394
402
  when: development_source is defined
403
+ # Keep the running collector outside the revision cache it prunes. This also
404
+ # supports applying the resource play independently of a toolchain/T3 rollout.
405
+ - name: Install the tracked disk GC outside pruned revisions
406
+ ansible.builtin.copy:
407
+ src: '{{ playbook_dir }}/disk-gc.py'
408
+ dest: '{{ resourceSafety.diskGcScript }}'
409
+ owner: root
410
+ group: root
411
+ mode: '0644'
412
+ when: development_source is defined and disk_gc_source.stat.exists
395
413
  # storage.disposable in fleet.json (fleet_storage_disposable) switches every
396
414
  # node to the disposable policy (docs/ubuntu-sync.md, Disk GC): hours instead
397
415
  # of days, worktrees saved in a recovery ref or done with on their remote,
@@ -422,7 +440,7 @@
422
440
  After=docker.service
423
441
  [Service]
424
442
  Type=oneshot
425
- ExecStart=/usr/bin/python3 -I -B {{ disk_gc_source.stat.path }} --home {{ development_home }} --git-temp-hours {{ resourceSafety.diskGcGitTempHours }} --fetch-max-mib {{ resourceSafety.diskGcFetchMaxMiB }} --path / --path {{ development_home }} --idle-days {{ gc_idle_days }} --pressure-mib {{ worker_disk_gc_pressure_mib }}{{ (' --target-used-percent ' ~ (fleet_storage_target_used_percent | default(gc_disposable.targetUsedPercent))) if disposable else '' }} --pressure-inode-percent {{ resourceSafety.inodeWarnFreePercent }} --pressure-idle-hours {{ resourceSafety.diskGcPressureIdleHours }} --docker-age-hours {{ resourceSafety.diskGcDockerAgeHours }} --pressure-docker-age-hours {{ resourceSafety.diskGcPressureDockerAgeHours }} --docker-cap-percent {{ resourceSafety.diskGcBuildCachePercent }} --host-var-tmp /run/homelab-host-var-tmp --host-tmp /run/homelab-host-tmp --mise-cache-mib {{ resourceSafety.diskGcMiseCacheMiB }} --home-cache-mib {{ resourceSafety.diskGcHomeCacheMiB }}{% for cache in resourceSafety.diskGcExcludedCaches %} --exclude-cache {{ cache }}{% endfor %}{% for store, mib in resourceSafety.diskGcStoreCapsMiB.items() %} --store-cap {{ store }}={{ mib }}{% endfor %}{% for root in resourceSafety.diskGcWorktreeRoots %} --worktree-root {{ root }}{% endfor %} --worktree-idle-days {{ gc_worktree_idle_days }}{{ ' --disposable' if disposable else '' }}{% for cache, mib in resourceSafety.diskGcCacheCapsMiB.items() %} --cache-cap {{ cache }}={{ mib }}{% endfor %} --keep-newest /var/cache/personal-fleet={{ resourceSafety.diskGcPackagesKept }}{% for root in resourceSafety.diskGcCheckoutRoots %} --keep-checkouts {{ root }}={{ resourceSafety.diskGcCheckoutsKept }}{% endfor %} --current {{ resourceSafety.diskGcCurrentCheckout }}{% for directory, hours in resourceSafety.diskGcExpireHours.items() %} --expire {{ directory }}={{ hours }}{% endfor %} --report {{ resourceSafety.diskGcReport }} --mise {{ development_home }}/.local/bin/mise --user {{ development_user }}{{ '' if worker_containers_on | default(true) | bool else ' --no-docker' }}
443
+ ExecStart=/usr/bin/python3 -I -B {{ resourceSafety.diskGcScript }} --home {{ development_home }} --git-temp-hours {{ resourceSafety.diskGcGitTempHours }} --fetch-max-mib {{ resourceSafety.diskGcFetchMaxMiB }} --path / --path {{ development_home }} --idle-days {{ gc_idle_days }} --pressure-mib {{ worker_disk_gc_pressure_mib }}{{ (' --target-used-percent ' ~ (fleet_storage_target_used_percent | default(gc_disposable.targetUsedPercent))) if disposable else '' }} --pressure-inode-percent {{ resourceSafety.inodeWarnFreePercent }} --pressure-idle-hours {{ resourceSafety.diskGcPressureIdleHours }} --docker-age-hours {{ resourceSafety.diskGcDockerAgeHours }} --pressure-docker-age-hours {{ resourceSafety.diskGcPressureDockerAgeHours }} --docker-cap-percent {{ resourceSafety.diskGcBuildCachePercent }} --host-var-tmp /run/homelab-host-var-tmp --host-tmp /run/homelab-host-tmp --mise-cache-mib {{ resourceSafety.diskGcMiseCacheMiB }} --home-cache-mib {{ resourceSafety.diskGcHomeCacheMiB }}{% for cache in resourceSafety.diskGcExcludedCaches %} --exclude-cache {{ cache }}{% endfor %}{% for store, mib in resourceSafety.diskGcStoreCapsMiB.items() %} --store-cap {{ store }}={{ mib }}{% endfor %}{% for root in resourceSafety.diskGcWorktreeRoots %} --worktree-root {{ root }}{% endfor %} --worktree-idle-days {{ gc_worktree_idle_days }}{{ ' --disposable' if disposable else '' }}{% for cache, mib in resourceSafety.diskGcCacheCapsMiB.items() %} --cache-cap {{ cache }}={{ mib }}{% endfor %} --keep-newest /var/cache/personal-fleet={{ resourceSafety.diskGcPackagesKept }}{% for root in resourceSafety.diskGcCheckoutRoots %} --keep-checkouts {{ root }}={{ resourceSafety.diskGcCheckoutsKept }}{% endfor %} --current {{ resourceSafety.diskGcCurrentCheckout }}{% for directory, hours in resourceSafety.diskGcExpireHours.items() %} --expire {{ directory }}={{ hours }}{% endfor %} --report {{ resourceSafety.diskGcReport }} --mise {{ development_home }}/.local/bin/mise --user {{ development_user }}{{ '' if worker_containers_on | default(true) | bool else ' --no-docker' }}
426
444
 
427
445
  StateDirectory=personal-fleet-disk-gc
428
446
  StateDirectoryMode=0755
package/ansible/uv.lock CHANGED
@@ -20,7 +20,7 @@ wheels = [
20
20
 
21
21
  [[package]]
22
22
  name = "ansible-core"
23
- version = "2.22.0"
23
+ version = "2.22.1"
24
24
  source = { registry = "https://pypi.org/simple" }
25
25
  dependencies = [
26
26
  { name = "cryptography" },
@@ -29,9 +29,9 @@ dependencies = [
29
29
  { name = "pyyaml" },
30
30
  { name = "resolvelib" },
31
31
  ]
32
- sdist = { url = "https://files.pythonhosted.org/packages/9d/9c/320090b2f1542122259cd759d5148678fd98945913837ee05718920f73ea/ansible_core-2.22.0.tar.gz", hash = "sha256:bf50b4a0cfa985e30585c7ba301897ea7050d224ca49d2816cab10e33a160e1c", size = 3476434, upload-time = "2026-11-02T17:35:11.837Z" }
32
+ sdist = { url = "https://files.pythonhosted.org/packages/a0/ab/738458619153c2bd32a8d1c6da68530c1092151a3016f0879ea34998644a/ansible_core-2.22.1.tar.gz", hash = "sha256:6e6d1a811f23e811b3279ffc18d856a885647402f60d342276885ba9d5e70475", size = 3484760, upload-time = "2026-11-30T18:59:32.856Z" }
33
33
  wheels = [
34
- { url = "https://files.pythonhosted.org/packages/87/98/3dc2d37181dc6a4b39d7badffaa0ef6e95be638d618372a11c316a2f8983/ansible_core-2.22.0-py3-none-any.whl", hash = "sha256:8285d4cc81c3e3eb2d954e75531724fe0ae154d228475638123451f034a74657", size = 2488530, upload-time = "2026-11-02T17:35:09.491Z" },
34
+ { url = "https://files.pythonhosted.org/packages/75/51/ec2ef298431b275eb26f206f71a2b8cb1bb43e83649cdbc1f6ef7ad3f459/ansible_core-2.22.1-py3-none-any.whl", hash = "sha256:12faa3d9d61e4334bc8b38be6bb896196feafd240778c119f31e901329a79b59", size = 2478965, upload-time = "2026-11-30T18:59:31.362Z" },
35
35
  ]
36
36
 
37
37
  [[package]]
@@ -222,7 +222,7 @@ lint = [
222
222
  ]
223
223
 
224
224
  [package.metadata]
225
- requires-dist = [{ name = "ansible-core", specifier = "==2.22.0" }]
225
+ requires-dist = [{ name = "ansible-core", specifier = "==2.22.1" }]
226
226
 
227
227
  [package.metadata.requires-dev]
228
228
  lint = [{ name = "ansible-lint", specifier = "==26.11.1" }]
@@ -94,6 +94,6 @@ and published themes. Workers install changed files and remove retired files
94
94
  with `ansible/t3/customizations.yml`. The manager uses the same playbook when
95
95
  recovering these files from fleet state.
96
96
 
97
- The manager switches a running desktop to its verified release with `ansible/macos/t3-activate.yml` only when that desktop's release differs from the pin. The same release stays running, including a copy that is not the managed path. A converge started inside the desktop that would be quit stages the new bundle and leaves the process running (`T3_DESKTOP_SWITCH_DEFERRED`); the next converge from another session switches it.
97
+ The manager switches a running desktop to its verified release with `ansible/macos/t3-activate.yml` only when that desktop's release differs from the pin. The same release stays running, including a copy that is not the managed path. A converge started inside the desktop schedules activation in a detached Ansible job (`T3_DESKTOP_ACTIVATION_SCHEDULED`). The job waits for converge to exit, then restarts T3 even during active turns and verifies the running release.
98
98
 
99
99
  `ansible/macos/legacy-monitoring.yml` applies only the guarded legacy monitoring retirement through `converge --only legacy-monitoring`; `--dry-run` uses Ansible check mode. It verifies the replacement process before and after retiring the exact predecessor, without restarting it.
package/docs/runbooks.md CHANGED
@@ -354,7 +354,7 @@ runaway, write `1` to that agent scope’s `cgroup.kill`.
354
354
  - `T3_PRIVATE_ROUTE_UNVERIFIED`: t3 private route unverified.
355
355
  - `T3_CLIENT_SETTINGS_UNVERIFIED`: check the manager’s T3 client-settings.json, fleet state availability and the worker desktop service, then rerun converge. A pending desktop restart is retried.
356
356
  - `T3_DESKTOP_ACTIVATION_FAILED`: open the verified manager bundle named in the remedy and rerun converge.
357
- - `T3_DESKTOP_SWITCH_DEFERRED`: a warning of `t3:version`. The pinned desktop is staged, and the running desktop is another release, but this converge is a child of that desktop. Quitting it would end the converge. Run `homelab converge` again from Terminal or another session; that run switches to the verified bundle.
357
+ - `T3_DESKTOP_ACTIVATION_SCHEDULED`: the detached Ansible job waits for converge to exit, then restarts T3 and verifies the pinned release. The remedy names its result file. If the job failed, check the result and rerun converge.
358
358
  - `T3_CUSTOMIZATIONS_CONFLICT`: inspect the ownership marker in the manager’s T3 userdata directory. Move an unrelated marker aside before recovering the saved snapshot.
359
359
  - `T3_CUSTOMIZATIONS_INVALID`: check that keybindings are a JSON array, theme files are regular files listed by the pinned T3 CLI, and the encoded customization snapshot fits the 1 MiB fleet state document limit.
360
360
  - `T3_CLIENT_SETTINGS_INVALID`: repair the manager’s client-settings.json so its settings are a JSON object.
@@ -381,7 +381,7 @@ runaway, write `1` to that agent scope’s `cgroup.kill`.
381
381
  - `T3_SERVER_STOPPED`: t3 server stopped: the lingering `t3code-headless.service` of a headless worker is not running.
382
382
  - `T3_SETTINGS_BUSY`: t3 settings busy.
383
383
  - `T3_VERSION_UNKNOWN`: a warning of `t3:version`: T3 on the machine the check names has not recorded the version it runs, so it cannot be compared with the pin. Start T3 there once, then run `homelab converge`.
384
- - `T3_VERSION_SKEW`: a warning of `t3:version`: T3 on the machine the check names runs another release than the fleet pins; the remedy names both. `homelab converge` installs the pinned release on a worker and restarts T3. On the manager, converge switches a running desktop to the verified bundle when the running release differs from the pin and this converge is not a child of that desktop. The same release is left running. See `T3_DESKTOP_SWITCH_DEFERRED`.
384
+ - `T3_VERSION_SKEW`: a warning of `t3:version`: T3 on the machine the check names runs another release than the fleet pins; the remedy names both. `homelab converge` installs the pinned release on a worker and restarts T3. On the manager, converge switches a running desktop to the verified bundle when the running release differs from the pin. The same release is left running. See `T3_DESKTOP_ACTIVATION_SCHEDULED`.
385
385
  - `T3_UPDATES_UNMANAGED`: a warning of `t3:updates`: the administrator policy of T3 on the manager does not turn its own updater off, so T3 may update itself away from the pinned release. Stage the fleet's policy once, as an administrator, with the command the remedy prints. **Needs a person.**
386
386
  - `T3_RUNNING_VERSION_UNKNOWN`: `t3:running-version` could not read the version of the running server from its local API, or the release installed on the worker. Read `worker:t3-health`, then run `homelab converge`, which reinstalls the pinned T3.
387
387
  - `T3_RUNNING_VERSION_MISMATCH`: logged by `personal-worker-recovery` on the worker: T3 was restarted once for the installed release and still reports another version. It is not restarted again for that release and the run fails (`WORKER_RECOVERY_LAST_RUN_FAILED`). Run `homelab converge`, which reinstalls the pinned T3.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crvouga/homelab",
3
- "version": "0.23.7",
3
+ "version": "0.23.9",
4
4
  "description": "Keeps a set of development machines in sync: one manager and many workers",
5
5
  "license": "MIT",
6
6
  "repository": "github:crvouga/homelab",
@@ -74,5 +74,5 @@
74
74
  "engines": {
75
75
  "node": ">=22"
76
76
  },
77
- "gitHead": "50c71860f1a596d476665b80cbf26cebff65a21c"
77
+ "gitHead": "ed315929ad238df76bc689c727cae62d93db282f"
78
78
  }
@@ -98,8 +98,7 @@ async function runningDesktop(
98
98
  // (Dock copy, a previous digest directory) without there being an update.
99
99
  // Quitting that process kills a converge started in its terminal.
100
100
  const update = observed !== null && observed[2] !== version;
101
- if (context.apply && installed && update)
102
- return switchDesktop(context, pin, observed[2]!);
101
+ if (context.apply && installed && update) return switchDesktop(context, pin);
103
102
  const action = installed
104
103
  ? `When manager sessions have finished, quit T3 Code, then run open ${shellQuote(app)}. Pin that copy in the Dock.`
105
104
  : 'Stage the verified desktop with converge before opening it.';
@@ -123,31 +122,28 @@ async function runningDesktop(
123
122
  return running;
124
123
  }
125
124
 
126
- /** Quit the running release and open the verified bundle. A converge that is
127
- * itself a child of that desktop only warns: quitting it would end the run. */
128
125
  async function switchDesktop(
129
126
  context: MachineContext,
130
- pin: { app: string; version: string; installed: boolean },
131
- runningVersion: string
127
+ pin: { app: string; version: string; installed: boolean }
132
128
  ): Promise<Check> {
133
- if (await convergeRunsInsideDesktop(context.run))
134
- return {
135
- id: 't3:version',
136
- status: 'warn',
137
- summary: 'T3_DESKTOP_SWITCH_DEFERRED',
138
- remedy: {
139
- action: `The verified desktop for ${pin.version} is staged at ${pin.app}. This converge is running inside T3 ${runningVersion}, so the switch waits. Run homelab converge from Terminal or another session once this one has finished.`,
140
- },
141
- };
129
+ const waitFor = (await convergeRunsInsideDesktop(context.run))
130
+ ? process.pid
131
+ : 0;
142
132
  const switched = await runAnsible(
143
133
  context.run,
144
134
  join(context.workspace, 'ansible/macos/t3-activate.yml'),
145
135
  {
146
- input: JSON.stringify({ bundle_id: BUNDLE_ID, desktop_path: pin.app }),
136
+ input: JSON.stringify({
137
+ bundle_id: BUNDLE_ID,
138
+ desktop_path: pin.app,
139
+ desktop_version: pin.version,
140
+ converge_pid: String(waitFor),
141
+ }),
147
142
  timeoutMs: 90_000,
148
143
  }
149
144
  );
150
- if (!switched.ok)
145
+ const job = /T3 activation job (j[0-9]+\.[0-9]+)/.exec(switched.stdout)?.[1];
146
+ if (!switched.ok || (waitFor && !job))
151
147
  return {
152
148
  id: 't3:version',
153
149
  status: 'fail',
@@ -156,6 +152,16 @@ async function switchDesktop(
156
152
  action: `Open the verified desktop with open ${shellQuote(pin.app)} and rerun converge.`,
157
153
  },
158
154
  };
155
+ if (waitFor)
156
+ return {
157
+ id: 't3:version',
158
+ status: 'warn',
159
+ summary: 'T3_DESKTOP_ACTIVATION_SCHEDULED',
160
+ remedy: {
161
+ action:
162
+ 'T3 will restart after this converge exits. Check the manager desktop version after it relaunches.',
163
+ },
164
+ };
159
165
  return runningDesktop({ ...context, apply: false }, pin);
160
166
  }
161
167