@crvouga/homelab 0.23.6 → 0.23.8
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 +26 -26
- package/ansible/macos/legacy-monitoring.yml +22 -0
- package/ansible/macos/manager.yml +1 -0
- package/ansible/macos/policy.json +4 -0
- package/ansible/macos/tasks/legacy-agent.yml +28 -3
- package/ansible/ubuntu/disk-gc.py +60 -10
- package/ansible/ubuntu/policy.json +42 -16
- package/ansible/ubuntu/pressure-guard.py +2 -5
- package/ansible/ubuntu/tasks/recovery.yml +4 -0
- package/ansible/ubuntu/tasks/resources.yml +58 -10
- package/cliproxy/docs/backup.md +15 -0
- package/cliproxy/scripts/backup +218 -182
- package/cliproxy/scripts/cli.py +1 -1
- package/cliproxy/scripts/retention.py +16 -12
- package/docs/convergence.md +3 -0
- package/docs/manager-recovery.md +7 -0
- package/docs/runbooks.md +14 -3
- package/docs/ubuntu-sync.md +27 -5
- package/mise.lock +82 -138
- package/mise.toml +16 -16
- package/package.json +4 -3
- package/src/cli/fleet-sync.ts +23 -4
- package/src/cli/legacy-monitoring.ts +41 -0
- package/src/cli/register-fleet.ts +1 -1
- package/src/manager-health.ts +1 -1
- package/src/node-converge-linux.ts +2 -17
- package/src/platform/resource-verify.ts +84 -12
- package/src/platform/ubuntu-baseline.ts +47 -0
package/mise.toml
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# min_version is also the mise bootstrap/bootstrap.sh installs on a machine
|
|
4
4
|
# that has none or an older one (a newer one is kept); the mise_*_sha256
|
|
5
5
|
# digests under [vars] move with it (bun bootstrap/pins.ts mise).
|
|
6
|
-
min_version = "2026.11.
|
|
6
|
+
min_version = "2026.11.15"
|
|
7
7
|
|
|
8
8
|
[settings]
|
|
9
9
|
lockfile = true
|
|
@@ -17,7 +17,7 @@ delta = "conda:git-delta"
|
|
|
17
17
|
gh = "2.106.0"
|
|
18
18
|
shellcheck = "0.11.0"
|
|
19
19
|
actionlint = "1.7.12"
|
|
20
|
-
opentofu = "1.13.
|
|
20
|
+
opentofu = "1.13.11"
|
|
21
21
|
bun = "1.4.5"
|
|
22
22
|
node = "26.13.1"
|
|
23
23
|
atlas = { version = "1.4.0", os = ["linux", "macos"], lazy = true }
|
|
@@ -51,13 +51,13 @@ vault = "2.2.2"
|
|
|
51
51
|
claude = "2.1.332"
|
|
52
52
|
codex = "0.172.0"
|
|
53
53
|
gemini = { version = "0.71.1", allow_builds = ["@lydell/node-pty"] }
|
|
54
|
-
copilot = "1.0.
|
|
54
|
+
copilot = "1.0.117"
|
|
55
55
|
# Agent CLIs without a registry backend: exact vendor artifacts, checksums in mise.lock.
|
|
56
56
|
"http:grok" = { version = "1.0.92", bin = "grok", platforms = { linux-x64 = { url = "https://x.ai/cli/grok-{{version}}-linux-x86_64" }, linux-arm64 = { url = "https://x.ai/cli/grok-{{version}}-linux-aarch64" }, macos-x64 = { url = "https://x.ai/cli/grok-{{version}}-macos-x86_64" }, macos-arm64 = { url = "https://x.ai/cli/grok-{{version}}-macos-aarch64" } }, os = ["linux", "macos"] }
|
|
57
|
-
"http:antigravity" = { version = "1.5.
|
|
57
|
+
"http:antigravity" = { version = "1.5.20", bin = "antigravity", platforms = { linux-x64 = { url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.20-6722198040346624/linux-x64/cli_linux_x64.tar.gz" }, linux-arm64 = { url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.20-6722198040346624/linux-arm/cli_linux_arm64.tar.gz" }, macos-x64 = { url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.20-6722198040346624/darwin-x64/cli_mac_x64.tar.gz" }, macos-arm64 = { url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.20-6722198040346624/darwin-arm/cli_mac_arm64.tar.gz" } }, os = ["linux", "macos"] }
|
|
58
58
|
"http:cursor-agent" = { version = "2026.11.22-e9042b2", bin = "cursor-agent", bin_path = "dist-package", os = ["linux", "macos"], platforms = { linux-x64 = { url = "https://downloads.cursor.com/lab/{{version}}/linux/x64/agent-cli-package.tar.gz" }, linux-arm64 = { url = "https://downloads.cursor.com/lab/{{version}}/linux/arm64/agent-cli-package.tar.gz" }, macos-x64 = { url = "https://downloads.cursor.com/lab/{{version}}/darwin/x64/agent-cli-package.tar.gz" }, macos-arm64 = { url = "https://downloads.cursor.com/lab/{{version}}/darwin/arm64/agent-cli-package.tar.gz" } } }
|
|
59
59
|
|
|
60
|
-
"aws" = { version = "2.42.
|
|
60
|
+
"aws" = { version = "2.42.7", os = ["linux", "macos"] }
|
|
61
61
|
"rust" = "1.100.1"
|
|
62
62
|
"cmake" = "4.5.1"
|
|
63
63
|
"ninja" = "1.13.2"
|
|
@@ -101,22 +101,22 @@ BUN_INSTALL_CACHE_DIR = "{{env.HOME}}/.bun/install/cache"
|
|
|
101
101
|
# mise itself, installed by bootstrap/bootstrap.sh before mise can read this
|
|
102
102
|
# file: the version is min_version above, these are its release archives
|
|
103
103
|
# (SHASUMS256.txt of that release).
|
|
104
|
-
mise_linux_x64_sha256 = "
|
|
105
|
-
mise_linux_arm64_sha256 = "
|
|
106
|
-
mise_macos_x64_sha256 = "
|
|
107
|
-
mise_macos_arm64_sha256 = "
|
|
104
|
+
mise_linux_x64_sha256 = "5f70c8b281b4b1d1a4e69c4e80ae9f41c3fe80c5adaf7078ea11411a43e2dd5d"
|
|
105
|
+
mise_linux_arm64_sha256 = "f69e0c172e312dc9c2a193d1e654f9853a2fa71d23b9ec0bbea066211c7de12a"
|
|
106
|
+
mise_macos_x64_sha256 = "35f818040fd88c2ce7f2a6d4e04ae05c0b1d5e104ce94e884024c04f3b1a82df"
|
|
107
|
+
mise_macos_arm64_sha256 = "67b3b4ed4cbef2b67f077ca2f418886bc0ede86c88dcd606d8a7c3c908046b1a"
|
|
108
108
|
# Official native server distribution (Ubuntu workers, and the manager's
|
|
109
109
|
# pinned CLI); bootstrap/native-t3.ts owns installation. From the release's SHA256SUMS.
|
|
110
|
-
t3_version = "0.1.14-nightly.
|
|
111
|
-
t3_linux_x64_sha256 = "
|
|
112
|
-
t3_linux_arm64_sha256 = "
|
|
113
|
-
t3_darwin_arm64_sha256 = "
|
|
110
|
+
t3_version = "0.1.14-nightly.20261130.5465"
|
|
111
|
+
t3_linux_x64_sha256 = "8281b43a67bd44f1127a0d177a6502ac526360f69ea3722659f560de5b9d7ce6"
|
|
112
|
+
t3_linux_arm64_sha256 = "9d3b42782e6bcaaeb06053432cd8850a47ddd32c54c9c2dc339595de56d6b57a"
|
|
113
|
+
t3_darwin_arm64_sha256 = "f72f2ec3de231c3d5605b9606eab3410ae1354be6957433fab04187c548921e0"
|
|
114
114
|
# Official T3 Code desktop .deb (same release). Workers run this GUI app as their
|
|
115
115
|
# only T3 process; it embeds the server. Upstream SHA256SUMS omits .deb files,
|
|
116
116
|
# so these digests were computed from the release assets.
|
|
117
|
-
t3_desktop_darwin_arm64_sha256 = "
|
|
118
|
-
t3_desktop_amd64_sha256 = "
|
|
119
|
-
t3_desktop_arm64_sha256 = "
|
|
117
|
+
t3_desktop_darwin_arm64_sha256 = "aa1e19c49f3a830698ba7c26a58c22c31fcbb898dacb9b2a33093eed30383760"
|
|
118
|
+
t3_desktop_amd64_sha256 = "f8640eb1133ad40e612eba778ec3ec9228a155c5b457d5debe60d6b2bc272f5f"
|
|
119
|
+
t3_desktop_arm64_sha256 = "6e83fac489832f6fe1d6285c6986e47121304fcaaf6dd569a2bf88b850813ce0"
|
|
120
120
|
# Official AWS v2 Windows MSI, same version as tools.aws; checked before execution.
|
|
121
121
|
aws_windows_msi_sha256 = "65b82923074b154e3ec5375716b886e3c5bd5483714cc94ba1e67a04dfbb6715"
|
|
122
122
|
# Docker Desktop supplies the macOS engine, Compose and Buildx as one vendor bundle.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvouga/homelab",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.8",
|
|
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",
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"test": "bun test",
|
|
44
44
|
"test:cliproxy": "HOMELAB_CONFIG=$PWD/examples/fleet.json python3 -B -m unittest discover -s cliproxy/tests -p \"test_*.py\"",
|
|
45
45
|
"lint:cliproxy": "HOMELAB_CONFIG=$PWD/examples/fleet.json python3 -B cliproxy/scripts/check.py",
|
|
46
|
-
"check": "bun run format && bun run tc && bun run lint && bun test && bun run lint:cliproxy && bun run test:cliproxy"
|
|
46
|
+
"check": "bun run format && bun run tc && bun run lint && bun test && bun run test:vm-setup && bun run lint:cliproxy && bun run test:cliproxy",
|
|
47
|
+
"test:vm-setup": "python3 -B -m unittest discover -s ansible/ubuntu/tests -p 'test_*.py'"
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
49
50
|
"@inquirer/prompts": "8.8.1",
|
|
@@ -73,5 +74,5 @@
|
|
|
73
74
|
"engines": {
|
|
74
75
|
"node": ">=22"
|
|
75
76
|
},
|
|
76
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "ca217613ff14b205a5a78b3654004581115d4155"
|
|
77
78
|
}
|
package/src/cli/fleet-sync.ts
CHANGED
|
@@ -53,6 +53,7 @@ import { inRunCheckout, managerRunScript, rehome } from './fleet-sync-checkout';
|
|
|
53
53
|
import { syncAccounts } from './fleet-sync-accounts';
|
|
54
54
|
import { workerCopyRefusal } from './fleet-sync-worker-copy';
|
|
55
55
|
import { packageInfo } from '../package-info';
|
|
56
|
+
import { retireLegacyMonitoring } from './legacy-monitoring';
|
|
56
57
|
import {
|
|
57
58
|
asksAncestry,
|
|
58
59
|
asksMise,
|
|
@@ -178,7 +179,7 @@ export async function fleetSync(
|
|
|
178
179
|
home: undefined,
|
|
179
180
|
});
|
|
180
181
|
if (options.schedule === 'status') return scheduleStatus(settings, run);
|
|
181
|
-
if (options.only
|
|
182
|
+
if (options.only) return onlyScope(options, settings, run);
|
|
182
183
|
const sync = (request = options): Promise<CommandOutcome> =>
|
|
183
184
|
managerSync(request, settings, {
|
|
184
185
|
run,
|
|
@@ -950,14 +951,32 @@ function validateRollback(options: FleetSyncOptions): void {
|
|
|
950
951
|
}
|
|
951
952
|
|
|
952
953
|
function validateOnly(options: FleetSyncOptions): void {
|
|
953
|
-
if (
|
|
954
|
-
|
|
955
|
-
|
|
954
|
+
if (
|
|
955
|
+
options.only !== undefined &&
|
|
956
|
+
!['accounts', 'legacy-monitoring'].includes(options.only)
|
|
957
|
+
)
|
|
958
|
+
throw new FleetUsageError(
|
|
959
|
+
'--only takes one scope: accounts or legacy-monitoring.'
|
|
960
|
+
);
|
|
961
|
+
if (
|
|
962
|
+
(options.only === 'accounts' && options.dryRun) ||
|
|
963
|
+
(options.only && options.schedule)
|
|
964
|
+
)
|
|
956
965
|
throw new FleetUsageError(
|
|
957
966
|
'--only accounts applies at once; it takes neither --dry-run nor --schedule.'
|
|
958
967
|
);
|
|
959
968
|
}
|
|
960
969
|
|
|
970
|
+
function onlyScope(
|
|
971
|
+
options: FleetSyncOptions,
|
|
972
|
+
settings: Settings,
|
|
973
|
+
run: Runner
|
|
974
|
+
): Promise<CommandOutcome> {
|
|
975
|
+
return options.only === 'legacy-monitoring'
|
|
976
|
+
? retireLegacyMonitoring(options, run)
|
|
977
|
+
: onlyAccounts(options, settings, run);
|
|
978
|
+
}
|
|
979
|
+
|
|
961
980
|
/** `--only accounts`: workers keep the revision they run; only their
|
|
962
981
|
* accounts change.
|
|
963
982
|
*/
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { PACKAGE_ROOT } from '../package-info';
|
|
3
|
+
import { runAnsible } from '../platform/ansible';
|
|
4
|
+
import type { Runner } from '../types';
|
|
5
|
+
import type { CommandOutcome } from './contracts';
|
|
6
|
+
|
|
7
|
+
/** A local migration with no enrollment, tool upgrade or service restart. */
|
|
8
|
+
export async function retireLegacyMonitoring(
|
|
9
|
+
options: { dryRun?: boolean },
|
|
10
|
+
run: Runner
|
|
11
|
+
): Promise<CommandOutcome> {
|
|
12
|
+
const result = await runAnsible(
|
|
13
|
+
run,
|
|
14
|
+
join(PACKAGE_ROOT, 'ansible/macos/legacy-monitoring.yml'),
|
|
15
|
+
{
|
|
16
|
+
input: '{}',
|
|
17
|
+
check: options.dryRun === true,
|
|
18
|
+
timeoutMs: 60_000,
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
const summary = result.ok
|
|
22
|
+
? options.dryRun
|
|
23
|
+
? 'Legacy monitoring retirement preview passed; no jobs changed.'
|
|
24
|
+
: 'Legacy monitoring retired; the replacement kept its running process.'
|
|
25
|
+
: 'Legacy monitoring retirement refused or failed. Inspect the migration playbook in check mode; the replacement must be running.';
|
|
26
|
+
return {
|
|
27
|
+
exitCode: result.ok ? 0 : 1,
|
|
28
|
+
data: {
|
|
29
|
+
version: 1,
|
|
30
|
+
ok: result.ok,
|
|
31
|
+
checks: [
|
|
32
|
+
{
|
|
33
|
+
id: 'manager:playbook',
|
|
34
|
+
status: result.ok ? 'pass' : 'fail',
|
|
35
|
+
summary,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
text: summary,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -284,7 +284,7 @@ function registerSync({ program, defaults, complete }: Registration) {
|
|
|
284
284
|
)
|
|
285
285
|
.option(
|
|
286
286
|
'--only <scope>',
|
|
287
|
-
'accounts:
|
|
287
|
+
'accounts: account configuration on every node; legacy-monitoring: retire only the replaced manager monitoring job (supports --dry-run)'
|
|
288
288
|
)
|
|
289
289
|
.action(async (_options, command: Command) => {
|
|
290
290
|
const options = command.optsWithGlobals<
|
package/src/manager-health.ts
CHANGED
|
@@ -494,7 +494,7 @@ export async function managerLegacyAgents(
|
|
|
494
494
|
summary: `MANAGER_LEGACY_AGENTS_REMAIN ${remaining.join(', ')}`,
|
|
495
495
|
remedy: {
|
|
496
496
|
action:
|
|
497
|
-
'Run converge to
|
|
497
|
+
'Run converge to retire replaced LaunchAgents. For monitoring only, preview with homelab converge --only legacy-monitoring --dry-run, then omit --dry-run; the replacement must remain running.',
|
|
498
498
|
},
|
|
499
499
|
}
|
|
500
500
|
: {
|
|
@@ -6,6 +6,7 @@ import ubuntuPolicy from '../ansible/ubuntu/policy.json';
|
|
|
6
6
|
import { workerReadiness } from './worker-readiness';
|
|
7
7
|
import { runAnsible } from './platform/ansible';
|
|
8
8
|
import { runAnsibleWithReceipt } from './platform/ansible-receipt';
|
|
9
|
+
import { ubuntuBaseline } from './platform/ubuntu-baseline';
|
|
9
10
|
import {
|
|
10
11
|
loadedT3Policy,
|
|
11
12
|
stageT3Policy,
|
|
@@ -247,12 +248,11 @@ async function applyBaseline(
|
|
|
247
248
|
const user = userInfo();
|
|
248
249
|
const features = workerFeatures(fleet, node);
|
|
249
250
|
const ubuntu = resolve(root, 'ansible/ubuntu');
|
|
250
|
-
|
|
251
|
+
return ubuntuBaseline(
|
|
251
252
|
run,
|
|
252
253
|
resolve(ubuntu, 'baseline.yml'),
|
|
253
254
|
{
|
|
254
255
|
cwd: ubuntu,
|
|
255
|
-
timeoutMs: 900_000,
|
|
256
256
|
input: JSON.stringify({
|
|
257
257
|
development_source: stablePath(root),
|
|
258
258
|
development_user: user.username,
|
|
@@ -285,21 +285,6 @@ async function applyBaseline(
|
|
|
285
285
|
),
|
|
286
286
|
}
|
|
287
287
|
);
|
|
288
|
-
return {
|
|
289
|
-
cached: result.cached,
|
|
290
|
-
checks: [
|
|
291
|
-
{
|
|
292
|
-
id: 'ubuntu:baseline',
|
|
293
|
-
status: result.ok ? 'pass' : 'fail',
|
|
294
|
-
summary: result.ok
|
|
295
|
-
? result.cached
|
|
296
|
-
? 'Ubuntu baseline unchanged since its last successful apply and its services are active (re-applied in full at least daily).'
|
|
297
|
-
: 'Ubuntu baseline tasks completed, including always-on service recovery; effective boot/session policies require separate verification.'
|
|
298
|
-
: 'UBUNTU_BASELINE_INCOMPLETE',
|
|
299
|
-
...(result.ok && result.cached ? { reused: 'receipt' as const } : {}),
|
|
300
|
-
},
|
|
301
|
-
],
|
|
302
|
-
};
|
|
303
288
|
}
|
|
304
289
|
|
|
305
290
|
/** Cheap probe for what the baseline owns: system services and user timers. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import policy from '../../ansible/ubuntu/policy.json';
|
|
2
|
+
import { userInfo } from 'node:os';
|
|
2
3
|
import { threshold } from '../worker-sizing';
|
|
3
4
|
import { diskGcReportCheck, readDiskGcReport } from '../disk-gc-report';
|
|
4
5
|
import type { Check, Runner } from '../types';
|
|
@@ -11,6 +12,8 @@ const GUARDS = {
|
|
|
11
12
|
'personal-fleet-disk-guard.service': 'DISK_GUARD_INACTIVE',
|
|
12
13
|
'personal-fleet-disk-gc.timer': 'DISK_GC_TIMER_MISSING',
|
|
13
14
|
};
|
|
15
|
+
const PRESSURE_POLICY_REMEDY =
|
|
16
|
+
'Run homelab converge to restore pressure policy for the worker user service and agent slices. The policy reload applies to active agents. Inspect user.control or system.control overrides if pressure killing remains enabled; retrying an agent does not repair the policy.';
|
|
14
17
|
const MIB = 1024 * 1024;
|
|
15
18
|
|
|
16
19
|
/** A failure code and remedy, or undefined when the probe passes. */
|
|
@@ -77,23 +80,52 @@ const diskGcRecent: Probe = async (run) => {
|
|
|
77
80
|
'DISK_GC_RUN_STALE',
|
|
78
81
|
'Inspect the disk GC service journal and run converge for this worker.',
|
|
79
82
|
];
|
|
83
|
+
const budget = await run([
|
|
84
|
+
'systemctl',
|
|
85
|
+
'show',
|
|
86
|
+
'--property=MemoryMax',
|
|
87
|
+
'--',
|
|
88
|
+
'personal-fleet-disk-gc.service',
|
|
89
|
+
]);
|
|
90
|
+
if (
|
|
91
|
+
!budget.ok ||
|
|
92
|
+
budget.stdout.trim() !==
|
|
93
|
+
`MemoryMax=${policy.resourceSafety.diskGcMemoryMaxMiB * MIB}`
|
|
94
|
+
)
|
|
95
|
+
return [
|
|
96
|
+
'DISK_GC_MEMORY_POLICY_STALE',
|
|
97
|
+
'Run homelab converge to restore the bounded Git maintenance memory budget. Inspect service drop-ins if the effective limit still differs.',
|
|
98
|
+
];
|
|
80
99
|
return undefined;
|
|
81
100
|
};
|
|
82
101
|
|
|
83
102
|
const memoryReserved: Probe = async (run) => {
|
|
84
103
|
const show = (property: string, unit: string) =>
|
|
85
104
|
run(['systemctl', 'show', `--property=${property}`, '--', unit]);
|
|
86
|
-
const user = await
|
|
87
|
-
|
|
105
|
+
const [user, root, service, memory] = await Promise.all([
|
|
106
|
+
show('MemoryMax', 'user.slice'),
|
|
107
|
+
show('ManagedOOMSwap', '-.slice'),
|
|
108
|
+
show('ManagedOOMMemoryPressure', `user@${userInfo().uid}.service`),
|
|
109
|
+
run(['cat', '/proc/meminfo']),
|
|
110
|
+
]);
|
|
111
|
+
const limit = Number(/^MemoryMax=(\d+)$/m.exec(user.stdout)?.[1]);
|
|
112
|
+
const physical =
|
|
113
|
+
Number(/^MemTotal:\s+(\d+) kB$/m.exec(memory.stdout)?.[1]) * 1024;
|
|
88
114
|
const ok =
|
|
89
|
-
|
|
115
|
+
user.ok &&
|
|
116
|
+
root.ok &&
|
|
117
|
+
memory.ok &&
|
|
118
|
+
limit > 0 &&
|
|
119
|
+
limit < physical &&
|
|
90
120
|
/^ManagedOOMSwap=kill$/m.test(root.stdout);
|
|
91
|
-
|
|
121
|
+
if (!ok)
|
|
122
|
+
return [
|
|
123
|
+
'MEMORY_RESERVE_MISSING',
|
|
124
|
+
'User workloads are not capped below physical memory, or swap exhaustion is unmanaged. Reapply converge.',
|
|
125
|
+
];
|
|
126
|
+
return service.ok && /^ManagedOOMMemoryPressure=auto$/m.test(service.stdout)
|
|
92
127
|
? undefined
|
|
93
|
-
: [
|
|
94
|
-
'MEMORY_RESERVE_MISSING',
|
|
95
|
-
'User workloads are not capped below physical memory, or swap exhaustion is unmanaged. Reapply converge.',
|
|
96
|
-
];
|
|
128
|
+
: ['AGENT_PRESSURE_KILL_ENABLED', PRESSURE_POLICY_REMEDY];
|
|
97
129
|
};
|
|
98
130
|
|
|
99
131
|
const agentsBounded: Probe = async (run) =>
|
|
@@ -111,7 +143,7 @@ const agentSliceBounded: Probe = async (run) => {
|
|
|
111
143
|
'--user',
|
|
112
144
|
'show',
|
|
113
145
|
'app-t3code-agents.slice',
|
|
114
|
-
'--property=LoadState,MemoryHigh,MemoryMax,MemorySwapMax,TasksMax,CPUWeight,IOWeight',
|
|
146
|
+
'--property=LoadState,MemoryHigh,MemoryMax,MemorySwapMax,TasksMax,CPUWeight,IOWeight,ManagedOOMMemoryPressure',
|
|
115
147
|
]),
|
|
116
148
|
run(['cat', '/proc/meminfo']),
|
|
117
149
|
]);
|
|
@@ -126,6 +158,24 @@ const agentSliceBounded: Probe = async (run) => {
|
|
|
126
158
|
'AGENT_SLICE_MISSING',
|
|
127
159
|
'Run converge and verify T3 uses app-t3code-agents.slice.',
|
|
128
160
|
];
|
|
161
|
+
const threads = await run([
|
|
162
|
+
'systemctl',
|
|
163
|
+
'--user',
|
|
164
|
+
'show',
|
|
165
|
+
'app-t3code-agents-*.slice',
|
|
166
|
+
'--property=ManagedOOMMemoryPressure',
|
|
167
|
+
'--value',
|
|
168
|
+
]);
|
|
169
|
+
if (
|
|
170
|
+
fields['ManagedOOMMemoryPressure'] !== 'auto' ||
|
|
171
|
+
!threads.ok ||
|
|
172
|
+
threads.stdout
|
|
173
|
+
.trim()
|
|
174
|
+
.split(/\s+/)
|
|
175
|
+
.filter(Boolean)
|
|
176
|
+
.some((mode) => mode !== 'auto')
|
|
177
|
+
)
|
|
178
|
+
return ['AGENT_PRESSURE_KILL_ENABLED', PRESSURE_POLICY_REMEDY];
|
|
129
179
|
const mib = Math.floor(
|
|
130
180
|
Number(/^MemTotal:\s+(\d+) kB$/m.exec(memory.stdout)?.[1]) / 1024
|
|
131
181
|
);
|
|
@@ -416,6 +466,25 @@ export function protectionWaitsForReboot(check: Check): boolean {
|
|
|
416
466
|
return check.id === 'worker:t3-protection' && check.status === 'warn';
|
|
417
467
|
}
|
|
418
468
|
|
|
469
|
+
async function oomdAgentKills(run: Runner): Promise<number | undefined> {
|
|
470
|
+
const oomd = await run([
|
|
471
|
+
'sudo',
|
|
472
|
+
'-n',
|
|
473
|
+
'journalctl',
|
|
474
|
+
'--quiet',
|
|
475
|
+
'--unit=systemd-oomd.service',
|
|
476
|
+
'--since=24 hours ago',
|
|
477
|
+
'--output=cat',
|
|
478
|
+
'--grep=Killed ',
|
|
479
|
+
]);
|
|
480
|
+
const oomdReadable =
|
|
481
|
+
oomd.ok || (oomd.reason === 'exit' && !oomd.stderr.trim());
|
|
482
|
+
const oomdKills = oomd.stdout
|
|
483
|
+
.split('\n')
|
|
484
|
+
.filter((line) => /Killed .*app-t3code-agents(?:[/.-])/.test(line)).length;
|
|
485
|
+
return oomdReadable ? oomdKills : undefined;
|
|
486
|
+
}
|
|
487
|
+
|
|
419
488
|
export async function pressureEvents(run: Runner): Promise<Check> {
|
|
420
489
|
const id = 'worker:pressure-events';
|
|
421
490
|
const events = await run([
|
|
@@ -436,6 +505,7 @@ export async function pressureEvents(run: Runner): Promise<Check> {
|
|
|
436
505
|
status: 'warn',
|
|
437
506
|
summary: 'Recent pressure guard activity could not be read.',
|
|
438
507
|
};
|
|
508
|
+
const oomdKills = await oomdAgentKills(run);
|
|
439
509
|
const { stops, dryRuns, unclassified } = pressureCounts(events.stdout);
|
|
440
510
|
const count = stops.cpu + stops.io + stops.memory + stops.unknown;
|
|
441
511
|
const active = await run([
|
|
@@ -443,19 +513,21 @@ export async function pressureEvents(run: Runner): Promise<Check> {
|
|
|
443
513
|
'-e',
|
|
444
514
|
'/run/personal-fleet-pressure-guard/active',
|
|
445
515
|
]);
|
|
446
|
-
const warn = Boolean(
|
|
516
|
+
const warn = Boolean(
|
|
517
|
+
count || unclassified || active.ok || oomdKills || oomdKills === undefined
|
|
518
|
+
);
|
|
447
519
|
const pressure = active.ok
|
|
448
520
|
? 'The guard currently reports sustained pressure.'
|
|
449
521
|
: 'The sustained-pressure marker is absent.';
|
|
450
522
|
return {
|
|
451
523
|
id,
|
|
452
524
|
status: warn ? 'warn' : 'pass',
|
|
453
|
-
summary: `In the last 24 hours the pressure guard stopped ${count} workloads (CPU: ${stops.cpu}, I/O: ${stops.io}, memory: ${stops.memory}, unknown cause: ${stops.unknown}). Dry runs: ${dryRuns}. Unclassified historical records: ${unclassified}. ${pressure}
|
|
525
|
+
summary: `In the last 24 hours the pressure guard stopped ${count} workloads (CPU: ${stops.cpu}, I/O: ${stops.io}, memory: ${stops.memory}, unknown cause: ${stops.unknown}). Dry runs: ${dryRuns}. Unclassified historical records: ${unclassified}. ${pressure} systemd-oomd agent kills: ${oomdKills ?? 'unavailable'}.`,
|
|
454
526
|
...(warn
|
|
455
527
|
? {
|
|
456
528
|
remedy: {
|
|
457
529
|
action:
|
|
458
|
-
'Inspect current CPU, I/O and memory stalls before changing capacity. The counts describe past interventions.',
|
|
530
|
+
'Inspect current CPU, I/O and memory stalls before changing capacity. The counts describe past interventions. For systemd-oomd kills, run homelab converge to migrate the slice policy, then inspect the systemd-oomd journal for ancestor or swap-exhaustion kills before retrying a session.',
|
|
459
531
|
command:
|
|
460
532
|
'cat /proc/pressure/cpu /proc/pressure/io /proc/pressure/memory',
|
|
461
533
|
},
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Check, CommandOptions, Runner } from '../types';
|
|
2
|
+
import { runAnsibleWithReceipt, type Receipt } from './ansible-receipt';
|
|
3
|
+
|
|
4
|
+
/** Cold snapshot indexes and packages can exceed fifteen minutes. Keep the
|
|
5
|
+
* installation bounded without cutting it off at the old cold-start deadline.
|
|
6
|
+
* Other playbooks retain their own budgets.
|
|
7
|
+
*/
|
|
8
|
+
export async function ubuntuBaseline(
|
|
9
|
+
run: Runner,
|
|
10
|
+
playbook: string,
|
|
11
|
+
options: CommandOptions & { input: string },
|
|
12
|
+
receipt: Receipt
|
|
13
|
+
): Promise<{ cached: boolean; checks: Check[] }> {
|
|
14
|
+
const result = await runAnsibleWithReceipt(
|
|
15
|
+
run,
|
|
16
|
+
playbook,
|
|
17
|
+
{ ...options, timeoutMs: 30 * 60_000 },
|
|
18
|
+
receipt
|
|
19
|
+
);
|
|
20
|
+
const summary = result.ok
|
|
21
|
+
? result.cached
|
|
22
|
+
? 'Ubuntu baseline unchanged since its last successful apply and its services are active (re-applied in full at least daily).'
|
|
23
|
+
: 'Ubuntu baseline tasks completed, including always-on service recovery; effective boot/session policies require separate verification.'
|
|
24
|
+
: result.reason === 'timeout'
|
|
25
|
+
? 'UBUNTU_BASELINE_TIMEOUT'
|
|
26
|
+
: 'UBUNTU_BASELINE_INCOMPLETE';
|
|
27
|
+
return {
|
|
28
|
+
cached: result.cached,
|
|
29
|
+
checks: [
|
|
30
|
+
{
|
|
31
|
+
id: 'ubuntu:baseline',
|
|
32
|
+
status: result.ok ? 'pass' : 'fail',
|
|
33
|
+
summary,
|
|
34
|
+
...(result.ok && result.cached ? { reused: 'receipt' as const } : {}),
|
|
35
|
+
...(result.reason === 'timeout'
|
|
36
|
+
? {
|
|
37
|
+
remedy: {
|
|
38
|
+
action:
|
|
39
|
+
'The Ubuntu baseline reached its bounded installation deadline. Check snapshot connectivity and package-manager activity, then run homelab converge.',
|
|
40
|
+
command: 'homelab converge',
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
: {}),
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
}
|