Repository navigation
feat(base): transactional Codex provider switch and quota telemetry - #44
Conversation
Port transactional Codex provider switch with delivery exclusion lock, quota telemetry observer, store, and UI indicators. Sanitize public fixtures and enforce clean-room boundaries.
Test plan: disposable agent home exerciseThis is the live exercise that must pass before this branch goes near main. Agreed with Io 2026-10-02. It is deliberately written to be run by hand on a throwaway home, not against a real agent. The unit and shell suites cover argv construction, the lock, the token binding and the canary parsing. They do not cover killing a real pane and getting a real Codex back up. That is the whole risk, so it is the whole of this plan. Safety rules
Setupexport PROVIDER_SWITCH_AGENTS_ROOT=/tmp/ps-exercise/agents
export PROVIDER_SWITCH_STATE_ROOT=/tmp/ps-exercise/state
export PROVIDER_SWITCH_TMUX_SESSION=ps-exercise
mkdir -p "$PROVIDER_SWITCH_AGENTS_ROOT/psagent"Provision the disposable home the same way a real one is provisioned: Acceptance table
Failure paths, each its own run
What "done" looks like
What I have not covered here
Post the results back here as a comment before asking for merge. If any row in 12 to 18 reports success instead of refusing, stop: that is the failure mode this branch exists to prevent. |
Review, Sol 6.1, 2026-10-02Reviewed SHA 115ad04.
I found no credential-writing code or added private names, machine-specific paths or Inkie paid-feature disclosures. Azure-only credential ingress is not enforced: the launcher also inherits its environment and trusts the provisioned Codex configuration. I did not run the supplied tests because they write fixtures, or test live tmux, real authentication, Azure canaries or App Server telemetry. Verification was source review plus read-only, in-memory reproductions. |
Review, Sonnet, 2026-10-03PR 44, feat(base): transactional Codex provider switch and quota telemetry SummaryThe staged design is sound (prepare, launch, verify-canary, commit, with rollback/abort/finalise), the confirmation token is hashed, single-use, expiring and pane-bound, inputs are regex-validated before they reach the shell, the Azure key is only read from the agent's CriticalNone found. No live switch was run, so the process-lifecycle paths are reasoned from the code only. MajorM1. The lock only pauses the CLI push and boot, not the deck's own pane writers
Fix: in the deck, refuse sends while M2.
|
What
Finishes the multi-provider runtime and quota telemetry branch: a Codex agent can be moved between the Plus plan and an Azure/OpenAI-compatible endpoint without losing its agent envelope, and the deck shows the resulting quota state.
Two halves:
packages/base/bin/boot-agents.sh,codex-provider-switch,provider-switch-lock): the canonical Codex launch command now carries the full provider envelope across both the initial launch and the crash fallback, includingCODEX_HOME, model and the agent's.env.secrets. The switch itself is a transactional five-stage flow,prepare->launch->verify-canary->commit, serialised by an on-disk lock, with a short-lived confirmation token bound to the exact pane and provider. Both directions are supported.packages/deck/app/lib/codex-quota*): observation, storage and display of Codex quota, plus the status component.Why it is transactional
Switching the provider means killing a live Codex process and relaunching it against a different home. A half-done switch leaves an agent with no working runtime, so the flow is deliberately staged: nothing is committed until a canary turn has been verified in the new rollout, and any interruption leaves the authoritative provider state pointing at the old provider.
Reviewer notes, and please read these
.env.secretssourced in the pane shell. Worth a reviewer confirming that reading rather than taking it on trust.--modelis appended when the agent has a.modelfile; theresumepath is explicitly refused (provider switch must never resume a physical thread).commitis never reached, so the provider state still names the old provider. The stale lock can be inspected withprovider-switch-lock.Review legs
check:leaksclean (402 files, 30 rules).Not tested
codex-provider-switch.test.py,boot-agents.test.sh), not by killing a real pane.OSS-clean
Public repo. Leak gate clean on this branch; no keys, no
/homepaths, no commercial or pricing content.