Skip to content

feat(harness): Keep auth method kind so agent-type login can be a button - #1054

Merged
omesser merged 9 commits into
mainfrom
feat/1000-auth-method-kind
Sep 27, 2026
Merged

omesser merged 9 commits into
mainfrom
feat/1000-auth-method-kind

Conversation

@omesser

@omesser omesser commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Why

Chat could tell a person to run a login command, and it could not tell an ACP agent method from a terminal method. An agent method is the one the client may send to authenticate. A terminal method means a command in the user's own terminal. Claude advertises no methods, so that Harness stays on the sentence it already shows.

What changed

AuthOffer keeps an agent method's id and drops a terminal method's id, args, and env at the handshake. While the existing not-authenticated gate is up, ChatOpening.sign_in lists every agent method with a visible name.

The landing tiers the choices. With buttons it reads "Login using:", the buttons, then "Or run this in a terminal:" and the named command (codex login, claude /login, and the rest). With no button, as for Claude's empty list or Pi's terminal-only method, it reads "Run this in a terminal:" and the command. The command block has no border or accent, so it does not read as a third button.

The button calls authenticate with that id, then opens a new session. authenticate returning Ok does not clear the landing. A saved session/load is not used for this click, because a load that returns Ok would look signed-in even when authenticate changed nothing. A missing Instance, a terminal id, and a second click while one sign-in is in flight do not send the RPC. Settings and the header stay a sentence.

While a clicked sign-in is in flight, the line under the button reads "Finish signing in in your browser. Any code on that page came from , so continue only if you just clicked this button." The button is disabled until authenticate returns. grok's in-app flow (auth: inline auth flow in its log) opens the browser with a code already filled in and prints nothing, so the code never reaches ai-buddy and cannot be shown. The click is what the user vouches for, which is the same check grok's page asks for. The sign_in command runs off the main thread, since a browser flow holds authenticate for minutes and a sync command froze the overlay for all of it. clientCapabilities.auth.terminal stays unset. ADR-0010 now says an agent-method authenticate does not break its rule 6.

How to verify

cargo clippy --workspace --all-targets -- -D warnings is clean. cargo test --workspace passed (ai-buddy 617, core 494, plus the smaller packages). node --test tests/ passed 374, failed 0, skipped 7.

  • tests/chat-connect.test.js checks the waiting line for a landing with buttons and its absence without them. It failed before the change.

  • a_sign_in_clears_the_landing_only_when_the_next_session_opens drives the button's path through the harness.rs fixture agent. authenticate then session/new clears the login. An authenticate that is Ok and changes nothing leaves the login up and returns the not-authenticated error.

  • tests/chat-connect.test.js checks "Login using:" and "Or run this in a terminal:" when there are buttons, and "Run this in a terminal:" with no label when there are none.

  • a_login_opening_carries_agent_sign_in_and_omits_it_otherwise checks that an agent id reaches the Chat JSON and that a terminal method's args and env do not.

What it looks like

Three needs-login landings rendered from this branch's src/chat.html in headless Chrome, at the default 420 by 560 Chat window, resized to 280 pixels wide.

Codex Pi
Codex needs login. Login using: heads a ChatGPT button, then Or run this in a terminal: and codex login. Pi needs login. Run this in a terminal: and the npx pi-acp terminal-login command, with no sign-in button.
Claude Code Grok, sign-in in flight
Claude Code needs login. No methods were advertised, so Run this in a terminal: and claude /login are the only path, with no button. Grok needs login, sign-in in flight. The Grok button, then Finish signing in in your browser and where the code came from, then grok login.

The Grok still is rendered at the default 420 by 560 window, with a signed-out grok's single method, just after the button was clicked.

Missing sign-in by Harness

grok builds its method list from its own auth state. Its log for the signed-out landing (2026-09-27 12:59) records "methods": ["grok.com"], and a signed-in start records three methods with cached_token the default. The code filters nothing here, so the landing shows one button when signed out.

Device codes by preset: grok's in-app flow prefills its code in the browser and neither prints it nor sends it over ACP (its log shows auth: inline auth flow and no output; the printed prompt belongs to grok login --device-auth). codex-acp's chat-gpt and cursor-agent's cursor_login open a browser loopback login with no code. goose's goose-provider names goose configure. copilot and opencode ship compiled bundles, so their flows are unverified.

Kinds were read from initialize on 2026-09-27, with the client capabilities ai-buddy sends (form elicitation, auth.terminal unset). A method with no type is agent, which is how this tree's ACP schema deserializes it. Codex's API Key method is not a button until #1061 can pass a key.

The stdio probe on 2026-09-27 sent authenticate to every agent method, then session/new. That machine was already signed in, so it proves the calls are accepted, not that they sign a user in. The button column records the hand test on the needs-login landing where one was run.

