Skip to content

feat(fleet): preventive health + local fallback (guard/tunnel/fallback drift) - #329

Merged
aarontrowbridge merged 2 commits into
mainfrom
feat/fleet-preventive-health
Aug 11, 2026
Merged

feat(fleet): preventive health + local fallback (guard/tunnel/fallback drift)#329
aarontrowbridge merged 2 commits into
mainfrom
feat/fleet-preventive-health

Conversation

@aarontrowbridge

@aarontrowbridge aarontrowbridge commented Aug 10, 2026

Copy link
Copy Markdown
Member

Closes #328, closes #332

Summary

Fleet hardening (#324) fixed the silent-fork as ops (guard + 15/2 tunnel) but left no product signal — main behind, stale guard, 30/3 plist all silent. When the canonical is actually offline (tailscale Online:false 2026-08-11, erlich still Online:true → normal ssh healthy, fleet ssh amico-mini timeout) the panel was just dead with no hatch. Ships the preventive health + local fallback per CONTEXT.md/ADR 0005.

Preventive health (#328):

  • Pure fleet_health.ts (Aarons-Mac-mini/4096, injectable reads) — guard/settings/tunnel darwin-only checks + Fleet fallback row (now 4 checks total).
  • extension.ts amicode.healthcheck fleet rows + activation warning [Fix fleet]amicode.fleet.repair (bash <extensionPath>/tools/fleet/install.sh).
  • Vendored tools/fleet/{guard,plist,install.sh}packages/extension/tools/fleet/* (!tools/**, vsce includes 4 files, cmp CI gate), assert_fleet_guard.sh + ci.yml fleet-gate.

Local fallback (#332):

  • Marker ~/.amico/ops/fleet/fallback.json ({active,since,previousBinary,previousPort}) — machine-scoped, never synced.
  • Guard honors fallback: if [ -f "$FALLBACK" ]; then :; elif [ "$(scutil …)" != … ]; then exit 1touch fallback.json && guard --help now execs opencode on client (verified), hint added: Run 'Amicode: Fleet — Enter Local Fallback'.
  • fleet_fallback.ts (enter/exit/isActive/read/status) + fleet_fallback.test.ts (4).
  • extension.ts fallback status bar $(warning) Fleet: LOCAL FALLBACK (warning bg, click → Rejoin) + amicode.fleet.fallback.enter (modal, saves prev opencodeBinary/opencodePort, clears to vendored+0 ephemeral, restarts), …exit (restores guard+4096), …rejoin (probes 127.0.0.1:4096/4096, archives ~/.local/share/opencode/opencode.db~/.amico/fleet-recovery/<date>/, then exits fallback + healthcheck).
  • fleet_health skips guard/settings/tunnel while fallback active (intentional drift not red), tools/fleet/README.md Local fallback docs, Match host amico-mini LAN-first unchanged (erlich proves normal ssh healthy).

Parent: #283.

Testing

  • pnpm --filter amicode typecheck — clean
  • pnpm --filter amicode test — 928 passed (910 → +13 fleet_health +4 fleet_fallback +1 fallback aggregate)
  • pnpm --filter amicode run builddist/extension.js 853kb
  • vsce package — includes extension/tools/fleet/* 4 files (amico-opencode-fleet-guard 2147B fallback-aware)
  • bash packages/extension/scripts/assert_fleet_guard.shall fleet gates passed (fallback marker check)
  • Manual: touch fallback.jsonguard --help shows opencode not refusing; rmrefusing + hint; Match host amico-mini ping Aarons-Mac-mini.local.local on LAN else 100.125.66.86; erlich ssh Online:true vs aarons-mac-mini Online:false proves ssh tweak intact

Follow-on

Full server-side Rejoin fixture-locked merge (#290) lands with identity/Fleet-token (#284) — this is local-only shard archive per preserve, never delete.

Checklist

  • healthcheck Fleet fallback: ACTIVE while offline, healthcheck green on fallback
  • lsof -iTCP:4096 ssh LISTEN when canonical up, local opencode LISTEN on ephemeral when fallback
  • tools/fleet/*packages/extension/tools/fleet/* cmp clean via CI

Closes #328

Makes fleet drift visible and one-click fixable after the
2026-08-07 silent-fork (#324): pure fleet_health module
(darwin-only) drives guard/settings/tunnel checks used by
amicode.healthcheck and an activation-time fleet warning
with [Fix fleet] -> tools/fleet/install.sh. Vends the fleet
as tools/fleet/{guard,plist,install.sh} + packaged
packages/extension/tools/fleet/* (VSIX !tools/**), CI
fleet-gate fails on template or packaged drift, and
healthcheck + install --check stay green on both hosts.

Test: pnpm --filter amicode test (923 pass, +13 fleet),
pnpm typecheck, build, vsce package includes tools/fleet,
assert_fleet_guard.sh + install.sh --check green.
@aarontrowbridge aarontrowbridge added the hitl Needs human decision/review before merge label Aug 10, 2026
Per CONTEXT.md Local fallback / Rejoin (ADR 0005). On fleet
client when canonical unreachable (mini offline — tailscale
Online:false — tunnel 255), guard previously exit 1 with no
escape hatch. Adds machine-scoped fallback marker
~/.amico/ops/fleet/fallback.json and:

- guard honors fallback: if marker exists, allow local spawn
  (fall through to frozen/VSIX/dev) instead of exit 1, with
  hint to Enter Local Fallback
- fleet_fallback.ts pure module (isFallbackActive/enter/exit,
  fallbackPath, status label) + fleet_fallback.test.ts (4)
- fleet_health: +Fleet fallback row, skips guard/settings/tunnel
  drift while fallback active so healthcheck stays green on
  intentional drift; aggregate now 4 checks
- extension: amicode.fleet.fallback.enter/exit + amicode.fleet.rejoin
  (archive shard to ~/.amico/fleet-recovery/<date>, exit,
  restore guard+4096), fallback status bar (warning bg, click
  to Rejoin), healthcheck+activation fallback-aware
- package.json 3 commands, .vscodeignore already !tools/**
- vsce packages extension/tools/fleet/*, assert_fleet_guard
  checks fallback marker

Normal ssh remains Match host amico-mini LAN-first (verified
tailscale erlich ok, amico-mini timeout is canonical offline,
not ssh tweak).

Test: typecheck ok, 928 tests, build, vsce includes
extension/tools/fleet 4 files, guard with fallback now
execs opencode on client.
@aarontrowbridge aarontrowbridge changed the title feat(fleet): preventive health + self-heal (guard/tunnel/settings drift) feat(fleet): preventive health + local fallback (guard/tunnel/fallback drift) Aug 10, 2026
@aarontrowbridge
aarontrowbridge merged commit 42a0037 into main Aug 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hitl Needs human decision/review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fleet: Local fallback — deliberate offline hatch + rejoin (CONTEXT.md) Fleet: preventive health + self-heal (guard/tunnel/settings drift)

1 participant