diff --git a/docs/TODO.md b/docs/TODO.md new file mode 100644 index 0000000..5796b43 --- /dev/null +++ b/docs/TODO.md @@ -0,0 +1,49 @@ +# TORCH remaining work + +This is the restart checklist for `rewrite/portable-agent-fleet`. The detailed +state and evidence are in +`reports/audit/completion-audit-report-2026-09-27.md`. + +## Next safe implementation task + +- [ ] Repair the Codex adapter for `codex-cli 0.157.1`: + - do not combine `--sandbox workspace-write` with `--approve-for-me`; + - put repository, approval, and MCP options before `exec` when resuming; + - put resume-specific options after `exec resume`; + - retain the worktree as the subprocess working directory and explicit + command scope. +- [ ] Repair the Claude adapter for Claude Code `2.1.281`: + - do not supply or persist a synthetic `--session-id` with `--bg`; + - mark background creation as requiring runtime-ID capture; + - parse and validate the manager-assigned ID printed by Claude; + - retain ownership verification before any stop operation. +- [ ] Correct `SCN-claude-adapter`, `SCN-codex-adapter`, and + `SCN-mixed-runtime` with equally strict boundary assertions. Add the required + Test Integrity Note documenting this as a spec correction plus stronger + installed-contract coverage. +- [ ] Run focused adapter/lifecycle scenarios outside the sandbox where their + temporary Git worktrees require it, followed by `npm test`, `npm run lint`, + `npm run check`, and `git diff --check`. +- [ ] Refresh the completion audit with the new exact commit and evidence. + +## Owner-authorized qualification still required + +- [ ] Run a bounded Session Architect call and one live Claude/Codex + multi-domain coordination/resume scenario with a fixed provider budget. +- [ ] Install and reverse the user-systemd scheduler, verifying one real + dispatch and its receipts. +- [ ] Install an accepted TORCH version in user-local versioned state and use + its stable launcher to manage this source checkout. +- [ ] Resolve COMBATRIG's 56 ownership/exclusion blockers, then separately + authorize an import/cutover trial. Do not mutate COMBATRIG beforehand. +- [ ] Publish the package and deploy the public website only under explicit + release scope. + +## Preserved boundaries + +- Legacy branches remain `legacy/nostr-torch` and + `legacy/development-network-v2`. +- Do not add, edit, or remove the pre-existing untracked + `test-torch-config-host-uQKdqL/` fixture. +- Do not push, publish, deploy, install persistent services, consume provider + quota, or mutate COMBATRIG without renewed authorization. diff --git a/reports/audit/completion-audit-report-2026-09-27.md b/reports/audit/completion-audit-report-2026-09-27.md index 6a592af..6ddcd5e 100644 --- a/reports/audit/completion-audit-report-2026-09-27.md +++ b/reports/audit/completion-audit-report-2026-09-27.md @@ -3,29 +3,31 @@ Date: 2026-09-27 Branch: `rewrite/portable-agent-fleet` Audited specification: `docs/PORTABLE_AGENT_FLEET_SPEC.md` -Latest audited implementation commit: `218ce3f` +Latest audited repository commit: `2690d6e` ## Verdict TORCH has a coherent, scenario-tested local implementation of the portable kernel, project-specific fleet design, persistent provider-independent control -plane, Claude/Codex adapters, exact-commit verification, resources, native +plane, Claude/Codex adapter scaffolding, exact-commit verification, resources, native integration, safe convergence, schedules, context-locality telemetry, self-host candidate mechanics, COMBATRIG import, dynamic domain creation, retirement and boundary proposals, optional forge migration, a separately authorized delivery lifecycle, standalone package qualification, the public product surface, and the local Fleet Console. -It is not yet a qualified first usable release. The remaining release gates -are now owner-authorized operational qualification: +It is not yet a qualified first usable release. A 2026-09-27 installed-CLI +contract audit found launch-plan defects that must be repaired before any live +provider qualification. The remaining release gates are: -1. owner-authorized installation and live qualification of the implemented +1. repair and scenario-test the Claude/Codex launch, capture, and resume plans; +2. owner-authorized installation and live qualification of the implemented persistent user-systemd schedule launcher; -2. owner-authorized live Claude/Codex coordination and resume evidence; -3. an installed stable TORCH managing this source checkout; -4. owner resolution of COMBATRIG's 56 blocking ownership/exclusion gaps, +3. owner-authorized live Claude/Codex coordination and resume evidence; +4. an installed stable TORCH managing this source checkout; +5. owner resolution of COMBATRIG's 56 blocking ownership/exclusion gaps, followed by an authorized cutover trial; -5. package publication and public website deployment. +6. package publication and public website deployment. Passing local tests do not close any live/provider/install/deployment gate. @@ -35,6 +37,9 @@ Passing local tests do not close any live/provider/install/deployment gate. - `npm run lint`: **PASS**. - `npm run check`: **PASS**. - `git diff --check`: **PASS**. +- Focused fleet-evolution and lifecycle scenarios: **7/7 PASS** on the final + working tree, including manager proposal, owner approval, activation, + retirement, mixed-runtime planning, and durable resume behavior. - No live AI provider was called. - Headless Chromium rendered the public surface at desktop and iPhone 13 viewports. The refined mobile page had zero horizontal overflow; keyboard tab @@ -56,9 +61,9 @@ Passing local tests do not close any live/provider/install/deployment gate. | 0. Preserve and specify | Legacy branches `legacy/nostr-torch` and `legacy/development-network-v2`; rewrite branch; canonical spec and scenario inventory | Implemented locally | Owner product-boundary approval is represented by continuing this rewrite; no remote push was performed. | | 1. Portable kernel | `src/kernel/`; strict `torch.dev/v1alpha1` validation in `src/kernel/config.mjs`; install/doctor/uninstall/worktree scenarios; ignored tracked state is refused before mutation; ownership-safe overlays preserve unrelated pre-existing `.torch` history; ordinary uninstall safely winds down sessions and removes only unchanged manifest-owned launchers while preserving organization/history; confirmed purge validates local identity and refuses active or unowned state | Implemented locally | A future schema needs an actual migration transform; unknown versions currently fail closed with an explicit migration blocker. | | 2. Project decomposition | Repo/spec analysis, architecture graph, pending proposal, Session Architect brief and guarded Claude/Codex planner; one shared renderer gives initial and later-added domains the complete approved ownership, checks, authority, invariants, backlog, and first-move contract; `SCN-domain-collision`, `SCN-spec-fleet-design`, `SCN-ai-fleet-bootstrap`, `SCN-ai-fleet-planning`, `SCN-bootstrap-acceptance` | Implemented locally | Live runtime qualification remains in Stages 3 and 5. | -| 3. Claude reference fleet | Control plane, MCP, Claude adapter, identity/presence/messages, capture/down/resume; wind-down refusal for active work, Git operations, leases, checks/measurements, and landing; provider session plus managed-worktree ownership verification before stop; durable final worker status and tracked resume brief; virtualized lifecycle scenarios | Implemented virtually | Run a bounded live Claude multi-domain task and resume it with owner-approved provider quota. | +| 3. Claude reference fleet | Control plane, MCP, Claude adapter, identity/presence/messages, down/resume; wind-down refusal for active work, Git operations, leases, checks/measurements, and landing; provider session plus managed-worktree ownership verification before stop; durable final worker status and tracked resume brief; virtualized lifecycle scenarios | Adapter repair required | Remove the invalid preassigned `--session-id` assumption for `--bg`, capture Claude's manager-assigned background ID, strengthen the scenario, then run a bounded live Claude multi-domain task with owner-approved provider quota. | | 4. Verification and integration | Exact-SHA checks, FIFO resources, guarded convergence, integration queue, main protection, local bare canonical, reversible forge attachment, delivery-state separation, and read-only doctor evidence for drift count/age, Git operations, runtime availability, and recoverability; `SCN-exact-sha-checks`, `SCN-resource-fifo`, `SCN-safe-convergence`, `SCN-native-integration`, `SCN-local-canonical`, `SCN-forge-migration`, `SCN-delivery-lifecycle`, `SCN-bootstrap-acceptance`, `SCN-worktree-bootstrap` | Implemented locally | Real release/deployment adapters and live receipts remain release-scoped operational qualification. | -| 5. Runtime portability | Claude and Codex capability adapters, mixed plans, invocation-scoped identity-bound MCP on create/resume without global config mutation, MCP/CLI parity, runtime-ID capture and durable fallback; `SCN-mixed-runtime`, `SCN-mcp-stdio` | Implemented virtually | Run one live mixed Claude/Codex shared-boundary task. | +| 5. Runtime portability | Claude and Codex capability adapters, mixed plans, invocation-scoped identity-bound MCP intent, MCP/CLI parity, runtime-ID capture and durable fallback; `SCN-mixed-runtime`, `SCN-mcp-stdio` | Adapter repair required | Correct Codex option compatibility and resume ordering, correct Claude background-ID capture, add installed-contract scenarios, rerun all gates, then run one authorized live mixed-provider task. | | 6. Self-hosting | Clean-commit bounded candidate staging, exclusion of arbitrary untracked files, internal dependency-link validation, mode-aware tree hashing, acceptance receipts, side-by-side versions, conflict-safe stable launcher, atomic activation/reconciliation/rollback; self-host scenarios plus an isolated real-checkout build/activation of `6740f33` | Mechanics implemented and temporarily qualified | Install a stable TORCH in the user location and use it to manage/test/promote a later candidate of this checkout. Persistent installation approval required. | | 7. COMBATRIG re-import | Read-only portable importer and report preserving 33 areas, 570 backlog records, checks/resources/schedules/release boundaries | Analysis implemented; cutover blocked | Owner must resolve 56 scope/exclusion gaps across all 33 areas, then authorize install/operation. | | 8. Product surface | Redesigned site and dispatch-board story; installed-launcher onboarding; responsive qualification ledger; keyboard-operable command tabs; local read-only Console covering ownership graph, worktree drift, recoverability, acknowledgements, checks, integration, delivery, resources, schedules, decisions, provider health, and context evidence; desktop/mobile Chromium rendering with zero mobile overflow and exercised interactions; `SCN-package-distribution` packs and installs the CLI offline in an isolated consumer | Local surface and standalone artifact implemented and visually qualified | Registry publication and public deployment remain open. | @@ -144,25 +149,61 @@ successful receipt. New installations use `none` for both provider slots. The complete lifecycle is fixture-tested through the public CLI/service boundary; no real artifact was published and nothing was deployed. +## Installed runtime CLI contract audit + +Read-only/local parser probes were run against `codex-cli 0.157.1` and Claude +Code `2.1.281`. No model turn completed and no provider result was requested. +The audit changed the next engineering action: + +- Codex accepts `--approve-for-me`, and that option already selects the + workspace-write sandbox. Combining it with `--sandbox workspace-write`, as + the current create/resume plans do, is rejected as mutually exclusive. +- `codex exec resume` does not accept `--cd`, `--sandbox`, or + `--approve-for-me` after the `resume` subcommand. Repository, safety, and MCP + options must precede `exec`; resume-specific options follow `resume`. +- A parser-only probe confirmed that + `codex --cd --approve-for-me exec resume --json ...` + reaches repository trust validation, while the current ordering fails during + argument parsing. +- Claude supports `--append-system-prompt-file`, `--bg`, `agents --json`, and + `stop `. However, Claude explicitly warns that `--bg` manages the + session ID and ignores `--session-id`. The current adapter preassigns and + records that ignored UUID instead of capturing the background ID printed by + Claude. +- A sandboxed Claude background-manager startup probe failed before a session + launched because it could not bind its local control socket. This is not live + provider qualification and did not justify retrying outside the sandbox. + +The existing virtualized adapter tests mirror the incorrect argument plans, so +their green result is not sufficient evidence. Correct behavior requires a +strict test correction: assert parse-compatible command shape and +manager-assigned runtime-ID capture rather than the obsolete synthetic UUID +behavior. + ## Approval-bound qualification plan These actions are deliberately not performed by the local build: -1. **Provider quota:** run one bounded Session Architect call, then a small live +1. **Local adapter repair (no quota):** correct the installed CLI contracts and + pass focused plus full scenario gates before attempting any provider call. +2. **Provider quota:** run one bounded Session Architect call, then a small live Claude/Codex fleet task with a fixed budget and no deployment authority. -2. **Persistent installation:** install the current accepted TORCH version +3. **Persistent installation:** install the current accepted TORCH version under user-local versioned state and let it manage this repository from outside the source tree. -3. **COMBATRIG mutation:** review the generated ownership gaps before creating +4. **COMBATRIG mutation:** review the generated ownership gaps before creating any `.torch` state or worktrees there. -4. **System scheduler:** install/enable the implemented user service/timer only +5. **System scheduler:** install/enable the implemented user service/timer only with explicit approval, then verify its first real dispatch and reversal. -5. **Remote/public state:** push branches, publish a package, or deploy the site +6. **Remote/public state:** push branches, publish a package, or deploy the site only under explicit release scope. ## Next qualification order -1. owner-authorized bounded Session Architect and live mixed-provider run; -2. owner-authorized stable self-host and system-scheduler qualification; -3. owner review of COMBATRIG gaps and a separately authorized cutover trial; -4. release-scoped package publication and public website deployment. +1. repair the Claude/Codex plans and add strict installed-contract scenarios; +2. rerun focused adapter/lifecycle tests, then the complete test/lint/check and + diff gates; +3. owner-authorized bounded Session Architect and live mixed-provider run; +4. owner-authorized stable self-host and system-scheduler qualification; +5. owner review of COMBATRIG gaps and a separately authorized cutover trial; +6. release-scoped package publication and public website deployment.