Skip to content

Wire disk-pressure self-heal into the Tentacle host lifecycle

Placeholder ppxd requested to merge feat/wire-disk-selfheal into main

Summary

  • The self-heal scaffolding (SelfHealController, DiskPressureHealAction, DefaultWorkspaceCleanupPolicy — all with tests) was built but never scheduled: TentacleFlavor returned BackgroundTasks = [], so a disk-full agent failed every deployment via LocalScriptService's admission gate with no auto-reclaim of completed-script workspaces (SOTA-audit P2 'wired-but-dead code').
  • New WorkspaceProbe: enumerates {tempRoot}/squid-tentacle-{ticketId} dirs and classifies each from its persisted ScriptState (Complete+0 → Succeeded, Complete+nonzero → Failed, started-not-complete → Active, none → Unknown) + recursive size + last-write.
  • New SelfHealBackgroundTask: adapts SelfHealController to the host ITentacleBackgroundTask lifecycle (start on launch, drain on shutdown); ForLocalWorkspaces builds the disk-pressure action over the temp root with the running script backend as the live-workspace veto (an in-flight deployment's workspace is never swept).
  • TentacleFlavor now schedules it. Reclaim happens only under disk pressure and only on completed/orphaned workspaces, keeping a per-status retention window for post-mortem.

Test plan

  • Unit: WorkspaceProbeTests (real temp dirs + real ScriptState files — status matrix, prefix filter, size, missing-root); SelfHealBackgroundTaskTests (RunAsync starts the loop + drains on cancel); TentacleFlavorSelfHealWiringTests (the flavor schedules a SelfHeal task — dead-code-is-live guard) — all green
  • Existing scaffolding tests (policy/action/controller) unchanged + green
  • Full solution builds clean; non-breaking (additive background task; veto protects running scripts)
  • Note: the real-script LocalScriptServiceTests can't run on the author's local machine (disk 98% full trips LocalScriptService's own admission gate — proven pre-existing by stashing this change); CI runs them on free disk

Merge request reports

Loading