Harness Advertised methods ACP kind Missing-sign-in UI Live authenticate / session/new Button on the landing Regress vs main?
claude none none "Run this in a terminal:" claude /login, no button. Still above. nothing to send. session/new opened. no button same command, no button
codex API Key (api-key), ChatGPT (chat-gpt) both agent "Login using:" ChatGPT, then "Or run this in a terminal:" codex login. Still above. chat-gpt ok. api-key not sent. session/new opened. ChatGPT signed in. Verified by hand by Oded, 2026-09-27. command unchanged, ChatGPT button added
copilot Log in with Copilot CLI (copilot-login) agent "Login using:" one button, then copilot login ok. session/new opened. not hand-tested command unchanged, button added
cursor-agent Cursor Login (cursor_login) agent "Login using:" one button, then cursor-agent login ok. session/new opened. not hand-tested command unchanged, button added
goose Configure Provider (goose-provider) agent "Login using:" one button, then goose configure ok. session/new opened. not hand-tested command unchanged, button added
grok Signed out: Grok (grok.com), plus xai.api_key when an API key is configured. Signed in: xai.api_key, cached_token, Grok. all agent Signed out: "Login using:" one Grok button, then grok login. Still above. all three ok while signed in. session/new opened. Grok signed in. Verified by hand by Oded, 2026-09-27. The browser's prefilled code cannot reach Chat; the waiting line says where it came from. command unchanged, button added
hermes custom runtime credentials (custom), Configure Hermes provider (hermes-setup) agent, then terminal "Login using:" one button, then hermes login custom ok. Terminal method not sent. session/new opened. not testable. custom succeeds without a login, so Hermes has no signed-out state to show the landing. command unchanged, one button added
opencode Login with opencode (opencode-login) agent "Login using:" one button, then opencode login ok. session/new opened. not hand-tested command unchanged, button added
pi Launch pi in the terminal (pi_terminal_login) terminal "Run this in a terminal:" npx -y pi-acp@latest --terminal-login, no button. Still above. terminal method, not sent. session/new opened. no button same command, no button

Notes

A browser login holds the ACP connection for up to five minutes. Messages that arrive during authenticate are not drawn until that call ends. Some adapters no-op or reject authenticate. Those still leave the landing up when the following session/new is refused, which the fixture test covers.

Fixes #1000
Closes #1064

— Claude Code agent, on @omesser's behalf. Opened by the Grok Build agent.

omesser

This comment was marked as outdated.

omesser

This comment was marked as outdated.

@omesser

omesser commented Sep 27, 2026

Copy link
Copy Markdown
Owner Author

The missing-sign-in matrix is in the description, under Missing sign-in by Harness.

Kinds come from an initialize probe on 2026-09-27, with the same client capabilities ai-buddy sends. A method that omitted type is recorded as agent, because that is how this tree's ACP schema deserializes it. Hermes's second method and Pi's only method sent type: terminal. authenticate and session/new were not sent, so those columns say not run. Every row keeps the named command main already shows. A row with no agent method adds no button.

— Grok Build agent, on @omesser's behalf.

omesser

This comment was marked as outdated.

@omesser

omesser commented Sep 27, 2026

Copy link
Copy Markdown
Owner Author

Live authenticate was run on 2026-09-27 for every agent method these nine presets advertised. Terminal methods were not sent. Then each attach was asked for session/new.

Codex api-key returned -32603 because CODEX_API_KEY or OPENAI_API_KEY is not set. Every other agent method returned ok within the call, and every session/new opened a session. Claude and Pi had nothing to send to authenticate. This machine did not return auth-required, so the needs-login landing was not shown.

The matrix in the description now has those results.

— Grok Build agent, on @omesser's behalf.

omesser

This comment was marked as outdated.

omesser and others added 4 commits September 27, 2026 15:32
"Login using:" heads the sign-in buttons and "Or run this in a terminal:"
the command. With no button the command drops the "Or". The command
block loses its border and accent so it no longer reads as a button.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ion/new

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@omesser
omesser force-pushed the feat/1000-auth-method-kind branch from eb6d386 to e5a65b4 Compare September 27, 2026 12:44
@omesser

omesser commented Sep 27, 2026

Copy link
Copy Markdown
Owner Author

Taking this over from the Grok Build agent. Tip is now e5a65b4d, rebased onto main.

  • Copy tiers. With buttons, the landing reads "Login using:", the buttons, then "Or run this in a terminal:" and the command. With none it reads "Run this in a terminal:" and the command. The command block lost its border and accent. tests/chat-connect.test.js asserted the new strings and failed before the change. docs/design/connect.html mirrors it.
  • Stills. The three stills were regenerated from this tip and the body points at the new uploads.
  • Button path. a_sign_in_clears_the_landing_only_when_the_next_session_opens drives Session::sign_in through the harness.rs fixture agent. authenticate then a fresh session/new clears the login. An authenticate that is Ok and changes nothing leaves the landing up.
  • Hand tests. Oded clicked Codex ChatGPT and Grok on the needs-login landing on 2026-09-27, and both signed in. Hermes has no signed-out state, because custom succeeds without a login. The matrix records all three.
  • Grok device code. Chat never shows the code grok's browser page asks the user to confirm. serve awaits authenticate inline and child stderr is not read, so showing it needs new plumbing. That is feat(harness): Show a device sign-in code in Chat while authenticate runs #1064.
  • ADR-0010. One paragraph says an agent-method authenticate does not break rule 6.

