# Factory presets

audience: AI coding agents first.

## Outcome

Ship task #53: named factory seat/model presets, optional account selection, truthful trace/UI visibility, tests, local commit.

## Status

IDLE. Worker: none. Task IDs: owner #53; local #147; review follow-up #152. Local fix committed.

## Source request

Finish task #53 in `/home/user/Projects/overdeck/.worktrees/factory-presets-ship`, follow `docs/specs/2026-08-09-factory-presets-design.md`, start from commit `117f0961`, integrate current `origin/main`, change task-owned files only, run focused acceptance, commit locally.

Review correction #152: `agents.execute` builds `PiRequest` without `account=run.cfg.account`; all ADWs resolve/materialize `--account` or preset account, but Pi runs and reports machine-wide account. Thread `run.cfg.account` into `PiRequest`; validate each configured model against `cfg.account`; add regression coverage; run factory suite; amend or create local task-only commit.

## Acceptance

1. Presets `fast` and `deep`; seat overlays preserve whole base roster; unknown preset/seat fails closed.
2. Account composition sets child-only `PI_CODING_AGENT_DIR`, preserves every non-auth source entry, never mutates global auth, unknown account fails closed.
3. Trace stores `sessions.preset`; collector and FactoryRunCard show it with existing UI components.
4. Full factory pytest passes; CLI preset listing and unknown-preset no-session behavior pass; real `fast` run records provenance and session preset; collector/web checks pass when touched.
5. Current `origin/main` integrated; commit contains task-only files.
6. `PiRequest.account` receives resolved `run.cfg.account`; model preflight calls `agent_pi.resolve_model(..., cfg.account)`, so validation and child launch use one isolated account source.

## Preserved WIP

Worktree: `/home/user/Projects/overdeck/.worktrees/factory-presets-ship`. Baseline implementation commit: `117f0961`. No unrelated files may be changed.

## Constraints

Follow repo and harness instructions. Factory changes require full factory suite. UI changes require `od-ui-dev` before implementation. Install-before-landing applies to factory local infrastructure; task scopes only local commit, so record live-install blocker if no deployment scope exists. Never mutate PI auth or systray account files.

## Execution

1. Inspect `117f0961`, changed files, tests, and current `origin/main` delta.
2. Integrate `origin/main`; resolve only task-owned conflicts.
3. Audit implementation against spec; minimally repair omissions.
4. Run required focused acceptance; address all signals.
5. Update receipt, commit task-only changes locally.

## Current receipt

2026-08-10: Local integration committed. Merged current `origin/main`, preserved task-owned preset/account behavior, repaired prompt/document entrypoint parameter threading, added preset/account coverage, and made `preset` backward-compatible for older collector payloads. Acceptance: preset tests 4 passed; full factory suite 144 passed; `factory presets` listed fast/deep; unknown preset exited 1 with no database created; collector `bun test` passed; web typecheck/build passed with zero diagnostics. Commit hook emitted pre-existing slopgate environment notices: PATH binary versions unpinned and jscpd unavailable/fail-open; no task code bypasses a checker. Git staging also fell back to `C` because host `en_US.UTF-8` locale is unavailable; subsequent Git verification uses scoped `LC_ALL=C`. Prior scope explicitly ends at local commit; deployed source needs the landing/deployment owner.

2026-08-10: Review correction #152 completed. `agents.validate` now resolves every model through `cfg.account`; `agents.execute` puts `run.cfg.account` into every `PiRequest`, including parse and gate retries. Regression coverage verifies account-scoped preflight and request propagation. Acceptance: focused preset/agent retry tests 9 passed; full factory suite 146 passed. Local task commit created.

## Next executable action

Land/deploy the local review-fix commit with prior task #53 commits through the orchestrator, then verify the installed factory entrypoint uses the selected account.
