Skip to content

feat!: Codex Accounts beside Claude under a fresh provider layout, and perch wizard - #449

Open
mschieller wants to merge 67 commits into
mainfrom
feat/multiple-providers
Open

mschieller wants to merge 67 commits into
mainfrom
feat/multiple-providers

Conversation

@mschieller

@mschieller mschieller commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

What changes

Perch holds Accounts of more than one provider. perch add --codex logs a Codex Account in, perch run --codex launches it in isolation, and perch switch <codex account> writes the login the next codex starts with, Capturing the Renewed copy of the one it leaves; the Watcher Cycles Codex Accounts among themselves under their own grant. Claude's behavior moves behind the same provider contract. perch wizard organizes the Holdings one question at a time. The layout is fresh: one config.json manifest and per-provider state.json (Registry version 9), Exports carry opaque provider bundles (Export version 5), and retired layouts are refused with reset instructions rather than migrated.

Why

One CLI per subscription was the assumption every module carried. The redesign puts what is provider-specific behind providers/<provider>/ and leaves the commands, the Registry and the Watcher provider-blind. ADRs an-account-has-a-workspace, a-provider-owns-its-tool, codex-owns-its-renewal, each-provider-has-a-default, run-has-a-provider-preference and a-fresh-provider-layout make the case; the last records the sole user's authorization for a fresh installation before launch.

Closes #441.

How you know it works

cargo test --locked: 701 library tests and every integration binary pass, including tests/providers.rs (52) for the Codex adapter, tests/wizarding.rs (19), and the conformance suite both adapters run under. tests/comment.rs holds the comment caps. The review pass on 2026-09-17 landed one commit per finding on top: a keyring pin now refuses the Switch however an auth.json was left behind, a pin under a table header is not the Default's, a restored config.toml that leaves the file store is refused before any write, and the Wizard reads a provider-scoped Setting by its key.

Checklist

  • The title is a Conventional Commit: feat:, fix:, docs:, refactor:, perf:, test:, build:, ci:, chore:, revert:, with ! for a break. It is the squashed commit subject, and release-plz reads it to pick the next version.
  • CHANGELOG.md has an entry under ## [Unreleased], marked [**breaking**] if a command, a flag, an exit code or a --json shape moved. Nothing else warns a script.
  • If the shape of the registry or of an Export moved, its version moved with it, and the change lands as a migration or as a refusal naming the version that wrote the file.
  • cargo fmt --all, cargo clippy --all-targets --all-features -- -D warnings, cargo test --locked.
  • typos, typos - < Cargo.toml, typos - < typos.toml. Perch writes American English.
  • Comments say one of the four things CLAUDE.md lists and stay inside the caps. A decision that is new to the repository has an ADR under docs/adr/, cited once per file as ADR <slug>.

🤖 Generated with Claude Code

mschieller and others added 16 commits September 16, 2026 19:43
…left behind

refuse_unless_file_backed returned Ok on the presence of auth.json before
reading config.toml, so a home that logged in under the file store and later
moved to the keyring passed the guard, Perch wrote auth.json, and Codex read
the keyring. The pin is read first; an explicit store other than file refuses
regardless of what files remain.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
pins_the_file_store matched cli_auth_credentials_store on any line, so the
key inside [profiles.x] passed the guard while Codex read it as that
profile's setting alone. Only lines before the first table header count.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…d before any write

Restore::prepare validated the bundle's auth.json and wrote its config.toml
verbatim, so an Export pinning the keyring replaced Perch's file-store pin
and nothing later repaired it. The top-level store is read at prepare and a
value other than file refuses the import (ADR a-fresh-provider-layout).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…n by name

one_setting hardcoded watcher_may_act as the current value whenever a
provider was named, while the prompt and the written command used key. Right
today only because that is the one provider-scoped Setting asked.
Setting::of_provider resolves any key for a named provider.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…able

The prefer-fable to preferred-workload rename left the Measure's doc, its
tier notes and the Listing's describing a Fable-only mechanism the code no
longer has. Each now names the Ranking window the provider declares.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Six source files and the CHANGELOG picked up U+2019, one of them in a
sentence printed at the terminal; main has none. typos does not see these.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
It said Claude session evidence; Codex reads and claims through it too.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
AUTH_FILE was declared and then bypassed by seven auth.json literals across
mod.rs, auth.rs and profiles.rs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
resolve read every Profile's Credential looking for a byte-equal copy before
falling back to the identity the live file carries. credential() only
returns a copy whose identity matches its Account, and no two Accounts share
one, so a byte-equal hit and the identity match name the same Profile. The
loop was one read and one JWT decode per Profile for the same answer.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…sult

