agent hubFIELD GUIDE Get started

Documentation

Edge-case audit and recovery validation

This audit added original-state recovery and regression checks beyond ordinary sync/restore. The tests use isolated hubs and clients; production configurations were not reset.

Newly exercised cases

CaseExpected behavior / verification
Several syncs, including different clientsImmutable first checkpoint survives; one reset restores all recorded originals
Ordinary restore after a later syncRefuses a stale ownership state rather than guessing backup order
A newly created hub and Git directoryReset archives the complete generated hub and returns the active path to absence
Existing hub with private data and binary filesExact recorded tree fingerprint is restored; current tree remains archived
Client config originally absentCreated file is removed; newly created parent directories are removed only when empty
New user files in created directoriesKept in place; directory cleanup does not recurse through them
Client edited or chmodded after syncBlocks reset; explicit archive-changes preserves the current file before full-file restore
Client edit, mode change or new hub file after previewReviewed reset revision becomes stale and apply stops
Existing config symlinkTarget bytes/mode are restored and the original binding is retained
Repointed client symlinkBlocks even with archive-changes
External directory symlink inside hubPointer is preserved; arbitrary external contents are not followed or reverted
Corrupt baseline payloadIntegrity check stops before current data changes
Corrupt hub.yaml or deleted active hubRecovery uses the external baseline rather than current hub settings
Process SIGKILL after the first sync replacementIntent journal accepts partial before/after state; dead locks require explicit recovery
Process SIGKILL just after moving the active hub during resetRepeated reset can complete from the external baseline, for both existing and newly created hubs
Live or unrecognized lock ownerNever removed by automatic reset recovery
Reset installation rename failsPreviously changed clients and active hub are rolled back
Reset rollback also failsExplicit manual-review error; baseline and archive retained for another attempt
ENOSPC while capturing originalsStops before managed writes; incomplete baseline is not committed and retry remains recoverable
ENOSPC while archiving current clientsStops before client/hub reset writes
A newly selected DSH profileIts first-touch original is added without replacing earlier baseline records
Symlinked or foreign pre-existing recovery storageRejected without overwriting foreign data
Two clients resolve to one configuration fileBlocked during sync preview
Package/Node path changesMarked hub launchers are skipped during re-import, avoiding nested launchers
MCP name starts with a dashCopied replacement commands use equals-form option values and execute successfully
CLI reset outside the project cwdExact copied revision-guarded command works with overridden client locations

Important findings

The old restore command covered a single sync, not the original state across the whole history. A baseline external to the hub, immutable original payloads, a write-intent journal and the reset command now cover that use case.

Testing exposed canonical-path differences on macOS (/var versus /private/var), copying of readonly directories, ambiguous lock-owner handling and cleanup after a process dies after completing the data restoration. These cases are covered by regression tests.

No backup can reconstruct unknown historical state. On an existing installation with no baseline, reset reports that fact and does not create a misleading snapshot during dry run. The first later managed write establishes an explicitly labeled existing-hub checkpoint. Before a fresh hub is created, the baseline records the pre-creation state.

Still not established

See RECOVERY.md for the exact reset contract, flags and retained archives.

Validation result

The full quality gate passed with 86 tests. All 86 also passed on Node 22.13.0. Runtime coverage was 88.66% lines, 83.92% branches and 86.68% functions, above the configured thresholds. The package allowlist check passed. A real reset --dry-run correctly reported the absence of a historical baseline; hashes of all nine monitored working hub/client files and the recovery-directory inventory were unchanged.