# FR-SUPERVISOR-001 — Implementation evidence and remaining deployment blocker

## Result

Implemented independent deterministic Factory Supervisor and systemd deployment package. 69/69 Control Plane tests and 123/123 executor tests passed; real dispatcher/dummy A→B→C produced three artifacts. NOT DEPLOYED: this session cannot write systemd units or access its bus. LEAD-001.2 remains technical REVIEW after its original 3 attempts: Codex and DeepSeek DNS probes fail in this restricted session. Host deployment and live provider/E2E completion remain unverified.

## Implemented

- Independent deterministic Python loop (`control_plane/supervisor.py`), with no model calls or ChatGPT automation dependency for reconciliation.
- Reads explicit approvals, project/roadmap state, latest execution, full attempt history, owner events and durable diagnostic history.
- Distinguishes technical REVIEW from human checkpoints, validation failures, owner overrides and exhausted budgets. No business approvals, acceptances or scope are created.
- Considers Codex subscription CLI and workspace-compatible DeepSeek for stalled generic Antigravity/OpenRouter deliverables. Keeps specialized executors isolated. Diagnostics validate local availability and TLS reachability without model requests or credential disclosure.
- Revalidates snapshots under an immediate SQLite transaction before release. Preserves attempts, artifacts, results and workspace. Uses the normal dispatcher for execution/dependency advancement.
- Persists decision/reason/action, bounded exponential diagnostic backoff, heartbeat and last progress. Singleton flock prevents duplicate supervisors; service lock contention requests a systemd retry.
- Audits console owner status/result changes, including changes in the same second as a failure. Runtime uses the execution completion timestamp for a deterministic terminal-state link.
- Staged persistent systemd unit, restart/reboot configuration, installer and runbook. The installer loads console audit changes and starts the supervisor without restarting in-flight dispatcher workers.
- Approved executor delivery contract explicitly prohibits external outreach, Coral writes, paused L-IT changes and expansion of scope.

## Verification

| Check | Evidence | Outcome |
|---|---|---|
| Full Control Plane suite in production virtualenv | `data/artifacts/FACTORY-RUNTIME/supervisor/control-plane-tests.log` | 69/69 passed, including 16 supervisor tests |
| Full executor suite | `data/artifacts/FACTORY-RUNTIME/supervisor/executor-tests.log` | 123/123 passed |
| Final persistent/once lock contention regression | `data/artifacts/FACTORY-RUNTIME/supervisor/service-lock-test.log` | Passed |
| Actual LEAD-001.2 history replay | `control_plane/tests/fixtures/lead_001_2_review.json` and supervisor tests | Antigravity unavailable → two Nemotron connection failures → technical REVIEW → Codex attempt 4; history intact |
| Failure after supervisor release | Supervisor tests | Codex unavailable at attempt 4 → DeepSeek completion at attempt 5; error and output artifacts preserved |
| A→B→C plus human checkpoint | Supervisor tests | Real dispatcher/SQLite with stubbed provider outcomes; retry/fallback completed; human gate retained |
| Real local dispatcher execution | `data/artifacts/FACTORY-RUNTIME/supervisor/dispatcher-smoke.log` and `dispatcher-smoke-*/evidence.json` | Real dummy executor ran A, B, C in isolated DB; 3 concrete AI_FACTORY_MVP_OK output artifacts and 3 heartbeats |
| Static systemd unit validation | `data/artifacts/FACTORY-RUNTIME/supervisor/systemd-validation.json` | Exit 0; no diagnostics |
| Shell syntax and Python compilation | `sh -n` installer; `py_compile` changed modules | Passed |
| Live DB reconciliation and heartbeat | `live-verification.json`, `control-plane-evidence.json` | Held LEAD safely; heartbeat/diagnosis events persisted |
| Live service/reboot/provider E2E | `live-verification.json` | BLOCKED / NOT VERIFIED |

Provider successes in unit tests are controlled fixtures, not live Codex/DeepSeek completions. The real-dispatcher smoke is explicitly an isolated dummy test and is not lead-generation E2E.

## Precise live state and blockers

LEAD-001.2 is task 9, explicitly approved, checkpoint=0, status=REVIEW. Original executions remain unchanged:

- Execution 14 / attempt 1 / Antigravity: FAILED, EXECUTOR_UNAVAILABLE (local socket/filesystem startup restriction).
- Execution 15 / attempt 2 / Nemotron: FAILED, CONNECTION.
- Execution 16 / attempt 3 / Nemotron: FAILED, CONNECTION, OWNER_DECISION → REVIEW.

No fourth attempt was consumed by diagnostics. Codex login status indicates ChatGPT subscription authentication. Both chatgpt.com and api.deepseek.com TLS preflights failed during DNS resolution (`NETWORK_gaierror`) in this restricted session. This does not establish that the providers or the unrestricted IOVON host are down.

`/etc/systemd/system/ai-factory-supervisor.service` does not exist. `systemctl is-active` and `is-enabled` both fail with `Failed to connect to bus: Operation not permitted`. Session permissions allow writes only inside the Factory workspace and /tmp, and approval escalation is unavailable. Consequently the unit could be staged and statically checked, but could not be installed, enabled, started or verified live here. No attempt was made to bypass these restrictions.

## Remaining remedy and acceptance checks

1. From an authorized IOVON host shell, run `sudo sh /home/iovon/ai-factory/deploy/install-supervisor.sh`.
2. Verify the supervisor and existing dispatcher are active and the supervisor is enabled for reboot. Observe recurring SUPERVISOR_HEARTBEAT events from the service process.
3. Check executor reachability in that host/service context. If DNS/outbound TLS still fails there, restore it for chatgpt.com or api.deepseek.com; verify subscription login or existing private DeepSeek configuration without printing secrets.
4. Allow the next due supervisor pass to diagnose/release LEAD-001.2; do not clear history, invent approval or reset its attempt budget.
5. Observe a single SUPERVISOR_RECOVERY_RELEASED event, a real attempt 4/5, actual deliverable artifact, and approved downstream task advancement through the existing dispatcher. Preserve any genuine human checkpoint.
6. Observe service restart/reboot persistence on the host before calling reboot survival verified. Stop and report any remaining task/source/owner gate; do not report live E2E success based on READY state or synthetic tests.

LIT-CONSOLE (the L-IT Console project) is PAUSED and was not reconciled. No Coral writes or external outreach were performed. The supervisor task Result and evidence are recorded without setting its status to COMPLETED or ACCEPTED; live acceptance criteria remain unmet.

Source and evidence file checksums: `data/artifacts/FACTORY-RUNTIME/supervisor/manifest.json`.