Both Invalid arms were unreachable: clap's conflicts_with rejects a flag
beside --provider or beside the other flag before the command runs, and the
one programmatic construction leaves both flags false. Five callers drop a ?.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
prepare pushed exactly one entry into a Vec inside a bare block, and write,
rollback and Drop looped over it. Three fields and an Option carry the same.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
profile_dir took a Host it ignored, could not fail, and cloned on every call,
so eleven sites paid a ? and a clone for a field. Each now reads directory().

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ccounts

preferred_workload resolves from the selected provider while role() asks each
Account's own adapter, so a Scope ranked across providers would mark the
other's Accounts Unobserved. Listing and the Watcher round both filter first;
the invariant now says so where it is relied on.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
credential()'s error is dropped on purpose there; the road not taken is said.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The merge at 63434a0 carried main's content in one squashed commit, so
origin/main was not an ancestor and the PR diffed against 2b1df7c, showing
#443 through #447 again. The tree is unchanged; the parent is now recorded.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mschieller mschieller changed the title initial commit feat!: Codex Accounts beside Claude under a fresh provider layout, and perch wizard Sep 17, 2026
mschieller and others added 2 commits September 17, 2026 11:07
…icit

Restoring onto a Profile that exists and a bundle Credential for another
Workspace were untested refusal paths; both now assert the refusal and an
empty effects log. explicit()'s --claude arm had never run under a test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

mschieller and others added 7 commits September 17, 2026 15:47
…l as by Alias

`perch switch --claude person@example.com`, where only a Codex Account holds
the address, switched to the Codex Account: `resolve_for` refused a flag it
disagreed with on the Alias path alone, and the email path fell back to the
unfiltered lookup and handed the other provider's Account back. Both paths
now end in the one refusal, so `run` drops the second check it kept for the
email path, and the Guide's `run --claude personal` transcript says what the
build prints.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Both read the selected provider's active Account, and neither selected one,
so both read Claude's whatever the Registry held: after `perch switch work`
on a Codex-only machine, `perch status` refused with "no active Account" and
`perch list --json` gave `"active_account": null`. Both now take the provider
flags the other commands take, and with none speak for the one provider held,
or the Run preference where both are. The rule is the Registry's, chosen once
where the two commands open it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…first command

`config set` had left the door: it loaded the Registry or made an empty one,
so on a machine with a native login and no Registry yet it saved one holding
no Account. Adoption runs only where no Registry exists, so that login was
never adopted afterwards, and `perch status` refused with "no active Account"
until the file was moved aside. Both halves go back through adoption; the
writing half through `only_the_registry`, which is the one door it had.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`refuse_unless_file_backed` read a `config.toml` without
`cli_auth_credentials_store` two ways: the file store when an `auth.json`
lay beside it, the keyring when none did. Codex's own default for the unset
key is the file (`AuthCredentialsStoreMode`, `#[default] File`), so a Default
that had a `config.toml` and no login yet was refused with "Codex keeps its
login in the keyring", which was not so, and told to add a line it did not
need. Unset is now the file, as ADR each-provider-has-a-default already
states: refused is a config that chooses another store, and the refusal names
the store it chose.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ads it

Three sentences printed `Account::key()`, which for a Codex Account is
`codex:` and sixty-four hex digits: the relogin announcement, the note that
`perch relogin <key>` again finishes a repair the live write did not take,
and the `perch group move <key> <group>` a Cycle offers an Account in no
Group. Every neighboring line already asked the Registry how the person
names the Account; these three now do too.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…not an Organization

`identity` stood an empty string in for a missing `email` claim, and the
Registry's address rule exempts Accounts with a provider identity, so a token
without one would have been held as an Account with no name. It is refused
like a token missing its user or Workspace. The Workspace UUID also stood in
as the Organization name, so `perch status` showed it on the Organization
row and `perch add` said it in the parenthesis; the token's `organizations`
are API organizations rather than the Workspace, so no name is claimed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`Authenticated.configuration` is the identity file Claude's install writes
beside the Credential. Codex set it to its config pin and its install never
read it; the Profile's `config.toml` comes from `write_credential`, which
writes it where none exists. A field set for no reader is gone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
mschieller and others added 30 commits September 18, 2026 11:01
The Codex Default read nothing back for six of its seven Capture outcomes,
its Landing walk was only ever settled one way, and the third adapter in
`conformance.rs` answered half the shared contract without a caller. Covers
the outcomes, the walk, the shared refusals a Provider makes before any
native effect, and the Codex reads of Utilization, launch and login.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…dren

`host::real` was exercised by 28 tests and nothing drove its filesystem,
its spawning or its wait: this adds tests for both, on a scratch
directory under `temp_dir` and on `/bin/sh` and `/bin/cat`. The fake and
the port get the arms nothing reached — a loop of links, a write under
something that is not a directory, a path refusing a write, a hard link
with no file to give a second name.

