Cook snapshot selection — issue 14668

Tracker: https://github.com/Extra-Chill/homeboy/issues/14668

Failure and root causes

Two Cook runs stopped before provider execution on 0.373.14+34d23d59b184f5f6d35039a8069de7f9d2d8b9dd:

  • agent-task-ace6961f-d630-4548-a6df-6a1833122953
  • agent-task-148cb356-0ebb-4220-9620-44c3a46634f6

Their admitted task workspaces were correct. However, agent_task_plan_extra_workspaces recursively searched the entire plan for absolute paths. metadata.cook_base_resolution.evidence_path named the component primary checkout, so that historical evidence became an extra transfer input. The primary contained unrelated nested worktree caches.

Snapshot staging then selected content twice: Rust’s content walker selected the manifest, while tar interpreted a translated set of exclusions independently. The source manifest contained nested cache logs which staging omitted. The integrity check correctly rejected the unequal trees before SSH transport.

Refactor

  1. Discover provider inputs only in each task’s executor.config. Task workspace roots and component contracts retain their existing explicit discovery paths. History, source references, and provenance are not provider configuration.
  2. Build an exact filesystem selection from the canonical content manifest and copy those entries into private staging. Remove tar exclusion translation and the shell-based link materialization pass. Tar only transports the completed stage, with no content-selection rules.
  3. Verify the actual staged content without applying exclusions again. Keep before/staged/after equality checks, explicit transport metadata handling, link behavior, and deadline checks between materialization operations.

Reproduce the regressions

From the repository root:

sh
CARGO_BUILD_JOBS=2 cargo test -p homeboy-lab-runner 
  agent_task_plan_stages_declared_inputs_without_historical_checkout_paths 
  --lib -- --nocapture --test-threads=1

CARGO_BUILD_JOBS=2 cargo test -p homeboy-lab-runner 
  snapshot_selection_preserves_nested_multi_component_paths 
  --lib -- --nocapture --test-threads=1

The first fixture creates a real linked task worktree, dirties its primary with unrelated cache files, and includes that primary in historical metadata. Before the discovery fix it returned two extra inputs (primary and provider), where only the declared provider was expected. With the fix it returns one and leaves the selected worktree clean.

The second fixture uses exclusion vendor/cache/_logs with source file other/vendor/cache/_logs/run.log. The canonical walker retains the nested path; the historical tar implementation removes it. On 34d23d59 the fixture fails with source and staged snapshot manifests differ, naming the missing _logs directory and run.log. The refactored materializer preserves the selected file and all three manifests agree. This is a minimal reproduction of the divergence class, not a claim that the original run’s complete effective policy was recovered.

Verification

sh
CARGO_BUILD_JOBS=2 cargo test -p homeboy-lab-runner 
  workspace::tests::snapshot:: --lib -- --test-threads=1
CARGO_BUILD_JOBS=2 cargo test -p homeboy-lab-runner 
  lab::offload::tests --lib -- --test-threads=1
CARGO_BUILD_JOBS=2 cargo test -p homeboy-lab-runner 
  lab_workspaces::tests::provider_config::agent_task_ --lib -- --test-threads=1
cargo fmt --check
git diff --check
CARGO_BUILD_JOBS=2 cargo build --bin homeboy

The snapshot and offload suites exercise actual filesystem staging, local runner workspace sync, Git snapshot materialization, replay, internal/external/dangling links, missing inputs, mutation rejection, and transport failures. The provider suite includes actual linked-worktree sync and execution of a fixture provider. These are controlled local-runner workflows; the two original remote DLA Cooks have not been rerun as part of this PR.

Broader provider-config testing found two failures also reproduced unchanged on the immutable base 1686b8180fa7ccad14f94c973d9a2565f80899bf:

  • path_setting_workspace_ref_missing_adopted_path_fails_locally
  • path_setting_workspace_ref_removed_record_is_not_resolvable

Reproduce that baseline with:

sh
CARGO_BUILD_JOBS=2 cargo test -p homeboy-lab-runner 
  path_setting_workspace_ref_ --lib -- --test-threads=1

Those workspace-lifecycle failures are outside the changed discovery and materialization paths. They remain visible here rather than being presented as a passing full-crate result.