@crvouga/homelab 0.26.0 → 0.27.0
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/.mise/locks/npm-wrangler/{4.170.0 → 4.171.0}/aube-lock.yaml +46 -46
- package/.mise/locks/npm-wrangler/{4.170.0 → 4.171.0}/package.json +1 -1
- package/ansible/monitoring/README.md +7 -0
- package/ansible/ubuntu/baseline.yml +2 -14
- package/ansible/ubuntu/policy.json +2 -1
- package/ansible/ubuntu/recovery.yml +1 -1
- package/ansible/ubuntu/t3-boot-readiness.py +38 -0
- package/ansible/ubuntu/t3-desktop.yml +2 -13
- package/ansible/ubuntu/t3-headless.yml +2 -0
- package/ansible/ubuntu/t3-health.sh +13 -40
- package/ansible/ubuntu/tasks/check-legacy-t3.yml +17 -0
- package/ansible/ubuntu/tasks/recovery.yml +30 -3
- package/ansible/ubuntu/tasks/retire-agent-launchers.yml +14 -0
- package/docs/runbooks.md +9 -4
- package/docs/ubuntu-sync.md +14 -14
- package/docs/worker-contract.md +23 -8
- package/mise.lock +3 -3
- package/mise.toml +1 -1
- package/package.json +2 -2
- package/schema/check-ids.json +1 -1
- package/src/check-registry.ts +1 -1
- package/src/platform/t3-service.ts +12 -1
- package/src/t3-linked-check.ts +153 -13
- package/src/worker-activity.ts +43 -7
- package/src/worker-host-checks.ts +22 -35
|
@@ -9,8 +9,8 @@ importers:
|
|
|
9
9
|
.:
|
|
10
10
|
dependencies:
|
|
11
11
|
wrangler:
|
|
12
|
-
specifier: 4.
|
|
13
|
-
version: 4.
|
|
12
|
+
specifier: 4.171.0
|
|
13
|
+
version: 4.171.0(@types/node@18.19.130)
|
|
14
14
|
|
|
15
15
|
packages:
|
|
16
16
|
|
|
@@ -27,38 +27,38 @@ packages:
|
|
|
27
27
|
workerd:
|
|
28
28
|
optional: true
|
|
29
29
|
|
|
30
|
-
'@cloudflare/workerd-darwin-64@1.
|
|
31
|
-
resolution: {integrity: sha512-
|
|
30
|
+
'@cloudflare/workerd-darwin-64@1.20261201.1':
|
|
31
|
+
resolution: {integrity: sha512-3zYOvrvOa2sPrNygPEsrODlvGwq20znmw2pWndOSKPWg2cepdBZfmty90/GhWJJXxmZk6ZSNORFsUEqGTjIBjQ==}
|
|
32
32
|
engines: {node: '>=16'}
|
|
33
33
|
cpu: [x64]
|
|
34
34
|
os: [darwin]
|
|
35
35
|
|
|
36
|
-
'@cloudflare/workerd-darwin-arm64@1.
|
|
37
|
-
resolution: {integrity: sha512-
|
|
36
|
+
'@cloudflare/workerd-darwin-arm64@1.20261201.1':
|
|
37
|
+
resolution: {integrity: sha512-oc6uK56CE/VktpEU+cCIKg/o25GwWXPgJjzab7kKUss23Gu3Xqw1y5XKoXnozx40rDmceF4dPXslFGH4dTEtRw==}
|
|
38
38
|
engines: {node: '>=16'}
|
|
39
39
|
cpu: [arm64]
|
|
40
40
|
os: [darwin]
|
|
41
41
|
|
|
42
|
-
'@cloudflare/workerd-linux-64@1.
|
|
43
|
-
resolution: {integrity: sha512-
|
|
42
|
+
'@cloudflare/workerd-linux-64@1.20261201.1':
|
|
43
|
+
resolution: {integrity: sha512-Y+ON1Pd7EFHZXu82kSHC+8/+tcBuSxGPEW0jGU6YC0xk4iY3iieHcDYe9vQDD/NulBZDNqN4eOKJHj8SVR5plQ==}
|
|
44
44
|
engines: {node: '>=16'}
|
|
45
45
|
cpu: [x64]
|
|
46
46
|
os: [linux]
|
|
47
47
|
|
|
48
|
-
'@cloudflare/workerd-linux-arm64@1.
|
|
49
|
-
resolution: {integrity: sha512-
|
|
48
|
+
'@cloudflare/workerd-linux-arm64@1.20261201.1':
|
|
49
|
+
resolution: {integrity: sha512-9uTVy8ArDk4hvSUlNv03tZP5la9pXPJUw50STbT2UOT40OmDEN8m/ZGAqyOB0Kki7bJwrJGBzZnTyL0x5gGFRQ==}
|
|
50
50
|
engines: {node: '>=16'}
|
|
51
51
|
cpu: [arm64]
|
|
52
52
|
os: [linux]
|
|
53
53
|
|
|
54
|
-
'@cloudflare/workerd-windows-64@1.
|
|
55
|
-
resolution: {integrity: sha512-
|
|
54
|
+
'@cloudflare/workerd-windows-64@1.20261201.1':
|
|
55
|
+
resolution: {integrity: sha512-Vbvb6HttqEwIoB2SNhDfySyubnD+R8aTGv9lqEfg/AFhyqzm6llmRFUuqlCCPp3pNgRGSI1DUhqUVked0A6Pag==}
|
|
56
56
|
engines: {node: '>=16'}
|
|
57
57
|
cpu: [x64]
|
|
58
58
|
os: [win32]
|
|
59
59
|
|
|
60
|
-
'@cloudflare/workers-utils@0.
|
|
61
|
-
resolution: {integrity: sha512-
|
|
60
|
+
'@cloudflare/workers-utils@0.61.0':
|
|
61
|
+
resolution: {integrity: sha512-xJaWBTrLAn/umnvegxIrGemY8wUnKQecmHlPKOcvOHMiLrpKklipTK1XbOk2Qzivpx5yZsiDIjAv9uU8TTIJ6Q==}
|
|
62
62
|
peerDependencies:
|
|
63
63
|
vitest: ^4.1.0 || ^5.0.0
|
|
64
64
|
peerDependenciesMeta:
|
|
@@ -567,8 +567,8 @@ packages:
|
|
|
567
567
|
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
|
|
568
568
|
engines: {node: '>= 0.6'}
|
|
569
569
|
|
|
570
|
-
miniflare@5.
|
|
571
|
-
resolution: {integrity: sha512-
|
|
570
|
+
miniflare@5.20261201.0-beta:
|
|
571
|
+
resolution: {integrity: sha512-fzuDddbIUf8kSsip5APBAoA3zniIrSdSiiIycXRBFB06B4zC8/++0NEeXu9JelO8ezcKsJpViM8BsL7CzNFNpQ==}
|
|
572
572
|
engines: {node: '>=22.12.0'}
|
|
573
573
|
peerDependencies:
|
|
574
574
|
kerberos: ^2.0.0
|
|
@@ -643,23 +643,23 @@ packages:
|
|
|
643
643
|
whatwg-url@5.0.0:
|
|
644
644
|
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
|
|
645
645
|
|
|
646
|
-
workerd@1.
|
|
647
|
-
resolution: {integrity: sha512-
|
|
646
|
+
workerd@1.20261201.1:
|
|
647
|
+
resolution: {integrity: sha512-HbaelaaUD7TvytkuIadqsHyHIV95bIdP9GCFKhcPFc1hsvBXNOAhC97cpgl9YLlWuql2AGBFzchyjxmjQv5Biw==}
|
|
648
648
|
engines: {node: '>=16'}
|
|
649
649
|
hasBin: true
|
|
650
650
|
|
|
651
|
-
wrangler@4.
|
|
652
|
-
resolution: {integrity: sha512-
|
|
651
|
+
wrangler@4.171.0:
|
|
652
|
+
resolution: {integrity: sha512-pXilcA3/5anwhJxMXvkI+FAG6s4zReAMdIVqprK14duLgAoV6/CLBsg1Zl30nUuflUCMiIWJzDvAUiFSNJDi3w==}
|
|
653
653
|
engines: {node: '>=22.12.0'}
|
|
654
654
|
hasBin: true
|
|
655
655
|
peerDependencies:
|
|
656
|
-
'@cloudflare/workers-types': ^5.
|
|
656
|
+
'@cloudflare/workers-types': ^5.20261201.1
|
|
657
657
|
peerDependenciesMeta:
|
|
658
658
|
'@cloudflare/workers-types':
|
|
659
659
|
optional: true
|
|
660
660
|
|
|
661
|
-
ws@8.
|
|
662
|
-
resolution: {integrity: sha512-
|
|
661
|
+
ws@8.23.1:
|
|
662
|
+
resolution: {integrity: sha512-1rzWDSN0NOi3tpwgHsQExjWRoKUGtjCkJ2gZRaaRtzhYLboMytOI9pj9PU7yCgY37auqdd4OyLofZDbkeuZmPA==}
|
|
663
663
|
engines: {node: '>=10.0.0'}
|
|
664
664
|
peerDependencies:
|
|
665
665
|
bufferutil: ^4.0.1
|
|
@@ -680,28 +680,28 @@ snapshots:
|
|
|
680
680
|
|
|
681
681
|
'@cloudflare/kv-asset-handler@0.5.1': {}
|
|
682
682
|
|
|
683
|
-
'@cloudflare/unenv-preset@2.16.2(unenv@2.0.0-rc.24)(workerd@1.
|
|
683
|
+
'@cloudflare/unenv-preset@2.16.2(unenv@2.0.0-rc.24)(workerd@1.20261201.1)':
|
|
684
684
|
dependencies:
|
|
685
685
|
unenv: 2.0.0-rc.24
|
|
686
686
|
optionalDependencies:
|
|
687
|
-
workerd: 1.
|
|
687
|
+
workerd: 1.20261201.1
|
|
688
688
|
|
|
689
|
-
'@cloudflare/workerd-darwin-64@1.
|
|
689
|
+
'@cloudflare/workerd-darwin-64@1.20261201.1':
|
|
690
690
|
optional: true
|
|
691
691
|
|
|
692
|
-
'@cloudflare/workerd-darwin-arm64@1.
|
|
692
|
+
'@cloudflare/workerd-darwin-arm64@1.20261201.1':
|
|
693
693
|
optional: true
|
|
694
694
|
|
|
695
|
-
'@cloudflare/workerd-linux-64@1.
|
|
695
|
+
'@cloudflare/workerd-linux-64@1.20261201.1':
|
|
696
696
|
optional: true
|
|
697
697
|
|
|
698
|
-
'@cloudflare/workerd-linux-arm64@1.
|
|
698
|
+
'@cloudflare/workerd-linux-arm64@1.20261201.1':
|
|
699
699
|
optional: true
|
|
700
700
|
|
|
701
|
-
'@cloudflare/workerd-windows-64@1.
|
|
701
|
+
'@cloudflare/workerd-windows-64@1.20261201.1':
|
|
702
702
|
optional: true
|
|
703
703
|
|
|
704
|
-
'@cloudflare/workers-utils@0.
|
|
704
|
+
'@cloudflare/workers-utils@0.61.0':
|
|
705
705
|
dependencies:
|
|
706
706
|
'@cspotcode/source-map-support': 0.8.1
|
|
707
707
|
chalk: 5.3.0
|
|
@@ -1102,13 +1102,13 @@ snapshots:
|
|
|
1102
1102
|
dependencies:
|
|
1103
1103
|
mime-db: 1.52.0
|
|
1104
1104
|
|
|
1105
|
-
miniflare@5.
|
|
1105
|
+
miniflare@5.20261201.0-beta(@types/node@18.19.130):
|
|
1106
1106
|
dependencies:
|
|
1107
1107
|
'@cspotcode/source-map-support': 0.8.1
|
|
1108
1108
|
sharp: 0.35.5(@types/node@18.19.130)
|
|
1109
1109
|
undici: 7.30.2
|
|
1110
|
-
workerd: 1.
|
|
1111
|
-
ws: 8.
|
|
1110
|
+
workerd: 1.20261201.1
|
|
1111
|
+
ws: 8.23.1
|
|
1112
1112
|
youch: 4.1.0-beta.10
|
|
1113
1113
|
transitivePeerDependencies:
|
|
1114
1114
|
- '@types/node'
|
|
@@ -1186,29 +1186,29 @@ snapshots:
|
|
|
1186
1186
|
tr46: 0.0.3
|
|
1187
1187
|
webidl-conversions: 3.0.1
|
|
1188
1188
|
|
|
1189
|
-
workerd@1.
|
|
1189
|
+
workerd@1.20261201.1:
|
|
1190
1190
|
optionalDependencies:
|
|
1191
|
-
'@cloudflare/workerd-darwin-64': 1.
|
|
1192
|
-
'@cloudflare/workerd-darwin-arm64': 1.
|
|
1193
|
-
'@cloudflare/workerd-linux-64': 1.
|
|
1194
|
-
'@cloudflare/workerd-linux-arm64': 1.
|
|
1195
|
-
'@cloudflare/workerd-windows-64': 1.
|
|
1191
|
+
'@cloudflare/workerd-darwin-64': 1.20261201.1
|
|
1192
|
+
'@cloudflare/workerd-darwin-arm64': 1.20261201.1
|
|
1193
|
+
'@cloudflare/workerd-linux-64': 1.20261201.1
|
|
1194
|
+
'@cloudflare/workerd-linux-arm64': 1.20261201.1
|
|
1195
|
+
'@cloudflare/workerd-windows-64': 1.20261201.1
|
|
1196
1196
|
|
|
1197
|
-
wrangler@4.
|
|
1197
|
+
wrangler@4.171.0(@types/node@18.19.130):
|
|
1198
1198
|
dependencies:
|
|
1199
1199
|
'@cloudflare/kv-asset-handler': 0.5.1
|
|
1200
|
-
'@cloudflare/unenv-preset': 2.16.2(unenv@2.0.0-rc.24)(workerd@1.
|
|
1201
|
-
'@cloudflare/workers-utils': 0.
|
|
1200
|
+
'@cloudflare/unenv-preset': 2.16.2(unenv@2.0.0-rc.24)(workerd@1.20261201.1)
|
|
1201
|
+
'@cloudflare/workers-utils': 0.61.0
|
|
1202
1202
|
'@cspotcode/source-map-support': 0.8.1
|
|
1203
1203
|
'@types/yargs': 17.0.24
|
|
1204
1204
|
cloudflare: 5.2.0
|
|
1205
1205
|
devtools-protocol: 0.0.1182435
|
|
1206
1206
|
esbuild: 0.28.2
|
|
1207
|
-
miniflare: 5.
|
|
1207
|
+
miniflare: 5.20261201.0-beta(@types/node@18.19.130)
|
|
1208
1208
|
path-to-regexp: 6.3.0
|
|
1209
1209
|
undici: 7.30.2
|
|
1210
1210
|
unenv: 2.0.0-rc.24
|
|
1211
|
-
workerd: 1.
|
|
1211
|
+
workerd: 1.20261201.1
|
|
1212
1212
|
optionalDependencies:
|
|
1213
1213
|
fsevents: 2.3.3
|
|
1214
1214
|
transitivePeerDependencies:
|
|
@@ -1219,7 +1219,7 @@ snapshots:
|
|
|
1219
1219
|
- utf-8-validate
|
|
1220
1220
|
- vitest
|
|
1221
1221
|
|
|
1222
|
-
ws@8.
|
|
1222
|
+
ws@8.23.1: {}
|
|
1223
1223
|
|
|
1224
1224
|
youch-core@0.3.3:
|
|
1225
1225
|
dependencies:
|
|
@@ -144,6 +144,13 @@ are preserved by the hub's backups. Set them once, as the fleet account:
|
|
|
144
144
|
alerts to 85% used to match the worker warning on disks up to 1706 GiB;
|
|
145
145
|
on larger disks use the 256 GiB free warning floor from the worker policy. Do not add a
|
|
146
146
|
notification destination until one you are allowed to use exists.
|
|
147
|
+
- **T3 restart counts.** The pinned Beszel agent reads
|
|
148
|
+
a fixed set of metrics and has no input for custom ones, so the restarts
|
|
149
|
+
of T3 per 24 hours are not shown next to CPU, memory and pressure there.
|
|
150
|
+
`homelab check` shows them for each worker (`t3Restarts24h`, and `health:
|
|
151
|
+
degraded` above what `worker:t3-stability` allows), and the check fails
|
|
152
|
+
on the worker. The exact count in the hub is tracked in [#528](https://github.com/crvouga/homelab/issues/528)
|
|
153
|
+
and depends on [Beszel custom metrics](https://github.com/henrygd/beszel/issues/2562).
|
|
147
154
|
- **Service alerts are not promised.** Alerting on a failed systemd service has
|
|
148
155
|
not been verified against the pinned release; the agent watches only the
|
|
149
156
|
services in `SERVICE_PATTERNS`, and none of them is relied on for alerting.
|
|
@@ -70,20 +70,8 @@
|
|
|
70
70
|
- name: Inspect existing service ownership
|
|
71
71
|
ansible.builtin.service_facts:
|
|
72
72
|
tasks:
|
|
73
|
-
- name:
|
|
74
|
-
ansible.builtin.
|
|
75
|
-
path: '{{ development_home }}/.local/share/personal/fleet/agent-commands'
|
|
76
|
-
follow: false
|
|
77
|
-
register: retired_agent_commands
|
|
78
|
-
|
|
79
|
-
- name: Remove the fleet-owned coding-agent launcher link
|
|
80
|
-
ansible.builtin.file:
|
|
81
|
-
path: '{{ development_home }}/.local/share/personal/fleet/agent-commands'
|
|
82
|
-
state: absent
|
|
83
|
-
when:
|
|
84
|
-
- retired_agent_commands.stat.islnk | default(false)
|
|
85
|
-
- retired_agent_commands.stat.lnk_target == 'current/agents/bin'
|
|
86
|
-
|
|
73
|
+
- name: Retire the fleet-owned coding-agent launcher
|
|
74
|
+
ansible.builtin.import_tasks: tasks/retire-agent-launchers.yml
|
|
87
75
|
- name: Install the pinned packages
|
|
88
76
|
ansible.builtin.import_tasks: tasks/packages.yml
|
|
89
77
|
- name: Configure Docker
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Keep the first successful T3 loopback observation for the current boot."""
|
|
2
|
+
|
|
3
|
+
from http.client import HTTPConnection, HTTPException
|
|
4
|
+
import json
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import sys
|
|
7
|
+
import time
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def answers(timeout: float) -> bool:
|
|
11
|
+
connection = HTTPConnection('127.0.0.1', 3773, timeout=timeout)
|
|
12
|
+
try:
|
|
13
|
+
connection.request('GET', '/.well-known/t3/environment')
|
|
14
|
+
response = connection.getresponse()
|
|
15
|
+
if response.status != 200:
|
|
16
|
+
return False
|
|
17
|
+
identity = json.load(response)
|
|
18
|
+
return isinstance(identity, dict) and isinstance(identity.get('environmentId'), str)
|
|
19
|
+
except (OSError, HTTPException, ValueError):
|
|
20
|
+
return False
|
|
21
|
+
finally:
|
|
22
|
+
connection.close()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def record_readiness(marker: Path, interval: float) -> None:
|
|
26
|
+
while not marker.exists():
|
|
27
|
+
if answers(interval):
|
|
28
|
+
milliseconds = time.clock_gettime_ns(time.CLOCK_BOOTTIME) // 1_000_000
|
|
29
|
+
# The user service is the sole writer. Publish the complete value at once.
|
|
30
|
+
temporary = marker.with_suffix('.tmp')
|
|
31
|
+
temporary.write_text(f'{milliseconds}\n', encoding='ascii')
|
|
32
|
+
temporary.replace(marker)
|
|
33
|
+
return
|
|
34
|
+
time.sleep(interval)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
if __name__ == '__main__':
|
|
38
|
+
record_readiness(Path(sys.argv[1]), float(sys.argv[2]))
|
|
@@ -30,6 +30,8 @@
|
|
|
30
30
|
- libxtst6
|
|
31
31
|
- xdg-utils
|
|
32
32
|
tasks:
|
|
33
|
+
- name: Require the former upstream server to be retired
|
|
34
|
+
ansible.builtin.import_tasks: tasks/check-legacy-t3.yml
|
|
33
35
|
- name: Create the desktop application scope policy directory
|
|
34
36
|
ansible.builtin.file:
|
|
35
37
|
path: /etc/systemd/user/app-com.t3tools.T3Code-.scope.d
|
|
@@ -266,19 +268,6 @@
|
|
|
266
268
|
ansible.builtin.file:
|
|
267
269
|
path: '{{ development_home }}/.config/systemd/user/t3code-headless.service'
|
|
268
270
|
state: absent
|
|
269
|
-
# One T3 process per worker: the desktop app. The former headless server
|
|
270
|
-
# (`t3 service install`) is retired; absent on machines that never had it.
|
|
271
|
-
- name: Retire the former headless T3 server
|
|
272
|
-
become: true
|
|
273
|
-
become_user: '{{ development_user }}'
|
|
274
|
-
environment:
|
|
275
|
-
XDG_RUNTIME_DIR: '/run/user/{{ development_uid }}'
|
|
276
|
-
ansible.builtin.systemd_service:
|
|
277
|
-
scope: user
|
|
278
|
-
name: t3code.service
|
|
279
|
-
state: stopped
|
|
280
|
-
enabled: false
|
|
281
|
-
failed_when: false
|
|
282
271
|
# Starting needs the auto-login graphical session, which a machine has only
|
|
283
272
|
# after its first reboot; the running state is measured after this play.
|
|
284
273
|
- name: Reconcile the desktop listener with the recovery timer
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
vars_files:
|
|
19
19
|
- policy.json
|
|
20
20
|
tasks:
|
|
21
|
+
- name: Require the former upstream server to be retired
|
|
22
|
+
ansible.builtin.import_tasks: tasks/check-legacy-t3.yml
|
|
21
23
|
- name: Require the pinned server from the worker's toolchain
|
|
22
24
|
ansible.builtin.stat:
|
|
23
25
|
path: '{{ t3_server_path }}'
|
|
@@ -5,12 +5,8 @@
|
|
|
5
5
|
# minute by personal-worker-recovery.timer (managed by converge,
|
|
6
6
|
# tasks/recovery.yml), from the stable copy the role installs beside
|
|
7
7
|
# t3-idle.py.
|
|
8
|
-
# -
|
|
9
|
-
#
|
|
10
|
-
# - Desktop only. No graphical session: T3_NO_GRAPHICAL_SESSION; after three
|
|
11
|
-
# checks in a row the display manager is restarted so auto-login starts
|
|
12
|
-
# one, three times at most until a session is seen again. A headless
|
|
13
|
-
# worker has no session to wait for.
|
|
8
|
+
# - Report a conflicting server or a missing desktop session without
|
|
9
|
+
# operating either the foreign service or the display manager.
|
|
14
10
|
# - Stopped or failed: reset its start limit and start it.
|
|
15
11
|
# - Running but its local API has not answered for three checks in a row:
|
|
16
12
|
# restart it, since a hung server serves no turns. The first failed check
|
|
@@ -32,8 +28,6 @@ fi
|
|
|
32
28
|
url=http://127.0.0.1:3773/.well-known/t3/environment
|
|
33
29
|
runtime="${XDG_RUNTIME_DIR:?}"
|
|
34
30
|
failures="$runtime/personal-t3-health-failures"
|
|
35
|
-
no_session="$runtime/personal-t3-no-session"
|
|
36
|
-
display_restarts="$runtime/personal-t3-display-restarts"
|
|
37
31
|
pending="$runtime/personal-t3-restart-pending"
|
|
38
32
|
handoff="$runtime/personal-t3-desktop-handoff"
|
|
39
33
|
restarted="$runtime/personal-t3-restarted-for"
|
|
@@ -109,34 +103,16 @@ count() {
|
|
|
109
103
|
|
|
110
104
|
if systemctl --user is-active --quiet t3code.service ||
|
|
111
105
|
systemctl --user is-enabled --quiet t3code.service; then
|
|
112
|
-
echo "
|
|
113
|
-
|
|
114
|
-
echo "T3_LEGACY_SERVER_RUNNING"
|
|
115
|
-
exit 1
|
|
116
|
-
fi
|
|
106
|
+
echo "T3_LEGACY_SERVER_RUNNING: retire the former upstream unit after its turns finish."
|
|
107
|
+
exit 1
|
|
117
108
|
fi
|
|
118
109
|
|
|
119
110
|
if [ -z "$headless" ] && ! systemctl --user is-active --quiet graphical-session.target; then
|
|
120
111
|
rm -f "$failures"
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
exit 0
|
|
124
|
-
fi
|
|
125
|
-
seen=$(count "$no_session")
|
|
126
|
-
echo "T3_NO_GRAPHICAL_SESSION ($seen/$limit)."
|
|
127
|
-
if [ "$seen" -ge "$limit" ]; then
|
|
128
|
-
rm -f "$no_session"
|
|
129
|
-
restarts=$(count "$display_restarts")
|
|
130
|
-
if [ "$restarts" -le "$limit" ]; then
|
|
131
|
-
echo "Restarting the display manager so auto-login starts a session ($restarts/$limit)."
|
|
132
|
-
sudo -n systemctl restart display-manager.service
|
|
133
|
-
else
|
|
134
|
-
echo "The display manager was restarted $limit times; a person must log in."
|
|
135
|
-
fi
|
|
136
|
-
fi
|
|
112
|
+
echo "T3_NO_GRAPHICAL_SESSION"
|
|
113
|
+
[ "${1:-}" = --apply ] && exit 0
|
|
137
114
|
exit 1
|
|
138
115
|
fi
|
|
139
|
-
rm -f "$no_session" "$display_restarts"
|
|
140
116
|
|
|
141
117
|
if [ -z "$headless" ]; then
|
|
142
118
|
owner=$(python3 -I -B "$here/t3-listener.py") || exit 1
|
|
@@ -166,8 +142,9 @@ if [ -z "$headless" ]; then
|
|
|
166
142
|
;;
|
|
167
143
|
exposed) record_pending ;;
|
|
168
144
|
app-com.t3tools.T3Code-*.scope)
|
|
169
|
-
if [ "$
|
|
170
|
-
|
|
145
|
+
if [ "${1:-}" != --apply ]; then
|
|
146
|
+
echo "T3_DESKTOP_UNMANAGED: converge to adopt the desktop after its turns finish."
|
|
147
|
+
exit 1
|
|
171
148
|
fi
|
|
172
149
|
if [ "$force" != --force ] && ! python3 -I -B "$here/t3-idle.py" --state "${T3CODE_HOME:-$HOME/.t3}/userdata/statev2.sqlite"; then
|
|
173
150
|
record_pending
|
|
@@ -177,15 +154,11 @@ if [ -z "$headless" ]; then
|
|
|
177
154
|
# Remeasure after the idle probe. An interrupted handoff resumes from
|
|
178
155
|
# the listener that actually exists on the next invocation.
|
|
179
156
|
[ "$(python3 -I -B "$here/t3-listener.py")" = "$owner" ] || exit 1
|
|
180
|
-
|
|
157
|
+
printf '%s\n' "$owner" > "$handoff" || exit 1
|
|
158
|
+
echo "T3_HANDOFF: stopping the desktop scope for explicit adoption."
|
|
181
159
|
record_pending
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
else
|
|
185
|
-
systemctl --user stop --no-block "$owner" || exit 1
|
|
186
|
-
fi
|
|
187
|
-
# The application may spend its full stop timeout flushing state.
|
|
188
|
-
# Leave the stop job in systemd and resume on the next observation.
|
|
160
|
+
systemctl --user stop "$owner" || exit 1
|
|
161
|
+
# Confirm the port is free before starting the managed service.
|
|
189
162
|
[ "$(python3 -I -B "$here/t3-listener.py")" = free ] || exit 0
|
|
190
163
|
state=$(systemctl --user show "$owner" -p ActiveState --value)
|
|
191
164
|
case "$state" in active | activating | deactivating) exit 0 ;; esac
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
- name: Inspect the former upstream T3 server
|
|
3
|
+
become: true
|
|
4
|
+
become_user: '{{ development_user }}'
|
|
5
|
+
environment:
|
|
6
|
+
XDG_RUNTIME_DIR: '/run/user/{{ development_uid }}'
|
|
7
|
+
ansible.builtin.command:
|
|
8
|
+
argv: [systemctl, --user, '{{ item }}', --quiet, t3code.service]
|
|
9
|
+
loop: [is-active, is-enabled]
|
|
10
|
+
register: legacy_t3
|
|
11
|
+
changed_when: false
|
|
12
|
+
check_mode: false
|
|
13
|
+
failed_when: legacy_t3.rc not in [0, 1, 3, 4]
|
|
14
|
+
- name: Preserve the former server and its active turns
|
|
15
|
+
ansible.builtin.assert:
|
|
16
|
+
that: legacy_t3.results | selectattr('rc', 'equalto', 0) | list | length == 0
|
|
17
|
+
fail_msg: T3_LEGACY_SERVER_RUNNING. After its turns finish, stop and disable the former upstream t3code.service and rerun converge.
|
|
@@ -19,12 +19,39 @@
|
|
|
19
19
|
mode: '0755'
|
|
20
20
|
loop:
|
|
21
21
|
- t3-health.sh
|
|
22
|
+
- t3-boot-readiness.py
|
|
22
23
|
- t3-hang-snapshot.sh
|
|
23
24
|
- t3-listener.py
|
|
24
25
|
- t3-idle.py
|
|
25
26
|
- t3-renderers.py
|
|
26
27
|
- t3-local-only.py
|
|
27
|
-
- name: Declare
|
|
28
|
+
- name: Declare the boot-time T3 readiness probe
|
|
29
|
+
ansible.builtin.copy:
|
|
30
|
+
dest: '{{ development_home }}/.config/systemd/user/personal-t3-boot-readiness.service'
|
|
31
|
+
owner: '{{ development_user }}'
|
|
32
|
+
mode: '0600'
|
|
33
|
+
content: |
|
|
34
|
+
# Managed by personal converge: ansible/ubuntu/t3-boot-readiness.py
|
|
35
|
+
[Unit]
|
|
36
|
+
Description=Record the first successful T3 API probe after boot
|
|
37
|
+
ConditionPathExists=!%t/personal-t3-boot-readiness-ms
|
|
38
|
+
[Service]
|
|
39
|
+
ExecStart=/usr/bin/python3 -I -B /usr/local/lib/personal-fleet/t3-boot-readiness.py %t/personal-t3-boot-readiness-ms {{ t3Service.bootProbeIntervalSeconds }}
|
|
40
|
+
Restart=on-failure
|
|
41
|
+
RestartSec={{ t3Service.bootProbeIntervalSeconds }}
|
|
42
|
+
[Install]
|
|
43
|
+
WantedBy=default.target
|
|
44
|
+
- name: Enable T3 readiness measurement for the next boot
|
|
45
|
+
become: true
|
|
46
|
+
become_user: '{{ development_user }}'
|
|
47
|
+
environment:
|
|
48
|
+
XDG_RUNTIME_DIR: '/run/user/{{ development_uid }}'
|
|
49
|
+
ansible.builtin.systemd_service:
|
|
50
|
+
scope: user
|
|
51
|
+
name: personal-t3-boot-readiness.service
|
|
52
|
+
daemon_reload: true
|
|
53
|
+
enabled: true
|
|
54
|
+
- name: Declare bounded recovery of the managed worker T3 service
|
|
28
55
|
ansible.builtin.copy:
|
|
29
56
|
dest: '{{ development_home }}/.config/systemd/user/personal-worker-recovery.service'
|
|
30
57
|
owner: '{{ development_user }}'
|
|
@@ -32,7 +59,7 @@
|
|
|
32
59
|
content: |
|
|
33
60
|
# Managed by personal converge: ansible/ubuntu/t3-health.sh
|
|
34
61
|
[Unit]
|
|
35
|
-
Description=Keep the worker T3
|
|
62
|
+
Description=Keep the managed worker T3 service running and responsive
|
|
36
63
|
[Service]
|
|
37
64
|
Type=oneshot
|
|
38
65
|
Environment=T3_RENDERER_HIGH_MIB={{ resourceSafety.rendererHighMiB }} T3_RENDERER_MAX_MIB={{ resourceSafety.rendererMaxMiB }}
|
|
@@ -49,7 +76,7 @@
|
|
|
49
76
|
mode: '0600'
|
|
50
77
|
content: |
|
|
51
78
|
[Unit]
|
|
52
|
-
Description=Check the worker T3
|
|
79
|
+
Description=Check the managed worker T3 service every minute
|
|
53
80
|
[Timer]
|
|
54
81
|
OnBootSec=1min
|
|
55
82
|
OnUnitActiveSec=1min
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
- name: Inspect the retired coding-agent launcher link
|
|
3
|
+
ansible.builtin.stat:
|
|
4
|
+
path: '{{ development_home }}/.local/share/personal/fleet/agent-commands'
|
|
5
|
+
follow: false
|
|
6
|
+
register: retired_agent_commands
|
|
7
|
+
|
|
8
|
+
- name: Remove the fleet-owned coding-agent launcher link
|
|
9
|
+
ansible.builtin.file:
|
|
10
|
+
path: '{{ development_home }}/.local/share/personal/fleet/agent-commands'
|
|
11
|
+
state: absent
|
|
12
|
+
when:
|
|
13
|
+
- retired_agent_commands.stat.islnk | default(false)
|
|
14
|
+
- retired_agent_commands.stat.lnk_target == 'current/agents/bin'
|
package/docs/runbooks.md
CHANGED
|
@@ -14,7 +14,7 @@ It reads a code by where it stands, never by the word it ends with. The CLI
|
|
|
14
14
|
proxy documents the codes of its own commands in
|
|
15
15
|
[its README](../cliproxy/README.md); the ones converge reports are here.
|
|
16
16
|
|
|
17
|
-
There are
|
|
17
|
+
There are 463 codes; 107 need a person.
|
|
18
18
|
|
|
19
19
|
## Bootstrap of a new or returning worker
|
|
20
20
|
|
|
@@ -371,14 +371,19 @@ runaway, write `1` to that agent scope’s `cgroup.kill`.
|
|
|
371
371
|
- `T3_UPDATES_UNMANAGED`: a failure 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.**
|
|
372
372
|
- `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.
|
|
373
373
|
- `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.
|
|
374
|
-
- `T3_LEGACY_SERVER_RUNNING`:
|
|
375
|
-
- `T3_NO_GRAPHICAL_SESSION`:
|
|
374
|
+
- `T3_LEGACY_SERVER_RUNNING`: the former upstream `t3code.service` is active or enabled. Let its turns finish, then stop and disable it before running `converge`. **Needs a person.**
|
|
375
|
+
- `T3_NO_GRAPHICAL_SESSION`: the desktop worker cannot serve T3 until its graphical session starts. Inspect the display manager and restore auto-login. **Needs a person.**
|
|
376
|
+
- `T3_DESKTOP_UNMANAGED`: a standalone T3 desktop owns the listener. Run `converge` when its turns finish to adopt it.
|
|
376
377
|
- `T3_RESTART_DEADLINE`: not a failure. `personal-worker-recovery` logs it when a restart of T3 has waited `t3RestartMaxDeferralHours` (`ansible/ubuntu/policy.json`) and is applied although agent turns run: they end. `worker:t3-deadline-restarts` counts these of the last 24 hours as a warning. Nothing is left to repair: send the threads whose turn ended their next message.
|
|
377
378
|
- `WIP_GUARD_HEAVY`: a warning of `worker:wip-guard`: a run of the work-in-progress guard in the last 24 hours took longer than `resourceSafety.wipGuard.slowRunSeconds` or used more than `peakWarnMiB` (`ansible/ubuntu/policy.json`). Each run ends with a JSON `run` line in `journalctl --user -u personal-worker-wip-guard.service`. The cost is a worktree with a large tree of files Git does not ignore: ignore its build output or remove the worktree.
|
|
378
|
-
- `T3_BOOT_SERVING_LATE`: a failure of `worker:t3-health`: T3 answers now, but its
|
|
379
|
+
- `T3_BOOT_SERVING_LATE`: a failure of `worker:t3-health`: T3 answers now, but its first successful loopback probe was later than `t3Service.bootServingSeconds` (`ansible/ubuntu/policy.json`) after this boot. A worker that lost power is given that long to serve on loopback with no one at the machine. Read the journal of the T3 unit and of `personal-worker-recovery` for what delayed the start.
|
|
379
380
|
- `T3_HANG_SNAPSHOT`: not a failure. `personal-worker-recovery` logs it on the first failed check of the T3 local API with the directory it wrote under `~/.local/state/personal/t3-hangs` (the newest ten are kept): each thread of T3 with the kernel call it waits in (`wchan`), the pressure, the busiest processes and the journal of the unit. Read it before the third failed check restarts T3 and destroys the evidence. `worker:t3-health` names the newest one after a restart.
|
|
380
381
|
- `T3_RESTART_BACKOFF`: not a failure. `personal-worker-recovery` logs it when T3 is unresponsive again soon after the watchdog restarted it: each restart for unresponsiveness within the hour makes the next one wait twice as long (`t3Service.restartBackoffBaseSeconds`, at most `restartBackoffMaxSeconds` in `ansible/ubuntu/policy.json`), so a persistent fault does not restart T3 every few minutes. Find the cause in the snapshots (`T3_HANG_SNAPSHOT`).
|
|
381
382
|
- `T3_RESTARTS_FREQUENT`: a failure of `worker:t3-stability`: the watchdog restarted T3 for being unresponsive more than `t3Stability.maxRestarts24h` times in the last 24 hours. Each restart leaves a server that answers, so no other check reports it. The remedy names the newest snapshots of why T3 hung; look for agents or recovery jobs running heavy work at that time.
|
|
383
|
+
- `T3_LINK_TAILSCALE_DOWN`: the first explanation of a failing `t3:paired-access` whose link exists but is not reachable: Tailscale is not running on the manager, the worker is offline on the tailnet, or the worker does not answer over SSH although the tailnet lists it online. Run `homelab tailnet`, then bring Tailscale or the worker back.
|
|
384
|
+
- `T3_LINK_T3_RESTARTING`: the worker's T3 is starting or was restarted in the last three minutes, by the watchdog or a sync, and the manager's link has not reconnected. Check again in a few minutes; a worker that keeps doing this fails `worker:t3-stability`.
|
|
385
|
+
- `T3_LINK_T3_NOT_ANSWERING`: the worker answers over SSH but its T3 does not answer its local API. See `worker:t3-health`, `worker:t3-stability` and the hang snapshots on the worker.
|
|
386
|
+
- `T3_LINK_RELAY_DOWN`: T3 answers on the worker but the manager's link does not reach it. Check `t3:private-route` and the link in T3 Connections on the manager.
|
|
382
387
|
- `T3_API_SLOW`: a failure of `worker:t3-stability`: more than `t3Stability.slowProbeFraction` of the watchdog's probes of the T3 local API in the last 24 hours took longer than `t3Stability.slowProbeMs`. T3 answers but the worker is overloaded or T3 stalls; check `worker:pressure-events` and the load of the worker.
|
|
383
388
|
- `AGENT_OOM_KILLS`: a warning of `worker:agent-oom`: the kernel killed processes inside agent scopes in the last 24 hours although the worker as a whole had memory left; the summary names the programs (never their arguments). Agent scopes and shell tool scopes are slowed by reclaim at `memory.high` before they are killed at `memory.max`. Run fewer builds at once (`homelab-heavy` queues them), lower their parallelism (`TURBO_CONCURRENCY`, `gradle --max-workers`) or move the work to a larger worker.
|
|
384
389
|
- `T3_IDLE_UNKNOWN`: not a failure of its own. The idle check of `personal-worker-recovery` could not read the runs T3 records in its state database, and what it cannot read counts as busy: a pending restart keeps waiting (`T3_RESTART_PENDING`) until its deadline. Read `worker:t3-health` when it repeats.
|