M06: Codex adapter: CLI/App Server with Desktop and VS Code installations #91

Closed
opened 2026-09-19 13:07:36 +00:00 by kilo · 1 comment
Member

Goal

Support users who have Codex through CLI, VS Code, or Codex Desktop — without automating the GUI and without falsely claiming OpenAI compatibility.

Module of the execution-gateway program; architecture and contracts come from A0 (#85).

User value

Subscription-included Codex capacity — where owner/instance policy allows unattended execution (cf. D-039's eligibility contract, issue #82) — becomes executable through the router from any OpenAI-compatible client.

Relationship to current code

  • Builds directly on the existing Codex capacity collector (providers/openai_codex*.py), the D-018 bounded auth-recovery exception, U-001 discovery evidence and the D-039 eligibility parser (providers/openai_eligibility.py, eligibility.py).
  • Execution runs through the worker (M05) or the server where the app-server is reachable; discovery knowledge is reused, not duplicated.

Two-stage approach (within this issue)

  1. Stage 1 — short technical verification. No Forgejo dependency on A0/M05; this evidence may start immediately and feeds A0. Verify: runtime discovery; authentication; Desktop-only installation; CLI installation; VS Code integration; Windows versus WSL profiles; model selection; reasoning/effort selection; quota scope; conversation roles/history; streaming; cancellation; isolation; tool-call behavior; structured output; usage reporting; stable versus experimental App Server protocol fields.
  2. Stage 2 — implementation of the verified supported subset. Depends on A0 (#85) and M05 (Forgejo dependency edges). Prefer official Codex App Server / CLI mechanisms. Reuse knowledge and code from the existing Codex capacity collector where appropriate.

Non-goals

  • No GUI automation; no credential/token extraction shortcuts where an official remediation step exists; no adoption of unrelated conversations, global plugins or user projects by default; no promotional-eligibility assumptions.

Contracts / interfaces affected

Execution adapter contract (A0); OpenAI compatibility matrix (M03); D-018 recovery boundary (unchanged); worker dispatch (M05).

Dependencies

  • Stage 1: none (independent evidence track).
  • Stage 2 (Forgejo dependency): A0 (#85), M05.
  • Feeds: M10 (Windows/WSL scenarios).

Acceptance criteria

  • Separate documented scenarios for Desktop-only Codex, CLI, VS Code, Windows and WSL.
  • If a required official component is missing, a clear installation/remediation step is provided — never manual extraction/copying of authentication tokens.
  • OpenAI compatibility is never inferred merely because the model produced text; the matrix (M03) records PASS/PARTIAL/UNSUPPORTED/UNKNOWN with tested version and evidence.
  • Promotional eligibility is never inferred merely because execution succeeded.
  • If required isolation cannot be provided, only the affected adapter/mode is marked ineligible — the rest of the router keeps working.
  • Full validation gate green; redacted fixtures only.

Security considerations

The default CLI-backed execution mode must not automatically receive access to user projects, arbitrary filesystem paths, shell, global MCP configuration, plugins, browser integrations or unrelated conversation history. A read-only sandbox alone is not necessarily proof of sufficient isolation. Credentials stay provider-managed (the D-018 boundary is unchanged: Scarcity Router never receives, reads, stores or exposes tokens). No root execution; no uncontrolled subprocess flags/environment variables.

Risks

  • The app-server protocol is not a stable public API — mitigated by generation-aware parsing (the D-019/U-011 pattern) and safe disable on contract change.

Evidence still required

## Goal Support users who have Codex through CLI, VS Code, or Codex Desktop — without automating the GUI and without falsely claiming OpenAI compatibility. Module of the execution-gateway program; architecture and contracts come from A0 (#85). ## User value Subscription-included Codex capacity — where owner/instance policy allows unattended execution (cf. D-039's eligibility contract, issue #82) — becomes executable through the router from any OpenAI-compatible client. ## Relationship to current code - Builds directly on the existing Codex capacity collector (`providers/openai_codex*.py`), the D-018 bounded auth-recovery exception, U-001 discovery evidence and the D-039 eligibility parser (`providers/openai_eligibility.py`, `eligibility.py`). - Execution runs through the worker (M05) or the server where the app-server is reachable; discovery knowledge is reused, not duplicated. ## Two-stage approach (within this issue) 1. **Stage 1 — short technical verification.** No Forgejo dependency on A0/M05; this evidence may start immediately and feeds A0. Verify: runtime discovery; authentication; Desktop-only installation; CLI installation; VS Code integration; Windows versus WSL profiles; model selection; reasoning/effort selection; quota scope; conversation roles/history; streaming; cancellation; isolation; tool-call behavior; structured output; usage reporting; stable versus experimental App Server protocol fields. 2. **Stage 2 — implementation of the verified supported subset.** Depends on A0 (#85) and M05 (Forgejo dependency edges). Prefer official Codex App Server / CLI mechanisms. Reuse knowledge and code from the existing Codex capacity collector where appropriate. ## Non-goals - No GUI automation; no credential/token extraction shortcuts where an official remediation step exists; no adoption of unrelated conversations, global plugins or user projects by default; no promotional-eligibility assumptions. ## Contracts / interfaces affected Execution adapter contract (A0); OpenAI compatibility matrix (M03); D-018 recovery boundary (unchanged); worker dispatch (M05). ## Dependencies - Stage 1: none (independent evidence track). - Stage 2 (Forgejo dependency): A0 (#85), M05. - Feeds: M10 (Windows/WSL scenarios). ## Acceptance criteria - [ ] Separate documented scenarios for Desktop-only Codex, CLI, VS Code, Windows and WSL. - [ ] If a required official component is missing, a clear installation/remediation step is provided — never manual extraction/copying of authentication tokens. - [ ] OpenAI compatibility is never inferred merely because the model produced text; the matrix (M03) records PASS/PARTIAL/UNSUPPORTED/UNKNOWN with tested version and evidence. - [ ] Promotional eligibility is never inferred merely because execution succeeded. - [ ] If required isolation cannot be provided, only the affected adapter/mode is marked ineligible — the rest of the router keeps working. - [ ] Full validation gate green; redacted fixtures only. ## Security considerations The default CLI-backed execution mode must not automatically receive access to user projects, arbitrary filesystem paths, shell, global MCP configuration, plugins, browser integrations or unrelated conversation history. A read-only sandbox alone is not necessarily proof of sufficient isolation. Credentials stay provider-managed (the D-018 boundary is unchanged: Scarcity Router never receives, reads, stores or exposes tokens). No root execution; no uncontrolled subprocess flags/environment variables. ## Risks - The app-server protocol is not a stable public API — mitigated by generation-aware parsing (the D-019/U-011 pattern) and safe disable on contract change. ## Evidence still required - Official documentation, re-verified with date and tested version at implementation time: https://developers.openai.com/codex/app-server and https://developers.openai.com/codex/auth; local capability probes preferred; only credentials authorized for this work may be used.
Author
Member

Closeout (v0.1.0 release-readiness reconciliation, 2026-09-21). M06 Stage 1 (feasibility evidence) and Stage 2 (implementation) are complete; the recorded live-acceptance gate is preserved explicitly below rather than treated as unfinished implementation.

  • Stage 1: docs/codex-adapter-stage1-evidence.md (dated runtime/protocol/isolation evidence). Stage 2: the Codex worker-local adapter (worker_codex_adapter.py, allowlist id codex, delivered through the M05 worker_bridged channel per D-049) with reviewed evidence cells (codex_worker_evidence.py, dated 2026-09-20, adapter codex-worker-local 1.0.0, tested against codex-cli 0.154.0-alpha.6.2).
  • Acceptance criteria, with evidence: separate documented scenarios for CLI/VS Code/Desktop installations and Windows-vs-WSL profiles (Stage-1 doc; Windows-native Codex remains honestly platform_not_evidenced); missing official components produce a remediation step, never token extraction (controlled CODEX_HOME adoption; the real-binary probe shows the unsigned-in home fails CLOSED with auth_unverified); compatibility is recorded as a dated PASS/PARTIAL/UNSUPPORTED/UNKNOWN matrix (streaming PARTIAL, tools UNSUPPORTED), never inferred from text output; promotional eligibility is never inferred from execution success; a runtime contract change disables the adapter fail-closed (generation-aware parsing, D-019 pattern); isolation is end-to-end verified (controlled home 0o700, generated config without mcp_servers, scratch cwd, workspaceWrite + networkAccess: false + approvalPolicy: never, minimal child env, no user MCP/plugins/apps/connectors inheritance — tests/test_e2e_codex_acceptance.py::CodexStreamingExecutionTests::test_isolation_profile_end_to_end).
  • Deterministic acceptance: 24 e2e tests through the FULL composed stack (OpenAI-compatible client → server → real worker protocol → CodexLocalAdapter → fake App Server): physical model identity with the SHIPPED catalog (--codex-model, gpt-5.6-sol), exact effort binding, structured output, pre-dispatch tool rejection, streaming and non-streaming, cancellation, usage honesty, mid-execution worker loss = ambiguous and never retried, resource→worker ownership, multiple Codex resources, leakage/audit asserts. All green in the 1868-test gate.
  • Preserved external gate (not unfinished implementation): EXTERNAL_ACCEPTANCE_GATE: LIVE_CODEX_SUBSCRIPTION — one live turn-level execution against a provider-managed login in a dedicated controlled CODEX_HOME requires an interactive official codex login by the owner; manual token extraction is forbidden by this issue's own acceptance criteria. Exact owner action and the deterministic evidence already complete are recorded in docs/m10-acceptance.md ("External gate").

Closing as complete subject to the recorded gate; docs/roadmap.md now records M06 accordingly.

**Closeout (v0.1.0 release-readiness reconciliation, 2026-09-21).** M06 Stage 1 (feasibility evidence) and Stage 2 (implementation) are complete; the recorded live-acceptance gate is preserved explicitly below rather than treated as unfinished implementation. - Stage 1: `docs/codex-adapter-stage1-evidence.md` (dated runtime/protocol/isolation evidence). Stage 2: the Codex worker-local adapter (`worker_codex_adapter.py`, allowlist id `codex`, delivered through the M05 `worker_bridged` channel per D-049) with reviewed evidence cells (`codex_worker_evidence.py`, dated 2026-09-20, adapter `codex-worker-local` `1.0.0`, tested against `codex-cli 0.154.0-alpha.6.2`). - Acceptance criteria, with evidence: separate documented scenarios for CLI/VS Code/Desktop installations and Windows-vs-WSL profiles (Stage-1 doc; Windows-native Codex remains honestly `platform_not_evidenced`); missing official components produce a remediation step, never token extraction (controlled `CODEX_HOME` adoption; the real-binary probe shows the unsigned-in home fails CLOSED with `auth_unverified`); compatibility is recorded as a dated PASS/PARTIAL/UNSUPPORTED/UNKNOWN matrix (streaming `PARTIAL`, tools `UNSUPPORTED`), never inferred from text output; promotional eligibility is never inferred from execution success; a runtime contract change disables the adapter fail-closed (generation-aware parsing, D-019 pattern); isolation is end-to-end verified (controlled home 0o700, generated config without `mcp_servers`, scratch cwd, `workspaceWrite` + `networkAccess: false` + `approvalPolicy: never`, minimal child env, no user MCP/plugins/apps/connectors inheritance — `tests/test_e2e_codex_acceptance.py::CodexStreamingExecutionTests::test_isolation_profile_end_to_end`). - Deterministic acceptance: 24 e2e tests through the FULL composed stack (OpenAI-compatible client → server → real worker protocol → CodexLocalAdapter → fake App Server): physical model identity with the SHIPPED catalog (`--codex-model`, `gpt-5.6-sol`), exact effort binding, structured output, pre-dispatch tool rejection, streaming and non-streaming, cancellation, usage honesty, mid-execution worker loss = ambiguous and never retried, resource→worker ownership, multiple Codex resources, leakage/audit asserts. All green in the 1868-test gate. - **Preserved external gate (not unfinished implementation):** `EXTERNAL_ACCEPTANCE_GATE: LIVE_CODEX_SUBSCRIPTION` — one live turn-level execution against a provider-managed login in a dedicated controlled `CODEX_HOME` requires an interactive official `codex login` by the owner; manual token extraction is forbidden by this issue's own acceptance criteria. Exact owner action and the deterministic evidence already complete are recorded in `docs/m10-acceptance.md` ("External gate"). Closing as complete subject to the recorded gate; `docs/roadmap.md` now records M06 accordingly.
kilo closed this issue 2026-09-21 17:06:24 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Creatidy/scarcity-router#91
No description provided.