Capacity acquisition shares the worker's controlled Codex home (#168) #170
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
P1
P2
P3
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Creatidy/scarcity-router!170
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/168-capacity-controlled-home"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reopens the fix for #168 (the issue is open awaiting this re-test). Branch off
develop@d90f450, single commit866abb5. Do not merge without the owner's review.The bug (second Precision field test)
make codex-logincompleted (Successfully logged in— the source's controlled home got fresh credentials), butscarcity-router statusstill showedProvider openai status=unknown windows=none diagnostics=telemetry_unknown.Root cause: two Codex credential locations on one host. The OpenAI capacity collector spawns its app-server with the inherited environment, so it authenticates from the child's default state (
~/.codex) — while the login refreshes the worker source's controlled home (<state_dir>/codex-sources/<source_id>/codex-home). On Precision~/.codexhas no session, so telemetry stayed unknown no matter how fresh the worker's credentials were.The fix (D-066 amended, point 5)
status.py's default OpenAI collector resolves the local worker's exactly-one configured Codex source — the same tiered unit read-back the login uses,v_safe_id-validated so a hostile unit id cannot steer the path — and hands that source's controlled home tocollect_openai_codex_capacity, which sets it as the child'sCODEX_HOME. The acquisition module builds the variable but never opens the home (its no-credential contract is unchanged; docstring updated).CODEX_HOMEin the environment wins (operator override). Zero sources, several sources, or a refused unit →None→ acquisition keeps today's inherited-environment behavior, so worker-less hosts collect exactly as before (ROG's zero-source unit is unaffected).make codex-loginnow refreshes both the execution credentials and the OpenAI provider telemetry on a worker host.Architectural note (why a new module)
Composing the read-back from
status.pyneeds it without pulling the worker runtime:worker_codex_adapterreachesworker_protocol → selection_app → status, so any worker-runtime import fromstatusis a static cycle (basedpyright fails the gate on it — function-local imports do not help). The read-back and the sharedServiceSelectiontype therefore moved to a new leaf modulescarcity_router/worker_unit_selection.py(stdlib +worker_local_storeonly), re-exported byworker_service; all existing callers and tests are unchanged. The controlled-home layout is spelled once instatus.pywith tests cross-checking the adapter's realControlledCodexHome, so it cannot drift.Verification
uv run basedpyright0 errors / 0 warnings / 0 notes,git diff --checkclean;origin/develop..HEAD= the single commit.ControlledHomeCompositionTests(status — one source resolves the controlled home cross-checked against the realControlledCodexHome, hand-written unit resolves the same way, explicitCODEX_HOMEprecedence, zero/multiple/missing/traversal-id →None, timestamp/binary pass-through) and two acquisition tests (codex_homesets exactly the childCODEX_HOMEwith everything else inherited; nocodex_home→ environment untouched).default_worker_state_dirpatches retargeted to the leaf module; allworker_service.*names still work through re-export.None(unchanged); simulated Precision hand-written%hunit → the correct controlled home;CODEX_HOMEset →None.Expected Precision re-test (after merge)
Provider openaishould now reportstatus=okwith the ChatGPT-plan windows (five-hour/weekly), reading the same credentialsmake codex-loginrefreshed. No worker restart needed.UX impact
Positive: the operator's mental model ("one login refreshes the worker's Codex credentials") now holds for telemetry too, instead of a silent second credential location. No new interactive steps, no new flags; ambiguous configurations behave exactly as before (fail-closed/unchanged rather than guessing).
make codex-loginthat refreshes the local worker's Codex credentials #168Closing as superseded by merged PR #172.
Verified current develop
6c337a400b4cdc28ded543d2ae8ccf3749d79cb7contains #172's merge and the complete intended telemetry outcome: the shared default collector discovers the installed worker source/state directory and passes its existing controlled home as child-only CODEX_HOME, without credential copying, home provisioning or parent-environment changes. Worker-less/no-source collection remains supported; #172 additionally provides explicit source/@local selection, validated binary pins and safe errors instead of ambiguous fallback. Its documented D-067 precedence supersedes #170's older ambient-home override behavior.Verification: 225 status/acquisition/worker-service tests passed; basedpyright reports zero errors/warnings/notes; checkout clean. No implementation edits, rebase or push; #170 head remains
866abb56449c7d950b8457b19144edaabb92a8b9.The leaf-module extraction is not retained: #172 already removed the import-cycle cause through shared home/state helpers, so no independently justified cleanup task was identified.
Pull request closed