The keychain calls, the terminal reads and the two signal handlers stay
uncovered: `security` is macOS's to answer, `read_without_echo` wants a
TTY, and a real SIGINT would reach every other test in the process.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Unit tests in the modules that own the vocabulary, and behavior tests in
tests/manifest.rs for the configuration store:

- name.rs: the three rules the current row does not hold, both folds,
  `acceptable`, and every arm of `Rule::keeps` and `Rule::opens`.
- storage.rs: a runtime record that will not be read, two Accounts at one
  position, a key an identity does not derive, a runtime of another version,
  a Landing on an Account the manifest no longer holds, a Run that may not
  fall back, and the hold each file checks as it is written.
- registry.rs: the hand edits `validate` names, a provider's active state
  naming another provider's Account, and how an Account is named where one
  address is held twice.
- lock.rs: an artifact that is a link to nothing, a filesystem that refuses
  outright, a parent that cannot be made, and `around_a_registry_write`.
- round.rs, cycle.rs, json.rs, keychain.rs, upgrade.rs, error.rs,
  holdings.rs, test_support.rs: the remaining arms each module answers for.

137 of the 202 uncovered lines across these files are now covered. What is
left is assert-failure arguments, `install_panic_hook` and its reading of
`RUST_BACKTRACE` — both process-wide — and four branches no fixture can
reach: `renew`'s touch-then-unreadable window, `Width::flush`, `sealed`'s
unreachable fallback, and `trusted`'s `Unobserved` arm.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…m's words

Windows answers `ERROR_PATH_NOT_FOUND` where Unix answers `ENOTDIR`, so
pinning the refusal to `HostError::Io` failed the Windows runner.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`path()` had no caller: `landed()` is how a report finds the file, and it
answers only once the write has happened.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The README and the site were headed "Run Claude Code as whichever Claude
account you want", the Guide said a Credential lives where Claude Code puts
one, and CONTEXT.md defined Adoption, Profile, Credential Store, Shared State,
Quota Window, Rotation, Renewal, Refresh, Marker, Probe and Triage in one
provider's terms. Each now states the general rule and names what each Provider
supplies. Codex support is still called experimental where it was.

The decision records go the same way, checked against the code rather than
restated: 0102 and 0204 move from the "must be verified" register into the
present tense the rest of the set uses, 0501 states the Capture, Landing and
write for every Provider and names each one's mechanics, and 0301, 0401, 0502,
0701, 0702, 0703, 1202 and 1301 state their rule once. 1002, 1003, 0907 and
0908 carry the note that migration is suspended under a-fresh-provider-layout.

Three corrections the sweep turned up rather than made:

- 1208 rejected a second agent on the ground that Perch is a tool for running
  Claude Code, while the code hands a Triage to whichever client run-provider
  names. configuration.md also implied `perch triage` takes provider flags; it
  takes none.
- The redesign moved `anthropic`, `migration`, `probe`, `profile` and the rest
  under providers/claude/, leaving 0907, 1103, 1206 and clippy.toml's own lint
  reason naming modules a reader would not find.
- accounts.md showed `Added person@example.com (workspace-1, plus)`. A Codex
  identity carries no organization name, so it prints `(plus)`.

Two sentences Perch itself prints moved with the documents, because the Guide's
transcripts are taken from the build: a Purge names both clients, and so does
`perch triage --help`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`name::acceptable` brought a name a published Perch accepted forward to one this
build holds. Nothing has called it since layout 9 stopped migrating and started
refusing (ADR a-fresh-provider-layout). It was `pub`, so no dead-code warning
ever said so; `Rules::accepts`, `Rules::keeps`, `Rules::opens`, `Rule::keeps`
and `Rule::opens` existed only to serve it, and being private, they are what the
compiler refuses to leave behind once the caller goes.

One surviving test asserted through `Rules::accepts` that no rule in a row of
its own is the allow-list. It makes the same claim through `validate`, which is
the door that is left.

The comments that described the same machinery go with it: name.rs said the
migration reads the same rules this build enforces and that a set is frozen per
version below the current one, claude/probe.rs cited a-registry-comes-forward
for a refusal that meets `load` rather than a step forward, and an empty-bodied
test in main.rs was named for the migration two commands skip. CONTEXT.md's
**Name** entry claimed the rules are recorded per Registry version; with one row
left, it says the row moves the version instead.

The tests this removes are the ones 1537993 added three commits ago. Coverage of
a function no caller reaches is not a reason to keep the function.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codex declares no runtime assumption, so a Probe of it reports an installation
and nothing else (ADR codex-owns-its-renewal). That is not the same as having
nothing to check: the adapter believes the installed `codex` still answers the
four documents an observation sends, and that `cli_auth_credentials_store` still
names the `file` store a Switch pins. Confirming either writes into a CODEX_HOME,
which is why neither can sit in `diagnose` — a Probe touches nothing — and why
both sit in the suite that already asks for that consent
(ADR a-suite-is-named-and-gated).

Logged out is all a runner ever is, and it is enough, because the refusals are
asymmetric: a method that has gone answers `unknown variant` where one that is
there answers about authentication, and an unknown `-c` key is taken in silence
where a bad value for a real one is refused naming `file`, `keyring`, `auto` and
`ephemeral`. That last is why the setting is asked for by giving it a value no
store answers to.

The suite drives the adapter's own ARGS and request documents through a
feature-gated door rather than a copy of them, because a copy goes on passing
after the product has moved. `usage::requests` is the one place they are built.

Checked against codex-cli 0.153.3: all three pass, and renaming the method and
the setting in the source makes them fail naming the cause. CI installs `codex`
beside Claude Code, floating both versions, since pinning either would freeze
out the drift the weekly run exists to detect.

A Holdings directory this build will not read refuses executable resolution, so
the skip says that rather than claiming there is no Codex installed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Preferred First read "no Ranking window" as Unobserved before asking what
the other windows said, so an Account with its 5-hour window at 100% ranked
in the top tier above every candidate with room, and a Switch landed on it.
measured_fullest_of already read the same Account as full.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…s unset

store_setting swallowed every read error into "no store is named", so an
unreadable config pinning the keyring let a Switch write auth.json and report
success while Codex kept reading the keyring.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ex renewed

snapshot read the Profile copy whatever the Account's relation to the Default,
so the active Account exported the token from its last Switch rather than the
one Codex rotates in place. The live copy is read first, verified as this
Account's, and the Profile copy stays the fallback. already_landed now reads
through the same function and so respects the store pin.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…live Credential

the_live_store read a missing or unreadable .claude.json as "not this
Account's" for every Account carrying a subject, so the Export fell back to
the Profile copy a Renewal had already retired. Only an Identity naming
somebody else rules the live store out, as before the move.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
owner_in required both uuids, but identity::subject mints a subject with no
Workspace, so such an Account never confirmed and never recorded Utilization.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ery Account

The carve-out was skipped for any Account with a subject, which is all of
them, so a renamed field at /api/oauth/profile failed every read from an
Account's own Profile. The test fixture now carries a subject.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The Watcher's Candidates and the typed worth_reading walked every Account in
the Scope, so a mixed Group spent Codex reads and renewals on Accounts the
Claude round then dropped, and a failing Codex read held the round at "no
candidate could be read" forever. cycle::choose and cycle::ranked already
filtered; the two walks now match them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… now does

Two rows pinned the rules the previous fixes reverted: an Identity nothing
can read counted against the live store, and a reply naming no email failed an
Account whose Credential came from its own Profile.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The provider was picked from which CLI was on PATH before the Target was
resolved, so a machine holding only Codex Accounts with claude installed
refused every bare perch run. The Account decides the CLI; run-provider
only breaks the tie an address held under both providers leaves.
Selection::installed had no other caller and goes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A bare perch switch <group> refused with "Choose --provider" whenever the
Registry held both providers, even where the Group held one.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
watcher-may-act was written under the provider the Scope holds and read
under the selected one, which every load resets to Claude, so a granted Codex
Scope printed false. Setting::of and the Scope page now derive the provider
from the Accounts the Scope holds; the --provider read names it outright.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Only watcher-may-act had the mixed-Scope guard, and it lived in the command,
so preferred-workload on a Codex Scope silently wrote under Claude. The guard
moves into Setting::write, where both per-provider Settings pass through it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
max() over per-provider codes let another provider's "nothing to do" mask a
Switch, so a scheduler branching on the code never saw it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The write between capture and apply ran outside Holds::around_a_registry_write
once the native Held moved into the provider's DefaultChange, so a slow save
could outlive Claude Code's ten-second lock window and apply would write under
a lock somebody else had taken over. The trait gains the hook; Claude renews
through it and Codex, holding nothing native, runs the write as it is.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ttings

The guard admitted only a Registry at the Claude run-provider and then fell
into a message naming "no Account but 0 Groups"; it ignored the other global
and default Settings entirely. Every Setting counts, and the refusal says so.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…back

apply wrote config.toml before auth.json and never rolled it back, so a failed
Switch reported "Nothing was switched" after creating a file in ~/.codex.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Three tests pin the rule: a stable subject is confirmed by Anthropic or not at
all, and only an Account without one falls back to the Profile the Credential
came from. The site now states that instead of implying the opposite.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New command: wizard

1 participant