— Claude Code agent, on @omesser's behalf.

omesser

This comment was marked as outdated.

omesser

This comment was marked as outdated.

omesser

This comment was marked as outdated.

A device flow holds authenticate for minutes; as a sync command it froze
the overlay until the browser step finished.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
omesser

This comment was marked as outdated.

The wire pipes the child's stderr, tees it to ours unchanged, and the
session reads an XXXX-XXXX code and URL from it only while
`authenticate` is in flight. The landing shows it under the clicked
button and drops it when `authenticate` returns (#1064).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
omesser

This comment was marked as outdated.

omesser and others added 2 commits September 27, 2026 16:32
…-in"

grok prints nothing in ACP mode: its inline flow puts the code only in the
browser URL, so the stderr reader never matched.

This reverts commit 22e7cab.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
grok's inline flow prefills a code in the browser that never reaches us.
The line under the clicked button tells the user the click is what they vouch for.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
omesser

This comment was marked as outdated.

@omesser omesser left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Architect re-gate — CLEARED at 96b1bd70 (prior Architect COMMENTs obsolete)

Obsolete: every earlier Architect COMMENT/re-gate on this PR (matrix Softs, e2e Softs, CLEARED at e5a65b4d / afcad34d / 22e7cabd, and the Not CLEARED body-hygiene gate) is superseded by this tip and this COMMENT. GitHub cannot dismiss COMMENTED reviews via API; treat those threads as historical only.

Soft scorecard (current tip)

Soft Status
(a) Per-Harness matrix Met (body table + kinds + hand column)
(b) Chat landing e2e Waived by Oded beyond Codex + Grok
(c) Copy tiers Met (Login using: / Or run… / Run this…; stills match)
(d) Rebase Met (behind 0); CI green

Tip story matches body: waiting line under the clicked button (finish in browser; code came from Harness; continue only if you clicked); button disabled; sign_in off main thread; no stderr-tee device-code path (Grok never prints the code). Soft residual honesty for device code stays in #1064 (OPEN).

Soft before merge (one line)

PR trailer still says Closes #1064. That would auto-close an issue whose Done-when is still “show the code if a channel exists.” Change to Related to #1064 (or drop the closes) before merge. Everything else is ready.

Verdict

CLEARED for #1000 at tip 96b1bd70, pending the #1064 trailer fix above. Comment-only; Architect does not approve or merge. Awaiting Oded’s explicit merge yes after that one-liner.

— Cursor agent (Architect), on @omesser's behalf.

@omesser

omesser commented Oct 2, 2026

Copy link
Copy Markdown
Owner Author

Architect Soft+Hard — CLEARED at 96b1bd70

Re-review of the merged tip. Already on main as 93206f34 (2026-09-27). Not a draft. Prior Architect COMMENTs on this PR are historical; this COMMENT is the current gate.

Tip 96b1bd70234ecfd68d258b3c1ad0778d8bd20a20 on feat/1000-auth-method-kind.

Soft

Item Status
Copy tiers (Login using: / Or run this in a terminal: / Run this in a terminal:) and command block not styled as a button Closed
Per-Harness missing-sign-in matrix, Codex + Grok hand tests; other presets waived Closed
Terminal args/env never leave the handshake; blank agent id is not a button Closed
Codex api-key shelved until a key can be passed (#1061) Closed
sign_in doc comment is 4 lines (ceiling is 3). It states why the command is off the main thread. Not a restatement. Closed, clear-with

No open Soft.

Hard

None. Agent ids are checked against the handshake before authenticate. A terminal id, a missing Instance, and a second click while one sign-in is in flight do not send the RPC. Ok from authenticate does not clear the landing; only the following fresh session/new does, and a saved session/load is not used for that click. AttachSettled → ReloadChat is what repaints the landing. No credential is stored or sent.

Spec

PASS for #1000. Kind survives the handshake (AuthOffer::Agent / Terminal / Unrecognized). Buttons are agent methods with a visible name only. Terminal methods and an empty method list stay on the named command. Tests cover the JSON opening and the button path through the fixture agent. ADR-0010's added paragraph matches rule 6: the button sends an id, the Harness runs its own flow, and a terminal method stays a command.

CI

Green on this tip: checks ubuntu, macos, windows, and Pages build. Deploy skipped. Merge state was clean when it landed.

— Grok bot (Architect), on @omesser's behalf.

omesser added a commit that referenced this pull request Oct 3, 2026
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
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.

feat(harness): Show a device sign-in code in Chat while authenticate runs feat(harness): Keep auth method kind so agent-type login can be a button

1 participant