Files
OBLITERATUS/docs/distributed-shared-storage-plan.md
Joseph Magly 002e6e56e1 feat: complete local readiness across UI, MCP and memory admission
Integrate bounded admission, UI ownership and controls, opt-in durable MCP execution, rank-local TP2 groundwork, regression hardening and operator guides. Physical larger-memory and two-host qualification remain separate.
2026-10-20 17:58:20 -04:00

188 lines
13 KiB
Markdown

# Shared-filesystem candidate design review (#287)
Historical shared-backend review. The independently recommended alternative is
now implemented as the [rank-local evidence and coordinator export candidate](distributed-rank-local.md).
It eliminates the shared-backend selection dependency. This document continues
to describe only the unimplemented shared-filesystem option and its baseline.
Status: **design only, not implemented, not qualified**. This review applies to
the protocol at upstream `6e1fb7b7f2015634f3e233df5f6fe317ff0d7ae5`.
The live two-host preflight and export refusals remain in force. There is no
shared-filesystem selection field, environment override, or supported UI action.
The PROBE memory correction delivered with this review does not enable it.
## Feasibility decision
A shared-filesystem adapter can preserve the existing bounded TP2 tensor
protocol. It cannot safely be implemented as an exception to its topology
guards or as a stronger version of the existing staging-marker check. The
missing invariant is a **qualified, continuously bound shared namespace with
exclusive publication ownership and specified crash durability**.
The current implementation supplies none of the following together:
| Current boundary | Missing invariant |
|---|---|
| `preflight.storage_mount_digest` | A common backend identity. It hashes local mount text, including filesystem name, source and options. Separate local directories can have matching descriptions; different clients of the same backend can have different descriptions. |
| `preflight.run_preflight` | Storage agreement before ownership. `_prepare_attempt_directory` creates the attempt before the local storage observation and `_probe_shared_staging`. |
| `preflight._probe_shared_staging` | Fresh bidirectional visibility. Its coordinator-only payload is derived from run/rendezvous IDs, rather than independently generated fresh rank challenges. |
| `PreflightResult` / model-load bindings | A closed storage capability with backend qualification, per-rank mount/host bindings and lifetime ownership. A pathname and local mount digest cannot supply these. |
| `export._revalidate_storage` | Continuous directory identity. Rechecking a pathname before subsequent pathname operations leaves replacement races. |
| `persistence_contracts.atomic_checkpoint_directory` | Qualified cross-client exclusion and fencing. The POSIX checkpoint lock uses `flock`, whose cross-client behavior is backend dependent; promotion and rollback operate on paths. |
Successful `fsync`, rename, and nonce reads demonstrate operations during a
healthy run. They do not demonstrate persistence through server restart,
client loss, cache replay, or lease/failover changes. An operator boolean or an
opaque external-evidence digest would only assert that property. No reviewed
backend-specific durability qualification or authority that validates it is
present in the current exact protocol. Introducing a generic "POSIX shared"
mode would hide this trust decision.
The root/capability and publication changes below are software work, in
addition to physical testing. This checkout must not be reported as having
only E3/E4 remaining. A backend must first be selected and its identity,
durability and fencing contract reviewed. No filesystem is provisioned here.
## Reviewed implementation sequence
1. **Define one backend and the qualification trust boundary.** Add a closed
storage-profile type in a dedicated `distributed/storage.py`. Select one
concrete backend/client/server/mount configuration; reject unknown modes,
local filesystems, and unreviewed options. A qualified profile must bind
backend-observed filesystem/export identity, client and server versions,
mount/cache/locking options, cross-client exclusive creation, atomic
same-filesystem rename, durable file and directory sync, and recovery and
ownership/fencing behavior. Define who approves qualification and how the
loader authenticates that approval against a reviewed trust root. A caller
supplied digest, signature without a trusted key, or `accepted=true` is not
approval. Keep physical exact-profile status `not_qualified` until retained
evidence exists. The CPU test backend must be a separate explicit E0/E1
implementation unavailable to GPU candidate execution.
2. **Version explicit selection.** Add profile schema v3 with a required closed
storage section: mode, qualified-profile digest, expected shared backend
identity, expected rank/host mapping, and per-rank mount-observation
expectations. Preserve schema v1/v2 single-host behavior and default
two-host refusal. Unknown/missing fields and changed host/profile mappings
fail before storage access. Do not require equal client pathnames or local
mount IDs as the shared identity. Digest the complete validated selection,
and recompute live selection records rather than trusting a potentially
stale dataclass `digest` after replacement.
3. **Pin roots before opening an attempt.** After bounded Gloo layout/profile
consensus, traverse each absolute staging path component using directory
descriptors and no-follow opens. Validate ownership, access and backend
observations against the qualified profile. Retain the root descriptors
through teardown; record local directory identity and verify that the
configured path still names that root at stage boundaries. Backend identity
is agreed across ranks; local inode/device tuples are local replacement
guards, not cross-host proof. Source immutability remains a separate
requirement. Backend calls also need bounded worker supervision: a Python
alarm alone cannot bound an uninterruptible filesystem syscall.
4. **Prove live all-rank visibility before attempt ownership.** Use an isolated
probe namespace under the pinned root, distinct from the run attempt. Agree
fresh independent cryptographic rank nonces through bounded control records.
Every rank exclusively writes its own challenge with full-write checking,
file sync, atomic rename and parent sync. Every rank independently reopens
every published challenge and validates the exact nonce, profile, rank,
epoch and backend identity. Exchange bounded ordered observation digests
and require unanimous agreement. Exercise deletion visibility and sync as
well. Missing, stale, extra, truncated or symlink markers reject; an existing
probe/attempt is never adopted. Cleanup may delete only objects exclusively
created by this probe, via its pinned descriptors. A failed or timed-out
probe never creates an attempt or reads/writes attempt receipts. An abandoned
probe requires operator inspection or fresh identities, not automatic reuse.
5. **Acquire and retain fenced attempt/publication ownership.** Only after the
challenge and qualified semantics agree may the coordinator exclusively
create the attempt, sync its parent and publish an ownership record for all
ranks to validate. Bind ownership to the attempt epoch, control-group
membership, storage profile and pinned roots. Specify backend-enforced
exclusion/fencing for concurrent attempts targeting the same canonical
output, held through promotion/backup cleanup. Do not treat the existing
checkpoint lock as proof of qualified cross-client exclusion. Rank loss, expired fencing,
remount/failover drift, or uncertain sync quarantines the attempt. A lost
coordinator cannot be replaced within this attempt.
6. **Carry the capability through every evidence boundary.** Extend
`PreflightResult` with a non-serializable owned storage handle and a closed
digest-only agreed storage record. Version preflight identity/evidence and
model-load private/summary schemas together. Add explicit storage-profile,
qualification and capability bindings to exact-load validation; include the
agreed backend, per-rank mount/host mapping and qualification in hardware
identity. Bind runtime, source immutability, executable source, deployment
layout and both process groups as before. Distinguish stable reviewed
qualification identities from fresh attempt/nonce capability identities.
No old schema or archived evidence may implicitly grant the new capability.
7. **Make export consume the same owned root.** Add the storage capability to
`ExportRuntime`; reject hand-constructed two-host runtimes without it. Update
both live export entry votes and the direct export vote together. Version
export identity/summary/manifest schemas and bind storage profile,
qualification, fresh capability and publication ownership. Replace
pathname-based writer, metadata, reload, invalidation, promotion and cleanup
operations with operations relative to retained descriptors or an equally
strong backend-specific handle. Adapt trusted semantic reload so it reads
the pinned staged tree and cannot silently follow a replacement pathname.
Revalidate visibility and ownership before structural/semantic reload and
final commit. A different export sibling root needs its own qualified
capability; a preflight attempt marker does not authorize it.
8. **Retain export safety properties.** Keep lexical per-tensor assignments,
exactly one writer per tensor, bounded shard broadcasts, independent
semantic reload, source and live state revalidation, unanimous STAGED votes
and the final commit barrier. Add complete per-rank visibility/hash/index
checks for the shared candidate; current structural tree validation is
coordinator-owned, while semantic reload already runs on every rank.
Never gather all parameters at the coordinator. Promotion, backup handling
and parent sync must obey the reviewed backend contract. Lost confirmation
after possible promotion is uncertain/quarantined; pre-promotion failure
preserves prior output. Do not claim distributed commit can make a promoted
output disappear when a peer crashes before its PUBLISHED acknowledgement.
## Acceptance tests required before enabling selection
Run deterministic CPU contracts and spawned two-rank Gloo tests on the parent
CPU runner. Every test adapter and simulated host layout remains E0/E1.
| Test/fault | Required outcome |
|---|---|
| Same qualified synthetic root, fresh all-rank challenges | Closed capability acquired before attempt creation; load/export bind its exact digest. |
| Distinct local roots with matching path/mount descriptions | Refusal before ownership; matching descriptions never qualify. |
| Wrong profile, host mapping, backend identity or mount option | Symmetric pre-ownership refusal, including stale config digest after replacement. |
| Missing, stale/replayed, extra, malformed or partial marker | Refusal before ownership; no adoption or broad cleanup. |
| Rank loss or timeout in each probe phase | Bounded failure, no attempt receipts and no acquired ownership. |
| Symlink component, root rename/replacement or mount drift | Refusal at acquisition and at every subsequent storage boundary. |
| Failed/short write, file sync, rename, directory sync or deletion | No success capability; only owned probe artifacts may be cleaned. |
| Forged/stale/CPU capability passed to GPU load or export | Rejected by exact closed evidence and runtime bindings. |
| Concurrent attempts/exporters for the same output | Backend exclusion/fencing admits one owner; loser cannot promote or clean the winner. |
| Writer/validator failure, corruption or absent peer file | No commit; source and prior output preserved before promotion. |
| Crash after rename or failed promotion acknowledgement/sync | Quarantine with explicit uncertainty; never clean success or automatic retry. |
| Large model relative to coordinator budget | Per-tensor peak bound enforced, no full-model gather. |
| Legacy one-host profiles and omitted new selection | Existing one-host behavior; two-host GPU refusal still precedes any storage work. |
The hardware lane additionally needs backend server/client crash, restart,
cache/failover and fencing evidence, not only two GPU forwards. Bind the exact
signed source, runtime/image, model/source/tokenizer, storage configuration,
hardware and host mapping to retained E2/E3/E4 evidence. E3 requires two physical
hosts; E4 requires a workload beyond one qualified host's capacity. Simulated
host labels, same-host Gloo, and skipped hardware tests cannot satisfy either.
## Operator choice and tips
Today use ordinary complete-module placement on one host when the admitted
capacity plan fits; see [GPU qualification](gpu-qualification.md). Multiple
visible GPUs on that host do not select native TP or distributed execution.
If the plan does not fit, reduce the requested workload or choose an already
qualified host/profile. Do not relabel a local directory or add mount booleans
to a profile to bypass admission.
The future shared-filesystem mode must be explicitly selected using its
reviewed schema-v3 profile and exact storage qualification. Mount setup belongs
to the trusted scheduler/operator and precedes worker launch. Operators should
check the backend's observed identity/options on every host, retain the
qualification record, use fresh attempt identities after failures, and inspect
quarantined outputs after uncertain promotion. It must remain experimental
and absent from supported UI choices until physical approval is retained.