D. Multi-account: multiple source instances on one worker #120

Closed
opened 2026-09-24 15:23:10 +00:00 by kilo · 1 comment
Member

Child D of #116 (Dynamic Execution Sources program).

MUST support multiple independent Codex sources on ONE worker host (e.g. "Personal Pro" + "Second account") without exposing worker process #1/#2, CODEX_HOME path #1/#2, codex-1/codex-2 adapter ids to the user — those are implementation details.

Current collision (recon)

  • LocalAdapterRegistry (worker_local_adapters.py:113) keys on adapter id and raises on duplicate "codex"; build_registry (worker_client.py:1020) constructs at most one CodexLocalAdapter with one resource/model.
  • ControlledCodexHome derives from state_dir only; default state dir means all worker processes share ONE codex/codex-home.
  • Server ResourceConfig.local_adapter_id is a free safe id, but server_composition.py:316 emits codex compatibility cells only for local_adapter_id == "codex".

Design

Prefer ONE native worker process per host. Distinguish adapter KIND (codex) from adapter INSTANCE / execution source (source_id):

adapter_kind = codex, source_id = personal-openai
adapter_kind = codex, source_id = second-openai

Minimal explicit solution; do not overload physical model names as source identities; do not break the server's exact ownership discipline (resource→worker binding stays administrator configuration; state reports never confer ownership).

Isolation requirements

Each source has an isolated source_id, controlled CODEX_HOME, auth state, inventory, execution identity, quota/capacity observations. No credential shared between sources; no source can accidentally execute using another source's controlled home.

Quota-pool semantics

Two independent OpenAI accounts must NOT automatically share one quota pool: source A → pool A / unknown sharing, source B → pool B / unknown sharing; only explicit evidence establishes sharing. Same physical model via two accounts = two targets with different source/resource/entitlement capacity; routing may choose between them. D-042 quota rules unchanged.

Source-local authentication UX (child E implements the surfaces): "Add Codex source → creates controlled home → one clear login command → official codex login → authenticated → inventory appears". No manual path derivation, no auth.json copying, no token extraction, no use of unrelated ~/.codex.

Child D of #116 (Dynamic Execution Sources program). MUST support multiple independent Codex sources on ONE worker host (e.g. "Personal Pro" + "Second account") without exposing `worker process #1/#2`, `CODEX_HOME path #1/#2`, `codex-1/codex-2` adapter ids to the user — those are implementation details. ## Current collision (recon) - `LocalAdapterRegistry` (worker_local_adapters.py:113) keys on adapter id and raises on duplicate `"codex"`; `build_registry` (worker_client.py:1020) constructs at most one `CodexLocalAdapter` with one resource/model. - `ControlledCodexHome` derives from `state_dir` only; default state dir means all worker processes share ONE `codex/codex-home`. - Server `ResourceConfig.local_adapter_id` is a free safe id, but `server_composition.py:316` emits codex compatibility cells only for `local_adapter_id == "codex"`. ## Design Prefer ONE native worker process per host. Distinguish adapter KIND (`codex`) from adapter INSTANCE / execution source (`source_id`): ```text adapter_kind = codex, source_id = personal-openai adapter_kind = codex, source_id = second-openai ``` Minimal explicit solution; do not overload physical model names as source identities; do not break the server's exact ownership discipline (resource→worker binding stays administrator configuration; state reports never confer ownership). ## Isolation requirements Each source has an isolated `source_id`, controlled CODEX_HOME, auth state, inventory, execution identity, quota/capacity observations. No credential shared between sources; no source can accidentally execute using another source's controlled home. ## Quota-pool semantics Two independent OpenAI accounts must NOT automatically share one quota pool: `source A → pool A / unknown sharing`, `source B → pool B / unknown sharing`; only explicit evidence establishes sharing. Same physical model via two accounts = two targets with different source/resource/entitlement capacity; routing may choose between them. D-042 quota rules unchanged. Source-local authentication UX (child E implements the surfaces): "Add Codex source → creates controlled home → one clear login command → official codex login → authenticated → inventory appears". No manual path derivation, no `auth.json` copying, no token extraction, no use of unrelated `~/.codex`.
Author
Member

Closeout — implemented in merged PR #124 (merge commit a4370f0 into develop, head 9789c67; program #116 / D-053).

Child D delivered: adapter KIND vs INSTANCE separation (codex:<source_id>), one worker process serving any number of independent Codex sources, each with its own isolated controlled home (codex-sources/<source_id>/, 0o700), auth state, inventory and execution identity — verified live with two sources on one worker (distinct homes on disk, two exact targets for the same physical model, distinct quota pools). Worker protocol v2 adds the bounded inventory section (negotiated; v1 peers unaffected); --codex-source and the official codex-login command (SSH-safe device auth — no browser/localhost fallback, no legacy-home or ~/.codex fallback, no credential copying) ship worker-side. Default per-source quota pools; sharing only via explicit pool id (D-042 rules unchanged).

**Closeout — implemented in merged PR #124** (merge commit `a4370f0` into `develop`, head `9789c67`; program #116 / D-053). Child D delivered: adapter KIND vs INSTANCE separation (`codex:<source_id>`), one worker process serving any number of independent Codex sources, each with its own isolated controlled home (`codex-sources/<source_id>/`, `0o700`), auth state, inventory and execution identity — verified live with two sources on one worker (distinct homes on disk, two exact targets for the same physical model, distinct quota pools). Worker protocol v2 adds the bounded inventory section (negotiated; v1 peers unaffected); `--codex-source` and the official `codex-login` command (SSH-safe device auth — no browser/localhost fallback, no legacy-home or `~/.codex` fallback, no credential copying) ship worker-side. Default per-source quota pools; sharing only via explicit pool id (D-042 rules unchanged).
kilo closed this issue 2026-09-26 17:54:16 +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.

Dependencies

No dependencies set.

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