Skip to content

feat(cli): add vfs seed for portable dirty-base capture - #6

Merged
factory-ain3sh merged 5 commits into
mainfrom
seed-verb
Jul 28, 2026
Merged

feat(cli): add vfs seed for portable dirty-base capture#6
factory-ain3sh merged 5 commits into
mainfrom
seed-verb

Conversation

@factory-ain3sh

@factory-ain3sh factory-ain3sh commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Description

What

Adds vfs seed <session-id> --pin <commit>: captures a run session's live git state (dirty and untracked files, deletions, local commits, index) into its portable delta without mounting. vfs run --session <id> --seed-pin <commit> is the atomic startup form.

Why

A session created on a dirty checkout only sees that dirty state through overlay base read-through, which does not travel. Without seed, a receiver materializing the packed delta over a pristine checkout at the pin would silently lose the sender's uncommitted work. Capture-by-construction from birth is the design; seed extends it to bases that were already dirty at session start.

How

Seed diffs the base checkout against --pin and imports through the core bulk-import API (no FUSE/NFS mount):

  • Dirty and untracked files import as delta content; paths deleted since the pin become whiteouts. Ignored files stay base-local (git status --untracked-files=all).
  • Local-only commits ship as a compact git pack plus HEAD and the current branch ref under delta .git/ paths; the sender's index bytes come along, preserving staged-vs-unstaged state.
  • Writes go to a private staging database, published only after import, whiteouts, metadata, and finalization all succeed; a failed seed leaves the live delta retryable.
  • Birth-time only: a second seed fails with session already seeded; a live session fails with the same exit-3 gate as pack.

Stack (merged bottom-up 2026-07-28, vfs main @ 3b2af42):

  1. refactor: rename agentfs to vfs across runtime, tooling, and docs #4 rename agentfs to vfs
  2. feat(cli): add vfs pack for atomic session transfer artifacts #5 vfs pack
  3. feat(cli): add vfs seed for portable dirty-base capture #6 vfs seed <- this PR
  4. feat(cli): harden resumable run sessions and add status preflight #7 run hardening + status

Related Issue

Part of AC-768

Reviewer Guide

Diff shape: ~80% cmd/seed.rs, ~10% run/ integration (--seed-pin lock choreography), ~10% core overlay/session support.
Review depth: Deep on the git-state capture matrix; the correctness question is "which sender states round-trip".
Read order:

  1. crates/vfs-cli/src/cmd/seed.rs — status enumeration, bulk import, whiteout recording, git pack + index capture, staging publish
  2. crates/vfs-cli/src/cmd/run/linux.rs + darwin.rs — exclusive-create-then-downgrade-to-shared lock ordering for --seed-pin
  3. crates/vfs-core/src/fs/overlay/mod.rs — whiteout API surface seed relies on
  4. docs/MANUAL.md — the portable-state contract (ignored files excluded, index revalidation semantics)

Open for pushback: copying raw index bytes rather than regenerating the index on the receiver. Git revalidates cached stat fields against the pristine checkout at the pin, so stale stats self-heal, but it is the least obvious part of the contract.

Risk & Impact

Seed writes into the session delta, so a capture bug corrupts portable state at birth; the staging-then-publish structure bounds that to "seed failed, retry" rather than a half-seeded live delta. The exclusion of ignored files is deliberate scope (build outputs and caches stay base-local) and is documented as the portable-state boundary.

Verification

Behavior verified. Dirty file, untracked file, deleted-since-pin, staged-vs-unstaged, and local-commit states round-trip to a receiver materialization over a pristine pin checkout; second seed and live-session seed fail with the documented errors (verified @ 10507f1).
Regression coverage. CLI suite exercises the seed state matrix and the exit-code gates; core tests pin whiteout semantics.
Not tested. Submodule-containing worktrees; out of scope for the MVP contract and rejected by the state enumeration rather than mishandled.
Standard validators. cargo build/test and CLI shell suites clean.

Capture dirty worktree and local commit state before mounting so pinned sessions retain the sender's merged view across machines.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Base automatically changed from pack-verb to main July 28, 2026 02:32
@factory-ain3sh
factory-ain3sh merged commit 4ae1541 into main Jul 28, 2026
16 checks passed
@factory-ain3sh
factory-ain3sh deleted the seed-verb branch July 28, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant