Repository navigation
feat(pi): show which Codex authentication store the Pi session uses - #13
Merged
doitdigital0495 merged 2 commits intoSep 9, 2026
Conversation
…s from Pi's footer already carries the quota figures for every subscription, but nothing on screen said which Codex login the running session actually spends. With two Pi homes on this machine, that left the quota block readable and the account behind it a guess: the personal home and the Geris home render the same model, the same provider, and the same numbers. .pi/extensions/fm-codex-account.ts publishes one always-visible footer status, "codex@.pi" or "codex@.pi-geris", naming the agent directory this process authenticates from. Pi renders every extension status on its own footer line below the token, cost, context, and model row, so the indicator is on screen for exactly as long as the quota display is and changes none of its numbers or layout. A widget was the wrong surface: Pi orders widgets by unsorted directory order and caps the widget area at ten lines, so a second one could land above or below the quota block from one run to the next. Identity comes from the runtime, not from convention. getAgentDir() is Pi's own resolver for the directory it reads its credential from, and ModelRegistry.getProviderAuthStatus reports whether a credential is configured and which surface supplied it. A store is named only when Pi reports the credential as the stored one; a credential from the environment or the runtime belongs to some other account, so those render codex@unverified(<source>), a store with no login renders codex@unverified(no-login), and a store whose path is not plainly path-shaped renders codex@unknown rather than being cleaned up into something that reads like a real store. Nothing credential-bearing is touched. The extension reads no access token, no refresh token, no stored credential, no account id, and no address, and it displays none of them, so it names a store and never a person. The regression suite asserts that two ways that fail for different reasons: the fake registry raises from every credential-bearing Pi API, and the resolved store holds an unreadable credential file, so a run that reached for either would fail rather than pass quietly. Verified live on Pi 0.84.4 for both stores, with the evidence and the surface facts recorded in docs/verification/pi-account-indicator.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Publish the completed Firstmate Pi active-Codex-account indicator so Pi visibly names which Codex authentication store the running session actually uses.
Background and constraints:
How this branch was produced: the feature was already completed and reviewed as clean source commit 418096f95825fb964e8459ecf49c9f70efdc55d5. This task cherry-picked that exact commit onto the current default-branch head, confirmed it applied cleanly with a byte-identical diff, and deliberately did NOT recreate or broaden the feature. No compatibility fix was required, so there are no additional commits. Pre-pipeline checks run locally: tests/fm-codex-account-pi-extension.test.sh (6/6 pass), tests/fm-documentation-audiences.test.sh (4/4 pass), bin/fm-lint.sh (clean). tests/fm-pi-primary-types.test.sh skipped because tsc is not installed in this worktree.
The publication target is the captain's fork doitdigital0495/firstmate, not upstream kunchenguid/firstmate.
What Changed
.pi/extensions/fm-codex-account.tsPi extension, which resolves the active agent directory viagetAgentDir()and readsModelRegistry.getProviderAuthStatusto publish actx.ui.setStatus()footer entry naming the Codex store in use. A store is named only when the credential source isstored; an environment or runtime credential renderscodex@unverified(<source>), a store with no login renderscodex@unverified(no-login), a non-path-shaped store renderscodex@unknown, and an unavailable auth status is treated as missing evidence. The status refreshes onsession_start,model_select, andturn_start, and the extension no-ops when there is no UI.tests/fm-codex-account-pi-extension.test.sh, a regression suite whose fake registry raises from every credential-bearing Pi API and whose resolved store holds an unreadable credential file, so any read of a token, address, or account id fails the run instead of passing quietly. Wired the suite intobin/fm-test-run.shand added the extension totests/fm-pi-primary-types.test.sh.docs/pi-account-indicator.mdand maintainer-verification evidencedocs/verification/pi-account-indicator.md, registered both indocs/documentation-audiences.json, and linked the operator doc from theREADME.mdindex.Risk Assessment
✅ Low: Purely additive, UI-only indicator with a behavioral regression suite that executes the real extension against the installed Pi package; it reads no credentials, changes no existing Pi behavior, and every intent constraint (store-only identity, explicit unverified/unknown states, three refresh events, no-UI no-op, docs plus verification wiring) is satisfied in source.
Testing
Ran the focused regression suite for the indicator against the real installed Pi package (all checks pass, including the secret-safety assertions where the fake registry raises from every credential-bearing API and the resolved store holds an unreadable auth.json), plus the documentation-audiences suite and the test-runner coverage/lane checks proving the new suite is wired in. For end-user evidence I launched the real Pi TUI twice under tmux at 200 columns with --no-session, once against the default agent home and once with PI_CODING_AGENT_DIR pointed at the Geris home, and captured the footer: the two homes render codex@.pi and codex@.pi-geris on their own line beneath an unchanged token/cost/context/model row. Account emails printed by the pre-existing quota widget were redacted in the saved captures; the indicator renders none itself. The only failure anywhere is a pre-existing type error in the untouched fm-calm.ts, visible only when tsc is supplied manually.
Evidence: Live Pi footer for both Codex stores (redacted transcript)
Source: Live Pi footer for both Codex stores (redacted transcript)
Evidence: Full tmux pane capture - personal store
Source: Full tmux pane capture - personal store
Evidence: Full tmux pane capture - Geris store
Source: Full tmux pane capture - Geris store
Evidence: Footer lines side by side
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
.pi/extensions/fm-codex-account.ts:77- An unavailable auth status (getProviderAuthStatus throws, or returns undefined) falls into the same branch as a configured=false store and renders codex@unverified(no-login). That satisfies the intent's "never as a signed-in account" rule, but docs/pi-account-indicator.md:13 states that no-login "means the store holds no Codex credential", which is not what happened in the throw case. Tradeoff noted only; distinguishing it (e.g. unverified(unavailable)) would change user-visible output, so it is the author's call..pi/extensions/fm-codex-account.ts:37- SAFE_LABEL caps the label at 64 characters, so a perfectly path-shaped absolute store outside the home that is longer than 64 chars (e.g. a deep scratch or worktree agent dir) renders codex@unknown, while docs/pi-account-indicator.md:11 promises "A store outside the home directory is named by its absolute path instead." Degraded rather than wrong (it never borrows another store's label), and unreachable for the two named homes, but the doc and the cap disagree..pi/extensions/fm-calm.ts:426- Pre-existing and unrelated to this change: tests/fm-pi-primary-types.test.sh skips locally because tsc is not installed; run with an npx-provided tsc 5.x it fails on untouched .pi/extensions/fm-calm.ts (fm-calm.ts(426,57): error TS2345: Argument of type '(data: string) => void' is not assignable to parameter of type 'TerminalInputHandler'). The new extension fm-codex-account.ts type-checks clean under the same strict config. Fixing fm-calm.ts is outside this change's named scope.bash tests/fm-codex-account-pi-extension.test.sh(5 checks, ok against Pi 0.84.4)bash tests/fm-documentation-audiences.test.sh(4 checks)bin/fm-test-run.sh --check-coverageandbin/fm-test-run.sh --list --lane portable-serial | grep fm-codex-accountbash tests/fm-pi-primary-types.test.sh(skips: no tsc) plus a stricttsc --noEmitof.pi/extensions/fm-codex-account.tsalone against the installed Pi declarations (clean)Manual live run:tmux new-session -x 200 -y 40 'pi --no-session -e .pi/extensions/fm-codex-account.ts'+tmux capture-pane-> footer linecodex@.piManual live run:PI_CODING_AGENT_DIR=~/.pi-geris/agent pi --no-session -e .pi/extensions/fm-codex-account.tsunder tmux -> footer linecodex@.pi-geris✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.