# Factory Account Directory Concurrency

audience: AI coding agents first.

status: IDLE
task IDs: #153
source request: Fix confirmed P1 in `modules/harness/factory/adw_modules/accounts.py:39-50`: same-account concurrent runs delete and recreate shared account directory while another Pi process reads `PI_CODING_AGENT_DIR`. Candidate ref: `7537194c`.

## Outcome

Each factory run/attempt owns immutable account-directory contents. Build complete contents before publication. Never delete path another live process can reference. Preserve requested/expected/observed account identity and account-scoped model validation. Cleanup removes only owning run directory.

## Acceptance criteria

- Same-account concurrent runs cannot invalidate either published account directory.
- Account identity fields and model validation behavior remain intact.
- Tests deterministically interleave two same-account runs and prove independent paths remain valid.
- Source/reference parity remains where preset subsystem requires it.
- Focused account/preset tests pass, then exactly one full Factory suite passes: `python3 -m pytest modules/harness/factory/tests/ -q`.
- Commit locally with terse imperative subject; record commit SHA.

## Preserved WIP

- Task registry prior description incorrectly associated #153 with JPR-06 retry validation; superseded by current owner request.
- Current candidate ref: `7537194c`.
- Worktree: `/home/user/Projects/overdeck/.worktrees/factory-presets-ship`.

## Constraints

- Touch only blocker-required files. Do not expand adjacent preset behavior.
- Do not delete any account path that another live process can reference.
- No deploy requested; local commit only.

## Execution steps

1. Inspect candidate implementation, account lifecycle, parity source, and existing account/preset tests.
2. Change path ownership/publication lifecycle with immutable per-run/attempt directory semantics.
3. Add deterministic concurrent same-account coverage.
4. Run focused account/preset tests.
5. Run full Factory suite once after focused tests pass.
6. Commit exact blocker files locally and update receipt.

## Current receipt

- Immutable per-materialization account paths compose in a private staging directory, then publish atomically.
- Pi catalog/model reads and live Pi child environments clean only their own directory after use.
- Deterministic same-account concurrent coverage proves distinct paths persist until their owner cleans them.
- Focused tests: `test_presets.py` 6 passed; `test_presets.py test_attempt_observability.py` 14 passed.
- Full Factory suite: `python3 -m pytest modules/harness/factory/tests/ -q` — 147 passed in 89.82s.
- Local commit created; final SHA recorded in handoff receipt.

## Next executable action

No active worker. Orchestrator may land this local commit when task #153 is scheduled.
