Skip to content

T03 — Add multi-directory project bindings

Depends on: T02. Status: planned.

Read ../README.md and ../PLAN.md first. Paths are discovery anchors, not permission to skip caller analysis.

Likely files

  • anvil_serving/workbench_app/config.py
  • anvil_serving/workbench_app/projects.py
  • anvil_serving/workbench_app/service.py
  • anvil_serving/workbench_app/pi_runner.py
  • anvil_serving/workbench_app/task_artifacts.py
  • tests/workbench/test_projects.py
  • tests/workbench/test_pi_runner.py

Implementation steps

Run one slice per agent turn, in order; earlier slices remain behind an unreleased feature boundary until the full packet passes. Use the shared receipt rules.

Slice Owned change Checkpoint before continuing
T03a config.py, project validation/migration Legacy fields/IDs preserved; exactly one primary; repeat migration no-op; contract independently reviewed
T03b Owner read adapters and service.py explorer routes Authorized bounded tree/text/diff/worktree reads; traversal, symlink, cross-project and timeout tests
T03c Existing single-root runner plus read-only context mounts Frozen roots/cwd; disposable tool-read/write and escape tests; legacy/task lease behavior preserved
T03d Canonical multi-root write contract in Anvil, read-only source discovery and disposable contract probe Reviewed contract for one task with a claimed root set; exact owner seams/tests and request/response/error fixtures; no assumed existing CLI flags
T03e Supported Anvil owner extension, only if T03d proves it is needed Same-repository conflict checks across project aliases, complete root-set claim/reconcile/release, lost-response and partial-acquisition tests; separate repository review
T03f Serving binding, isolated runner and evidence integration for multiple writable roots Every root uses its claimed baseline and private clone; any lost claim stops writes; per-root patch/verification/transfer tests; no false atomic transfer promise
T03g Project settings and public projection Explicit per-root write selection; primary/secondary selection reflects proven access; existing sessions stable; entire packet's browser acceptance

T03e may be recorded verified with a reviewed no-change receipt only when T03d proves the installed owner already satisfies every required contract. T03f must not start on a design-only assertion. See the concrete invariants in the guide.

  1. Adopt the project/root/thread/worktree contract in PLAN.md using existing identifiers and policy helpers. Define one primary, stable root IDs, owner runtime and access modes; migrate checkout-only config without changing project IDs.
  2. Implement bounded directory/text/diff/worktree reads through the selected owner. Reuse Pi Web facilities where they satisfy authorization; extend the owning service if they do not. UI visibility is not filesystem isolation.
  3. Bind actual session cwd and permitted roots, including managed sandbox mounts. Implement explicitly selected writable secondary roots via T03d–f; retain read-only defaults for unselected roots. Never pass a browser path directly to the runner.
  4. Expose selection of declared roots and primary designation in project settings. Validate deduplication, missing roots, non-Git roots and root changes while a session is active. Keep existing active bindings stable.

Host-mode roots are navigation/context only unless T02 proved tool confinement. Keep legacy sessions unassigned and owner-only until explicitly associated with verified declared roots; association changes no native session permissions/cwd.

Acceptance

  • [ ] A project with two directories has exactly one primary; a new thread starts there and can use its authorized secondary context.
  • [ ] Traversal (including encoded forms), symlink escape, CRLF, special/secret files, oversized reads and cross-project requests fail at the backend. Leading-dash/metacharacter filenames must either be safely handled as literal data or explicitly rejected; they must never become flags or commands. Test read/write distinctions through actual tool execution in a disposable scoped sandbox. Host mode must instead visibly disclose operator-account tool access and must not claim these restrictions.
  • [ ] Changing primary affects new threads without moving existing sessions or shared branches. A single-root legacy config behaves identically.
  • [ ] Explorer/worktree labels reflect the selected execution workspace, not a similarly named checkout.
  • [ ] An isolated task edits primary plus an explicitly selected writable secondary Git root, while an unselected secondary remains read-only. Conflicts/expired authority block the whole write session; patches, review digests and verification results identify each root. Partial acquisition/transfer failure remains recoverable and cannot report task completion.

Focused checks

Use the existing checkout Python environment and repository test wrapper. These are planned checks, not test results.

python scripts/run_tests.py tests/workbench/test_projects.py tests/workbench/test_pi_runner.py tests/workbench/test_task_sandbox.py tests/workbench/test_task_artifacts.py -x -q

Add behavioral regression coverage in the existing suite for new contracts; source-string assertions alone are insufficient. Run browser checks described above. Run broader checks only for changed shared seams or failures.

Stop boundary

Multi-root write authority is a required, independently reviewed T03d–f change; do not bypass it with extra mounts. Stop the affected slice if the canonical owner cannot enforce the contract; retain an explicit blocker rather than declaring the packet complete with read-only roots. Terminal authority is outside scope.

Completion receipt

Record commit/files, actual commands and results, browser observations, unresolved items, schema decisions and next eligible packet. Raw deployment evidence stays private. Do not change acceptance boxes without measured proof.

Engineering references

Read the implementation guide section and verified source map for this packet. tasks.json selects the relevant code/data examples and primary external references. Current APIs and proposed contracts are labeled separately; examples grant no live authority.