Repository navigation
Pi accounts: ask a login's own questions on the phone - #201
Merged
Merged
Conversation
…ailure A Pi session's failure text reaches the bridge log and the phone: Pi's stderr (logged, and the reason in the session's `ended` frame), the error a provider sent back (the turn's error entry) and its first line on each retry status. An endpoint that echoes the header it refused puts the provider profile's token there. The Claude and OpenCode drivers already pass such text through redactSecrets; the Pi driver did not. Every such text now goes through the session's credentials (the profile token, and the credential and environment values the bridge handed over) before it is logged or shown, and so does the rest of what Pi says that the log keeps: an extension's failure, a dialog that could not be answered, a line on Pi's stdout that is not a record. For such a line the decoder no longer passes on the JSON parser's message, which quotes the line's first characters cut where a secret could no longer be found; the line itself is logged whole, redacted. A retry line is redacted before it is cut to its first 120 characters, since a token cut in half is no longer found. The test places the token across that cut, and fails when the order is reversed. Co-Authored-By: Claude Code <[email protected]>
Pi asks a login's questions as it goes: Cloudflare's account and gateway IDs after the key, how to sign in to Anthropic or OpenAI Codex (a page or a code), Radius's browser or device code, a GitHub Enterprise domain before Copilot's device code. The phone's account form asks a method's fields before it starts, and the Pi driver offered none, so it cancelled every such login: the Claude Pro/Max, ChatGPT (Codex), Copilot and Radius sign-ins and those key logins all failed from the phone. The account helper's listing now finds those questions by running each provider's login through Pi's own ModelRuntime.login with every way off the machine blocked (fetch, sockets, listening, child processes), placeholder answers, and a scratch auth.json deleted afterwards. A login is followed down each option of every choice it offers. The driver turns the paths into the method's fields, keyed by Pi's own question: - a key login works on a path with exactly one secret (the phone's key) that finishes without sending the user anywhere; a sign-in works on a path with no secret that ends at a page or a code; - a choice offers only the options that lead to a working path, and with one such option it is answered without asking (Amazon Bedrock's bearer token, Google Vertex's API key); - a question asked only after a choice carries that choice as its `when`; - a method with no working path is not offered (Pi's own ChatGPT sign-in under OpenAI fails without a device id). A key or a sign-in reads that provider's questions again, checks the phone's answers (a required one missing, a choice not offered) and answers Pi's prompts from them, once each; a question the listing did not find is still refused with Pi's words. Listing every provider with its questions takes about a second; a connected-only listing does not look. Verified live through the built host on Pi 1.5.2: the listing shows the fields above, a Cloudflare key is refused without its account ID and stored with CLOUDFLARE_ACCOUNT_ID with it, and the Anthropic sign-in started on "copy code" returned Pi's page, then cancelled. A key stored through account-action was the one a turn sent (the fake model refuses any other key). Co-Authored-By: Claude Code <[email protected]>
docs/PI.md named the phone's page "Accounts" (it is the agent's AI providers page, "Connect a provider") and said a login that asks more than a key is refused. It now says which questions the form shows, how the bridge finds them without anything leaving the machine, and which ways of a login need the machine's own /login. Co-Authored-By: Claude Code <[email protected]>
deymosh
force-pushed
the
feat/pi-phone-credentials
branch
from
November 18, 2026 21:04
cb3ebba to
f44327c
Compare
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.
Pi accounts from the phone: Pi's login questions on the connect form, so the subscription sign-ins and multi-field key logins work. Also the owed bug hunt of #200, with its one real finding fixed.
What was checked first
The phone already drives Pi accounts through the generic "AI providers → Connect a provider" page, since the Pi driver reports
supports.accounts. Verified live through the built host with real Pi 1.5.2 and the fake model: a key stored withaccount-actionlands in Pi'sauth.json, the provider's models appear, a turn on that provider sends exactly that key (the fake model refuses any other), and removing it clears the models.What was missing: Pi asks a login's questions as it goes, while the phone needs them as the method's
fieldsup front. The driver offered none and cancelled any prompt besides the key or a pasted address. So these all failed from the phone:Commits
endedreason sent to the phone), a provider's error reply (the turn's error entry) and the retry status line went out unredacted. An endpoint that echoes the header it refused would leak the profile token. Claude and OpenCode already redact. The retry line is now redacted before its 120-character cut. Failing-first test, also proven against the cut order reversed.ModelRuntime.loginagainst a scratchauth.json, with fetch, sockets, listening and child processes blocked, following every option of each choice. The driver turns the paths into fields keyed by Pi's question: choices restricted to options that work from a phone, a single workable option auto-answered,whenfor questions behind a choice, and a method with no workable path not offered. A login re-reads its provider's questions, validates the phone's answers, and answers Pi's prompts once each.No wire or phone change:
AccountMethod.fields,answersand the connect form's field rendering already exist (OpenCode uses them).Bug hunt of #200 (
git diff 2c2dd3c 1592fab)CODEDECK_PI_PROVIDER_TOKENno longer scrubbed from the inherited env: not real. Nothing reads it any more, so an inherited copy is like any other inherited variable, which the driver passes on by design.--keyon its argv: not real. It's a separate test process that no leak assertion inspects.configLiteral) matches Pi's resolver, and fd 3 without a pipe throws EBADF, which is caught.Review of this PR (bug hunt during CI)
extension_error, a dialog error, and an unreadable stdout line, whose reason was V8's JSON.parse message: it quotes the line's start, cut where redaction can't find it. The decoder now passes a fixed reason; the line itself goes whole and redacted. Test proven by restoring the parser's message.whenfields have no Pi provider using them yet.Verification
./codedeck check --changed: host install, typecheck, test, build; android bindings and gradle (unit, Paparazzi, lint) all ok.CLOUDFLARE_ACCOUNT_IDwith it;Traffic
None added on the wire. Opening the provider picker costs the bridge about 1 s more of local work.
🤖 Generated with Claude Code