@crvouga/homelab 0.23.5 → 0.23.7

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.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # homelab
2
2
 
3
3
  Keeps a set of development machines in sync: one **manager** and many
4
- **workers**. One command, `sync`, brings every machine to the same
4
+ **workers**. One command, `converge`, brings every machine to the same
5
5
  pinned tools, the same coding agents signed in through one proxy, the same
6
6
  uptime policy and the same monitoring. Adding or removing a machine is one
7
7
  entry in `fleet.json`.
@@ -30,7 +30,7 @@ storage bucket you own. Nothing else has to be kept:
30
30
  | The version of homelab | The `@crvouga/homelab` dependency in your `package.json` |
31
31
  | The fleet state: the enrolled workers, the approved revision, the configuration applied | Your bucket (any S3-compatible service) |
32
32
  | Secrets | The provider `fleet.json` names (`vault`, `sops`, `file` or `env`) |
33
- | The source, checkouts, tools and reports homelab puts on a machine | A cache: delete it and `sync` rebuilds it |
33
+ | The source, checkouts, tools and reports homelab puts on a machine | A cache: delete it and `converge` rebuilds it |
34
34
 
35
35
  The CLI proxy and the monitoring hub on the manager still keep data of their
36
36
  own; [known limits](#known-limits) says what is lost with the manager.
@@ -39,7 +39,7 @@ own; [known limits](#known-limits) says what is lost with the manager.
39
39
 
40
40
  homelab is opinionated. These are part of it, not options:
41
41
 
42
- - The **manager** is a macOS machine. You run `sync` on it, and it hosts
42
+ - The **manager** is a macOS machine. You run `converge` on it, and it hosts
43
43
  the shared services (the CLI proxy and the monitoring hub) in Docker Desktop.
44
44
  - **Workers** are Ubuntu 26.04 or 24.04 machines reached over SSH. They are stateless:
45
45
  everything on them is rebuilt from Git and your secrets.
@@ -95,7 +95,7 @@ out of Git: pass them from wherever you keep secrets (a password manager's
95
95
  `run` command, a git-ignored `.env`, your shell). They are read from the
96
96
  environment and never taken from arguments.
97
97
 
98
- `sync` converges the manager first, then every worker over SSH. It
98
+ `converge` converges the manager first, then every worker over SSH. It
99
99
  fetches the commit your `homelab` version was published from, sends it and
100
100
  your configuration to each machine, installs the pinned toolchain, applies the
101
101
  Ansible policy and verifies the result. It prints one table and writes a full
@@ -167,11 +167,11 @@ the fleet state records: after an upgrade whose canary failed, that is the
167
167
  revision the fleet still runs. A rollback covers what a revision declares: the
168
168
  checkout, the pinned tools and T3 Code. System packages roll forward only
169
169
  (apt never downgrades them), so a release that moved one keeps it. Installing
170
- an older version and running `sync` does the same for any earlier
170
+ an older version and running `converge` does the same for any earlier
171
171
  release.
172
172
 
173
173
  The fleet moves only to a revision on the default branch of the source
174
- repository, which every release is. `sync` asks the manager's own copy
174
+ repository, which every release is. `converge` asks the manager's own copy
175
175
  of that repository, whatever selected the revision (the package, `--revision`,
176
176
  `--rollback`, the schedule, a checkout, a hand-off from a worker), and refuses
177
177
  any other with `FLEET_REVISION_UNMERGED` before anything changes.
@@ -184,7 +184,7 @@ every checkout on the machine whose pin is newer. `status` reports that
184
184
  as the warning `TOOLCHAIN_DOWNGRADE` of `tool:mise`, and
185
185
  `converge --allow-mise-downgrade` installs the older one on purpose, on
186
186
  every machine it converges. Each revision runs its own bootstrap, and one from
187
- before this rule installs exactly the mise it pins. So `sync` reads the
187
+ before this rule installs exactly the mise it pins. So `converge` reads the
188
188
  pin from the revision's own files and measures the mise of the manager and of
189
189
  each worker it is about to converge before that bootstrap runs anywhere: a
190
190
  revision that would replace a newer mise is refused with
@@ -198,17 +198,46 @@ before the revision's own run script starts there; a manager whose installed
198
198
  homelab is from before that question refuses such a revision rather than
199
199
  passing it.
200
200
 
201
+ ## Unattended SSH
202
+
203
+ For fleets with `nativeSsh: true`, `check --workers` also measures SSH from
204
+ that declared manager: its authenticated identity, the effective alias/account
205
+ and port, the worker's native SSH preference, durable policy acceptance in both
206
+ directions, and a fresh local forwarding channel to the declared T3 endpoint.
207
+ A cached or expired browser approval never proves unattended access: temporary
208
+ policy rules are excluded from the durable grant check. Policy inspection that
209
+ is denied or unavailable fails verification; daemon health alone cannot pass it.
210
+ The manager must be allowed to read its Tailscale netmap, and the worker's
211
+ existing noninteractive sudo grant must permit the read-only Tailscale probes.
212
+
213
+ These checks run after native SSH adoption on every converge, including the
214
+ existing manager schedule. `notify` runs `check --workers`, so persistent SSH
215
+ failures and recovery reach the fleet's configured notification targets. SSH
216
+ connection attempts and keepalives are bounded; later scheduled runs retry
217
+ transient failures. Converge reconciles the owned daemon and SSH preference
218
+ using Ansible. An unreachable machine needs its consumer-owned console or a
219
+ verified alternate route; homelab cannot repair a disconnected SSH route over
220
+ that same route. Missing or revoked identities stay unhealthy until enrollment
221
+ is restored. Host keys are never learned automatically.
222
+
223
+ The consumer's infrastructure owner reconciles scoped noninteractive SSH
224
+ acceptance and forwarding policy. Homelab reads the effective policy and
225
+ verifies it again after reconciliation; it never changes that cloud policy or
226
+ asks for a browser approval during a normal run. Alias drift is reported for
227
+ the consumer to fix. The forwarding probe verifies a `direct-tcpip` channel to
228
+ the T3 loopback service; a VS Code server installation remains a separate check.
229
+
201
230
  ## Your project's own tools
202
231
 
203
232
  On a fleet machine the global mise configuration (`~/.config/mise/config.toml`
204
- and its `mise.lock`) belongs to homelab: `sync` publishes it with the
233
+ and its `mise.lock`) belongs to homelab: `converge` publishes it with the
205
234
  fleet's pinned tools and the agent worktree roots mise must trust. A project
206
235
  pins its own tools in its own `mise.toml` and installs them with
207
236
  `mise install --locked` in its checkout. On a fleet machine mise installs a
208
237
  project's tools only from the project's `mise.lock` (run `mise lock` after
209
238
  changing a pin); a tool the lock does not name is refused. A project never
210
239
  publishes a global configuration. If anything replaces homelab's, `status` fails the check
211
- `tool:global-mise-config` until the next `sync`.
240
+ `tool:global-mise-config` until the next `converge`.
212
241
 
213
242
  ## Using it from code
214
243
 
@@ -223,7 +252,7 @@ an [issue](#bugs-and-feature-requests).
223
252
 
224
253
  Your bucket is the source of truth for everything Git does not hold: the
225
254
  roster of enrolled workers, the approved revision, and the configuration
226
- `sync` last applied. It is one SQLite database that
255
+ `converge` last applied. It is one SQLite database that
227
256
  [Litestream](https://litestream.io) replicates to the bucket. `fleet.json`
228
257
  says where the bucket is and the command is passed its credentials:
229
258
 
@@ -245,7 +274,7 @@ come back from the bucket, and the machine is rebuilt from Git.
245
274
  lost manager.
246
275
 
247
276
  Some runs are started by a machine rather than by you: a worker that hands
248
- `sync` to the manager, for example. They get no environment, so save the
277
+ `converge` to the manager, for example. They get no environment, so save the
249
278
  credentials on the manager once (in `~/.config/homelab/bucket.json`,
250
279
  readable by you alone):
251
280
 
@@ -253,7 +282,7 @@ readable by you alone):
253
282
  npx @crvouga/homelab state --init
254
283
  ```
255
284
 
256
- Without a bucket everything still works from the local copy, and `sync`
285
+ Without a bucket everything still works from the local copy, and `converge`
257
286
  warns that the manager holds the only one. [docs/state.md](docs/state.md)
258
287
  explains how replication stays correct, how to move an existing fleet to a
259
288
  project, and which state is not in the bucket yet.
@@ -305,7 +334,7 @@ commands stay the pinned CLIs with whatever sign-in you gave them.
305
334
  refuse agent sessions above that number; without it nothing is refused
306
335
  ([a limit on agent sessions](docs/worker-contract.md#a-limit-on-agent-sessions)).
307
336
 
308
- 3. Run `sync`. A machine that has only an SSH server and an account
337
+ 3. Run `converge`. A machine that has only an SSH server and an account
309
338
  with sudo is enough: every pull request proves that against a bare
310
339
  Ubuntu machine, over SSH
311
340
  ([`fresh-box.feature`](features/fresh-box/fresh-box.feature)).
@@ -316,7 +345,7 @@ autoinstall file with `--autoinstall`) holding the worker account with your
316
345
  manager's key, the privilege rule, a host key the manager pins at once and the
317
346
  pinned Tailscale with a short-lived single-use auth key from your secrets
318
347
  provider (`tailnet-auth-key`). Boot a stock Ubuntu image with it, then add the
319
- worker with `enroll` and run `sync`.
348
+ worker with `enroll` and run `converge`.
320
349
 
321
350
  `npx @crvouga/homelab measure --id ID` measures what a worker is made of
322
351
  (packages, active tools, always-on services) with a digest that is the same
@@ -327,12 +356,12 @@ names every difference from the declared pins and, with `--reference` (the
327
356
  Remove a machine with `npx @crvouga/homelab retire --id ID --apply --yes`
328
357
  (it revokes the worker's Vault token, forgets its host key and roster entry
329
358
  and leaves a tombstone in the fleet state), then delete its entry and run
330
- `sync`. To put a fresh machine in place of a worker under the same id,
359
+ `converge`. To put a fresh machine in place of a worker under the same id,
331
360
  run `npx @crvouga/homelab replace --id ID --host-key "TYPE BASE64" --apply
332
361
  --yes` and then `converge --node ID`; the manager's T3 pairs with the new
333
362
  machine's T3 by itself, with no code to copy. A run scoped with `--node` records only the
334
363
  revision of the workers it covered; the fleet's applied revision moves with a
335
- full `sync`.
364
+ full `converge`.
336
365
 
337
366
  ## Configuration
338
367
 
@@ -346,9 +375,9 @@ names the first field that breaks a rule (`{code, path, expected, actual}`);
346
375
  `--ansible` also renders the Ansible inventory and syntax-checks every
347
376
  playbook with the pinned Ansible.
348
377
 
349
- Edit the `fleet.json` of your project, never the copy `sync` installs
378
+ Edit the `fleet.json` of your project, never the copy `converge` installs
350
379
  at `~/.config/homelab/fleet.json` for launchers and scheduled jobs:
351
- `sync` replaces that copy, and refuses to run
380
+ `converge` replaces that copy, and refuses to run
352
381
  (`FLEET_CONFIGURATION_COPY_CHANGED`) rather than lose an edit made to it by
353
382
  hand, on the manager or on a worker it is about to converge, before anything
354
383
  is changed. [docs/state.md](docs/state.md#day-to-day) says how to keep or discard
@@ -439,12 +468,12 @@ Retirement runs `paradev hosts remove`. The `paradev:*` checks only warn.
439
468
 
440
469
  Under `t3.profile`, `fleet.json` names top-level T3 settings every machine
441
470
  holds the same, such as tool servers. A setting not named there stays the
442
- machine's own, and one edited on a machine since `sync` last wrote it
471
+ machine's own, and one edited on a machine since `converge` last wrote it
443
472
  is reported as `T3_PROFILE_CONFLICT` by the check `t3:profile`, never
444
473
  overwritten.
445
474
 
446
475
  Accounts of one tool are not entitled to the same models. On each per-account
447
- instance `sync` hides the models of T3's catalogue that its account does
476
+ instance `converge` hides the models of T3's catalogue that its account does
448
477
  not serve and lists the preferred default it serves first, so the instance
449
478
  shows, and opens on, a model that works. Which catalogue models are hidden
450
479
  there is the fleet's: one hidden by hand is shown again while its account
@@ -458,7 +487,7 @@ Secrets are asked for by purpose (`proxy-client-key`,
458
487
  `monitoring-account-password`, `monitoring-tunnel-token`,
459
488
  `proxy-tunnel-token`); see [`src/secrets.ts`](src/secrets.ts).
460
489
 
461
- `sync` records the configuration it applies in the fleet state, so a
490
+ `converge` records the configuration it applies in the fleet state, so a
462
491
  run started outside your project uses the one last applied.
463
492
  `state --export` prints it.
464
493
 
@@ -470,8 +499,8 @@ under `source`: the commit a package names must be reachable there.
470
499
  A defect in homelab, or something it cannot do yet, is raised as an
471
500
  [issue](https://github.com/crvouga/homelab/issues). From your project that
472
501
  is the only way to change homelab, for you and for the coding agents working
473
- there. Do not patch the installed package, a checkout `sync` put on a
474
- machine or a file it manages: the next install or `sync` replaces them.
502
+ there. Do not patch the installed package, a checkout `converge` put on a
503
+ machine or a file it manages: the next install or `converge` replaces them.
475
504
 
476
505
  The tool says so itself: `homelab --help` names the issue tracker, and the
477
506
  agent contract (`homelab commands --json`, under `agent.support`) carries the
@@ -497,7 +526,7 @@ fleet.json contents.
497
526
  are not available yet.
498
527
  - The bucket holds the fleet's own state. The CLI proxy keeps its separate
499
528
  encrypted backup (`vault` only), and the monitoring hub's database is not
500
- replicated: `sync` recreates its accounts and systems, but metric
529
+ replicated: `converge` recreates its accounts and systems, but metric
501
530
  history is lost with the manager. See
502
531
  [what is not in the bucket yet](docs/state.md#what-is-not-in-the-bucket-yet).
503
532
  - Caches and units on machines still use the historical `personal` prefix
@@ -505,7 +534,7 @@ fleet.json contents.
505
534
  works, and renaming it needs a migration.
506
535
  - The CLI proxy's installed code is a Git worktree of the manager's copy of
507
536
  the source repository (`~/.local/share/personal/fleet/manager/source`).
508
- `sync` fetches that copy again when it is deleted, but the proxy then
537
+ `converge` fetches that copy again when it is deleted, but the proxy then
509
538
  needs `homelab proxy install` once more.
510
539
  - The manager is a Mac host. There is no container image of the manager.
511
540
  - `converge --schedule enable --apply --yes` is installed by that command
@@ -550,7 +579,7 @@ bun run check
550
579
  ./homelab check --local # the CLI, from this checkout
551
580
  ```
552
581
 
553
- Run from a checkout, `sync` converges the fleet to the checkout's `HEAD`
582
+ Run from a checkout, `converge` converges the fleet to the checkout's `HEAD`
554
583
  commit (never to uncommitted files). The checkout's `origin` must be the
555
584
  repository `fleet.json` names under `source`, and a `HEAD` that is not on its
556
585
  default branch needs `--allow-unmerged`. Every merge to `main` publishes a release;
@@ -0,0 +1,22 @@
1
+ ---
2
+ - name: Retire only the replaced manager monitoring job
3
+ hosts: localhost
4
+ connection: local
5
+ become: false
6
+ gather_facts: false
7
+ vars_files:
8
+ - policy.json
9
+ vars:
10
+ migration_home: "{{ lookup('ansible.builtin.env', 'HOME') }}"
11
+ tasks:
12
+ - name: Read the migration launchd user
13
+ ansible.builtin.command:
14
+ argv: [/usr/bin/id, -u]
15
+ changed_when: false
16
+ check_mode: false
17
+ register: migration_uid
18
+ - name: Reconcile the replaced monitoring label
19
+ ansible.builtin.include_tasks: tasks/legacy-agent.yml
20
+ loop: '{{ legacyAgents | selectattr("replacement", "equalto", beszelDaemon) | list }}'
21
+ loop_control:
22
+ loop_var: legacy_agent
@@ -232,6 +232,7 @@
232
232
  # starts where manager:disk warns. manager:disk-gc measures the job and reads
233
233
  # the report it leaves.
234
234
  - name: Collect the manager's disk garbage on a schedule
235
+ tags: [disk]
235
236
  hosts: localhost
236
237
  connection: local
237
238
  become: false
@@ -88,6 +88,10 @@
88
88
  {
89
89
  "legacy": "dev.devfleet.fleet-watch",
90
90
  "replacement": "dev.homelab.notify"
91
+ },
92
+ {
93
+ "legacy": "dev.devfleet.beszel-agent",
94
+ "replacement": "dev.homelab.beszel-agent"
91
95
  }
92
96
  ],
93
97
  "resourceCoverage": {
@@ -3,7 +3,7 @@
3
3
  ansible.builtin.command:
4
4
  argv:
5
5
  [
6
- /bin/launchctl,
6
+ "{{ migration_launchctl | default('/bin/launchctl') }}",
7
7
  print,
8
8
  'gui/{{ migration_uid.stdout }}/{{ legacy_agent.replacement }}',
9
9
  ]
@@ -15,7 +15,7 @@
15
15
  ansible.builtin.command:
16
16
  argv:
17
17
  [
18
- /bin/launchctl,
18
+ "{{ migration_launchctl | default('/bin/launchctl') }}",
19
19
  print,
20
20
  'gui/{{ migration_uid.stdout }}/{{ legacy_agent.legacy }}',
21
21
  ]
@@ -23,11 +23,19 @@
23
23
  check_mode: false
24
24
  failed_when: false
25
25
  register: legacy_loaded
26
+ - name: Require a running replacement monitoring process
27
+ ansible.builtin.assert:
28
+ that:
29
+ - replacement_loaded.rc == 0
30
+ - "'state = running' in replacement_loaded.stdout"
31
+ - "replacement_loaded.stdout is search('pid = [1-9][0-9]*')"
32
+ fail_msg: The replacement monitoring job must be running before retiring its predecessor.
33
+ when: legacy_agent.replacement == beszelDaemon
26
34
  - name: Unload the replaced legacy job
27
35
  ansible.builtin.command:
28
36
  argv:
29
37
  [
30
- /bin/launchctl,
38
+ "{{ migration_launchctl | default('/bin/launchctl') }}",
31
39
  bootout,
32
40
  'gui/{{ migration_uid.stdout }}/{{ legacy_agent.legacy }}',
33
41
  ]
@@ -38,3 +46,20 @@
38
46
  path: '{{ migration_home }}/Library/LaunchAgents/{{ legacy_agent.legacy }}.plist'
39
47
  state: absent
40
48
  when: replacement_loaded.rc == 0
49
+ - name: Verify the replacement monitoring process survived
50
+ ansible.builtin.command:
51
+ argv:
52
+ [
53
+ "{{ migration_launchctl | default('/bin/launchctl') }}",
54
+ print,
55
+ 'gui/{{ migration_uid.stdout }}/{{ legacy_agent.replacement }}',
56
+ ]
57
+ changed_when: false
58
+ check_mode: false
59
+ register: replacement_after
60
+ failed_when: >-
61
+ replacement_after.rc != 0 or
62
+ 'state = running' not in replacement_after.stdout or
63
+ (replacement_after.stdout | regex_search('pid = [0-9]+')) !=
64
+ (replacement_loaded.stdout | regex_search('pid = [0-9]+'))
65
+ when: legacy_agent.replacement == beszelDaemon
@@ -74,6 +74,7 @@ import os
74
74
  import re
75
75
  import resource
76
76
  import shutil
77
+ import signal
77
78
  import socket
78
79
  import stat
79
80
  import subprocess
@@ -93,7 +94,11 @@ REGENERABLE = frozenset({
93
94
  REGENERABLE_BESIDE = {'target': 'Cargo.toml'}
94
95
  # Hidden directories under the home directory that still hold checkouts.
95
96
  HIDDEN_ROOTS = frozenset({'.t3'})
96
- GIT = ['git', '-c', 'safe.directory=*']
97
+ # Command-scoped settings survive runuser and do not depend on either user's
98
+ # global Git config. A collector owns its maintenance until it completes.
99
+ GIT = ['git', '-c', 'safe.directory=*',
100
+ '-c', 'maintenance.autoDetach=false', '-c', 'gc.autoDetach=false',
101
+ '-c', 'pack.threads=1', '-c', 'pack.windowMemory=64m']
97
102
 
98
103
 
99
104
  OPERATION_FAILURES = 0
@@ -198,10 +203,36 @@ def git_dir(checkout):
198
203
  return target if is_real_dir(target) else None
199
204
 
200
205
 
206
+ def managed_git(argv, timeout, input=None, **kwargs):
207
+ """Keep Git and its helpers together, including when a fetch times out."""
208
+ with subprocess.Popen(argv, stdin=subprocess.PIPE if input is not None else None,
209
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE,
210
+ start_new_session=True, **kwargs) as process:
211
+ try:
212
+ stdout, stderr = process.communicate(input=input, timeout=timeout)
213
+ return subprocess.CompletedProcess(argv, process.returncode, stdout, stderr)
214
+ finally:
215
+ # communicate() only kills the immediate process on timeout in
216
+ # subprocess.run; runuser, transports and pack writers can survive.
217
+ try:
218
+ os.killpg(process.pid, signal.SIGTERM)
219
+ except ProcessLookupError:
220
+ pass
221
+ try:
222
+ process.communicate(timeout=5)
223
+ except subprocess.TimeoutExpired:
224
+ pass
225
+ finally:
226
+ try:
227
+ os.killpg(process.pid, signal.SIGKILL)
228
+ except ProcessLookupError:
229
+ pass
230
+ process.wait()
231
+
232
+
201
233
  def run_git(checkout, args, data=None):
202
234
  try:
203
- out = subprocess.run(GIT + ['-C', checkout] + args, input=data,
204
- capture_output=True, timeout=600)
235
+ out = managed_git(GIT + ['-C', checkout] + args, input=data, timeout=600)
205
236
  except (OSError, subprocess.TimeoutExpired):
206
237
  return None
207
238
  return out
@@ -478,18 +509,37 @@ def refresh_remotes(worktrees, user, home, reserve=0, max_fetch_mib=None):
478
509
  log(event='fetch_reserve_refused')
479
510
  success = False
480
511
  continue
512
+ stage = 'fetch'
481
513
  try:
482
- out = subprocess.run(
483
- as_user(GIT + ['--git-dir', common, 'fetch', '--all', '--prune', '--quiet'], user, home),
484
- capture_output=True, timeout=300,
514
+ out = managed_git(
515
+ as_user(GIT + ['--git-dir', common, 'fetch', '--all', '--prune',
516
+ '--quiet', '--no-auto-maintenance'], user, home),
517
+ timeout=300,
485
518
  preexec_fn=(lambda: resource.setrlimit(resource.RLIMIT_FSIZE,
486
519
  (max_fetch_mib * MIB, max_fetch_mib * MIB))) if max_fetch_mib else None,
487
520
  env={**os.environ, 'GIT_TERMINAL_PROMPT': '0'})
521
+ if out.returncode == 0:
522
+ # The fetch's per-file write bound must not also cap a repack
523
+ # of existing history. Maintenance retains the service's
524
+ # memory budget and the disk guard, and is supervised here.
525
+ stage = 'maintenance'
526
+ out = managed_git(
527
+ as_user(GIT + ['--git-dir', common, 'maintenance', 'run',
528
+ '--auto', '--quiet', '--no-detach'], user, home),
529
+ timeout=600, env={**os.environ, 'GIT_TERMINAL_PROMPT': '0'})
488
530
  ok = out.returncode == 0
489
- except (OSError, subprocess.TimeoutExpired):
531
+ failure = {'reason': 'signal' if out.returncode < 0 else 'exit',
532
+ 'exit_code': out.returncode}
533
+ except subprocess.TimeoutExpired:
534
+ ok = False
535
+ failure = {'reason': 'timeout'}
536
+ except OSError as exc:
490
537
  ok = False
538
+ failure = {'reason': 'os_error', 'errno': exc.errno}
491
539
  if not ok:
492
- log(event='fetch_failed', repository=common)
540
+ # Do not serialize stderr: remotes can include credentials and
541
+ # arbitrary server output. Status fields are actionable and safe.
542
+ log(event='fetch_failed', stage=stage, **failure)
493
543
  success = False
494
544
  return success
495
545
 
@@ -572,9 +622,9 @@ def collect_worktrees(root, idle_seconds, busy, now, dry_run, disposable=False,
572
622
  common = run_git(worktree, ['rev-parse', '--path-format=absolute', '--git-common-dir'])
573
623
  if common is None or common.returncode != 0:
574
624
  continue
575
- out = subprocess.run(
625
+ out = managed_git(
576
626
  GIT + ['--git-dir', common.stdout.decode().strip(), 'worktree', 'remove', '--force', worktree],
577
- capture_output=True, timeout=600)
627
+ timeout=600)
578
628
  if out.returncode != 0 or os.path.lexists(worktree):
579
629
  log(event='worktree_kept', worktree=worktree, reason='git_worktree_remove_failed')
580
630
  continue
@@ -31,13 +31,13 @@
31
31
  "xz-utils": "5.6.1+really5.4.5-1ubuntu0.4",
32
32
  "ansible-core": "2.16.3-0ubuntu2",
33
33
  "systemd-zram-generator": "1.1.2-3",
34
- "systemd-oomd": "255.4-1ubuntu8.18",
34
+ "systemd-oomd": "255.4-1ubuntu8.19",
35
35
  "nftables": "1.0.9-1ubuntu0.1",
36
36
  "fwupd": "2.0.20-1ubuntu2~24.04.2"
37
37
  },
38
38
  "browserPackages": {
39
39
  "fonts-liberation": "1:2.1.5-3",
40
- "libasound2t64": "1.2.11-1ubuntu0.3",
40
+ "libasound2t64": "1.2.11-1ubuntu0.5",
41
41
  "libatk-bridge2.0-0t64": "2.52.0-1build1",
42
42
  "libatk1.0-0t64": "2.52.0-1build1",
43
43
  "libatspi2.0-0t64": "2.52.0-1build1",
@@ -45,7 +45,7 @@
45
45
  "libcups2t64": "2.4.7-1.2ubuntu7.14",
46
46
  "libdbus-1-3": "1.14.10-4ubuntu4.1",
47
47
  "libdrm2": "2.4.125-1ubuntu0.1~24.04.2",
48
- "libgbm1": "25.2.8-0ubuntu0.24.04.4",
48
+ "libgbm1": "25.2.8-0ubuntu0.24.04.5",
49
49
  "libglib2.0-0t64": "2.80.0-6ubuntu3.10",
50
50
  "libnspr4": "2:4.35-1.1build1",
51
51
  "libnss3": "2:3.98-1ubuntu0.3",
@@ -66,7 +66,7 @@
66
66
  }
67
67
  }
68
68
  ],
69
- "snapshot": "20261108T000000Z",
69
+ "snapshot": "20261129T000000Z",
70
70
  "packages": {
71
71
  "sudo": "1.9.17p2-1ubuntu3.2",
72
72
  "openssh-server": "1:10.2p1-2ubuntu3.8",
@@ -85,7 +85,7 @@
85
85
  "systemd-zram-generator": "1.2.1-2",
86
86
  "systemd-oomd": "259.9-0ubuntu0.1",
87
87
  "nftables": "1.1.6-1",
88
- "fwupd": "2.1.1-1ubuntu3.1"
88
+ "fwupd": "2.1.6-3ubuntu4~26.04.1"
89
89
  },
90
90
  "tailscale": {
91
91
  "version": "1.104.7",
@@ -139,7 +139,12 @@
139
139
  "footprintMiB": {
140
140
  "baseTools": 5120,
141
141
  "checkouts": 1024,
142
- "profiles": { "web": 256, "go": 1024, "rust": 2048, "jvm": 640 }
142
+ "profiles": {
143
+ "web": 256,
144
+ "go": 1024,
145
+ "rust": 2048,
146
+ "jvm": 640
147
+ }
143
148
  },
144
149
  "agentSessionMiB": 512,
145
150
  "agentBuildMiB": 4096,
@@ -203,8 +208,7 @@
203
208
  "threadMaxPercent": 55,
204
209
  "swapMiB": 4096,
205
210
  "tasks": 3000,
206
- "weight": 50,
207
- "oomPressurePercent": 60
211
+ "weight": 50
208
212
  },
209
213
  "journalMaxUse": "1G",
210
214
  "journalKeepFree": "4G",
@@ -241,7 +245,9 @@
241
245
  },
242
246
  "diskGcWorktreeRoots": [".t3/worktrees"],
243
247
  "diskGcWorktreeIdleDays": 30,
244
- "diskGcCacheCapsMiB": { ".cache/pip": 1024 },
248
+ "diskGcCacheCapsMiB": {
249
+ ".cache/pip": 1024
250
+ },
245
251
  "diskGcPackagesKept": 2,
246
252
  "diskGcCheckoutsKept": 2,
247
253
  "diskGcCheckoutRoots": [
@@ -249,7 +255,9 @@
249
255
  ".local/share/personal/fleet/manager-runs"
250
256
  ],
251
257
  "diskGcCurrentCheckout": ".local/share/personal/fleet/current",
252
- "diskGcExpireHours": { ".t3/scratch": 24 },
258
+ "diskGcExpireHours": {
259
+ ".t3/scratch": 24
260
+ },
253
261
  "diskGcReport": "/var/lib/personal-fleet-disk-gc/report.json",
254
262
  "diskGcIntervalMinutes": 60,
255
263
  "diskGcDisposable": {
@@ -262,6 +270,7 @@
262
270
  "dockerLogMaxFiles": "3",
263
271
  "inodeWarnFreePercent": 10,
264
272
  "inodeFailFreePercent": 2,
273
+ "diskGcMemoryMaxMiB": 2048,
265
274
  "diskGcGitTempHours": 1,
266
275
  "diskGcFetchMaxMiB": 256
267
276
  },
@@ -275,11 +284,26 @@
275
284
  "tailscalePort": 41641,
276
285
  "containerInterfaces": ["docker0", "br-*"],
277
286
  "systemListeners": [
278
- { "protocol": "udp", "port": 68 },
279
- { "protocol": "udp", "port": 546 },
280
- { "protocol": "udp", "port": 5353 },
281
- { "protocol": "udp", "port": 5355 },
282
- { "protocol": "tcp", "port": 5355 }
287
+ {
288
+ "protocol": "udp",
289
+ "port": 68
290
+ },
291
+ {
292
+ "protocol": "udp",
293
+ "port": 546
294
+ },
295
+ {
296
+ "protocol": "udp",
297
+ "port": 5353
298
+ },
299
+ {
300
+ "protocol": "udp",
301
+ "port": 5355
302
+ },
303
+ {
304
+ "protocol": "tcp",
305
+ "port": 5355
306
+ }
283
307
  ]
284
308
  },
285
309
  "dockerSmokeTest": {
@@ -289,7 +313,7 @@
289
313
  "browser": {
290
314
  "packages": {
291
315
  "fonts-liberation": "1:2.1.5-3build1",
292
- "libasound2t64": "1.2.15.3-1ubuntu1.1",
316
+ "libasound2t64": "1.2.15.3-1ubuntu1.2",
293
317
  "libatk-bridge2.0-0t64": "2.60.4-0ubuntu0.1",
294
318
  "libatk1.0-0t64": "2.60.4-0ubuntu0.1",
295
319
  "libatspi2.0-0t64": "2.60.4-0ubuntu0.1",
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/python3
2
- """Shed one T3 agent or transient user job after sustained CPU, I/O or memory pressure."""
2
+ """Shed an attributed CPU or I/O offender; report memory pressure without killing sessions."""
3
3
  import argparse
4
4
  import json
5
5
  from pathlib import Path
@@ -88,16 +88,13 @@ class Guard:
88
88
  except (OSError, ValueError, KeyError):
89
89
  pass
90
90
  host_delta = io_delta(self.previous.get('host', {}), counters.get('host', {}))
91
- if memory_due or io >= args.threshold or cpu >= args.cpu_threshold:
91
+ if io >= args.threshold or cpu >= args.cpu_threshold:
92
92
  for scope in workloads(args):
93
93
  try:
94
94
  if any(child.is_dir() for child in scope.iterdir()):
95
95
  continue
96
96
  size = int((scope / 'memory.current').read_text())
97
97
  size += int((scope / 'memory.swap.current').read_text())
98
- if memory_due:
99
- candidates.append((size, scope, dict(reason='memory', bytes=size)))
100
- continue
101
98
  if cpu >= args.cpu_threshold:
102
99
  used = cpu_use(scope)
103
100
  cpu_use_now[scope] = used
@@ -74,6 +74,10 @@
74
74
  Description=Push work in progress of agent worktrees to recovery refs
75
75
  [Service]
76
76
  Type=oneshot
77
+ Nice=19
78
+ CPUWeight=1
79
+ IOWeight=1
80
+ IOSchedulingClass=idle
77
81
  ExecStart=/usr/bin/python3 {{ development_source }}/ansible/ubuntu/wip-guard.py --root {{ development_home }}/.t3/worktrees --node %l
78
82
  TimeoutStartSec=600
79
83
  - name: Declare how often work in progress is saved