carlos / platform Public

carlos auth login: print the approval link; --no-wait and --wait

Print the ?code= link (ruling R1) with the code to check against the page.
--no-wait saves a pending login beside the credentials file; --wait finishes
it against the console recorded there. Agents get a Claude Code label.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 745a7deaa87b1393d0bb5f90610156298cfedc62 parent b5d10bf
4 files changed, +406 −59
  • auth.go +122 −52
  • auth_test.go +4 −7
  • authpending.go +90 −0
  • authpending_test.go +190 −0

Intent

Human

<task-notification> <task-id>ad6dab661bcaaa983</task-id> <tool-use-id>toolu_01DgPCRN92wQXCXX3xQetNt6</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/a1de5273-c148-49b8-8267-3dee9d49c9c1/tasks/ad6dab661bcaaa983.output</output-file> <status>completed</status> <summary>Agent "Implement Task 3: approved page" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: DONE (fix round 1) Commit: b5d10bf7 "console: approval page links to agents and terminals". `git commit` printed a `packed-refs.lock` error again, but the commit landed. Tests: `go test ./internal/console -run 'TestCLI' -count=1` passes. gofmt and `go vet` are clean. Change: the approval page's settings link now renders `cli.settings_link` ("agents and terminals") with `href="/settings"`. I added an assertion to `TestCLIApprovalPageResolvesTheLinkCode` that the link is present and "command-line access" is gone. The decided page is unchanged. I did not run the new assertion against the old template, so it has no RED run. Concerns: none. Report: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-agent-login-link/.superpowers/sdd/2026-11-07-agent-login-link/task-3-report.md (fix report appended; the file is untracked, so it isn't in the commit).</result> <usage><subagent_tokens>56246</subagent_tokens><tool_uses>2</tool_uses><duration_ms>57146</duration_ms></usage> </task-notification>

Attributed to this commit: 32.1 g CO₂e (4,085,992 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-agent-login-link, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/auth.go b/auth.go
index a721fa7bf..b428c5b07 100644
--- a/auth.go
+++ b/auth.go
@@ -697,61 +697,42 @@ func loginConsole(flagValue string) (string, error) {
return normalizeConsole(base)
}
-func authLogin(out io.Writer, args []string) error {
- fs := flag.NewFlagSet("auth login", flag.ContinueOnError)
- fs.SetOutput(out)
- console := consoleOption(fs, "the console to log in to (default: the configured default, else "+defaultConsole+")")
- label := fs.String("label", "", "what to call this terminal on the console (default: user@host)")
- fs.Usage = flagUsage(fs, "")
- if err := fs.Parse(args); err != nil {
- return err
- }
- base, err := loginConsole(*console)
- if err != nil {
- return err
- }
- if *label == "" {
- *label = defaultLabel()
- }
- ctx := context.Background()
- c := newConsoleClient(base, "")
- var start startResponse
- if _, err := c.do(ctx, http.MethodPost, "/auth/cli/start", map[string]string{"label": *label}, &start); err != nil {
- return fmt.Errorf("starting the login at %s: %w", base, err)
- }
- if start.DeviceCode == "" || start.UserCode == "" {
- return fmt.Errorf("%s did not return a login code — is that a CARLOS console?", base)
+// Copy for the login screen. Plain words, no dashes.
+const (
+ loginOpenLink = "Open this link to approve this login:"
+ loginCheckCode = "The page will show the code %s. Approve only if it matches."
+)
+
+// agentLabel names a terminal that is an AI agent, so the approval page and
+// the token list say what asked rather than user@host. CLAUDECODE=1 is set by
+// Claude Code in every command it runs.
+func agentLabel(env func(string) string, fallback string) string {
+ if env("CLAUDECODE") != "1" {
+ return fallback
}
- // The BARE verification URI plus the code, never the ready-made
- // ?code=… link, even though the console offers one.
- //
- // A link that lands one click from an Approve button is the whole
- // device-code phishing attack: an attacker starts this flow, sends you
- // their link, and one click hands them a 90-day credential that acts as
- // you. The console refuses to approve from a prefilled code for that
- // reason, and printing the complete URL here would teach people that
- // following such a link is the normal way to do this — which is exactly
- // the habit the attack needs. Type the code.
- link := start.VerifyURI
- if link == "" {
- link = base + "/auth/cli"
+ host, err := os.Hostname()
+ if err != nil || host == "" {
+ host = "unknown-host"
}
- // Printed, never opened: this frequently runs over SSH, where opening a
- // browser would open it on the wrong machine.
- pal := colorFor(out)
- fmt.Fprintf(out, "\nOpen this in a browser signed in to %s:\n\n %s\n\n", base, pal.link(link))
- // The code is the one thing here a person has to read off the screen and
- // type somewhere else, so it is the one thing given weight.
- fmt.Fprintf(out, "and type this code:\n\n %s\n\n", pal.head(start.UserCode))
- mutedf(out, "Waiting for approval (this code expires in %d minutes)…", start.ExpiresIn/60)
+ return "Claude Code on " + host
+}
- deadline := loginDeadline(time.Now(), start.ExpiresIn)
- wait := pollWait(start.Interval)
+// terminalLoginError marks a poll outcome after which the login can never be
+// approved (denied, expired, unknown), as opposed to a failure worth retrying.
+type terminalLoginError struct{ error }
+
+func (e terminalLoginError) Unwrap() error { return e.error }
+
+// pollLogin waits for the console to approve deviceCode and stores the
+// credential. Terminal outcomes come back as terminalLoginError.
+func pollLogin(ctx context.Context, c *consoleClient, base, deviceCode, label string, interval int, deadline time.Time, out io.Writer) error {
+ pal := colorFor(out)
+ wait := pollWait(interval)
for time.Now().Before(deadline) {
time.Sleep(wait)
var poll pollResponse
if _, err := c.do(ctx, http.MethodPost, "/auth/cli/poll",
- map[string]string{"device_code": start.DeviceCode}, &poll); err != nil {
+ map[string]string{"device_code": deviceCode}, &poll); err != nil {
// A hiccup mid-poll is not a failed login: keep waiting, the
// human is mid-approval.
continue
@@ -763,11 +744,11 @@ func authLogin(out io.Writer, args []string) error {
case "pending":
continue
case "denied":
- return errors.New("the console says that login was denied — nothing was issued")
+ return terminalLoginError{errors.New("the console says that login was denied — nothing was issued")}
case "expired":
- return errors.New("that login code expired before it was approved — run this again")
+ return terminalLoginError{errors.New("that login code expired before it was approved — run this again")}
case "unknown":
- return errors.New("the console does not recognise this login — run this again")
+ return terminalLoginError{errors.New("the console does not recognise this login — run this again")}
case "approved":
if poll.Token == "" {
return errors.New("the console approved the login but returned no token")
@@ -784,7 +765,7 @@ func authLogin(out io.Writer, args []string) error {
return err
}
f.put(credential{Console: base, Address: poll.Address, Token: poll.Token,
- Label: *label, CreatedAt: now, ExpiresAt: expires})
+ Label: label, CreatedAt: now, ExpiresAt: expires})
if err := f.save(); err != nil {
return fmt.Errorf("storing the credential: %w", err)
}
@@ -806,6 +787,95 @@ func authLogin(out io.Writer, args []string) error {
return errors.New("gave up waiting for approval — run this again when you're at a browser")
}
+func authLogin(out io.Writer, args []string) error {
+ fs := flag.NewFlagSet("auth login", flag.ContinueOnError)
+ fs.SetOutput(out)
+ console := consoleOption(fs, "the console to log in to (default: the configured default, else "+defaultConsole+")")
+ label := fs.String("label", "", "what to call this terminal on the console (default: user@host)")
+ noWait := fs.Bool("no-wait", false, "print the approval link and exit; finish with --wait (for agents that only see output when a command ends)")
+ wait := fs.Bool("wait", false, "finish a login started with --no-wait")
+ fs.Usage = flagUsage(fs, "")
+ if err := fs.Parse(args); err != nil {
+ return err
+ }
+ if *noWait && *wait {
+ return errors.New("--no-wait and --wait cannot be used together")
+ }
+ ctx := context.Background()
+ if *wait {
+ p, err := loadPendingLogin()
+ if err != nil {
+ return err
+ }
+ if p == nil {
+ return errors.New("no login waiting: run carlos auth login --no-wait first")
+ }
+ // The console comes from the file, not -console or the defaults: the
+ // code in it only means something there.
+ deadline := loginDeadline(time.Now(), int(time.Until(p.ExpiresAt).Seconds()))
+ if p.ExpiresAt.IsZero() {
+ deadline = loginDeadline(time.Now(), 0)
+ }
+ err = pollLogin(ctx, newConsoleClient(p.Console, ""), p.Console, p.DeviceCode, p.Label, p.Interval, deadline, out)
+ var term terminalLoginError
+ if err == nil || errors.As(err, &term) {
+ if cerr := clearPendingLoginIf(p.DeviceCode); cerr != nil {
+ warnf(out, "Could not remove %s: %v", pendingLoginPath(), cerr)
+ }
+ }
+ return err
+ }
+ base, err := loginConsole(*console)
+ if err != nil {
+ return err
+ }
+ if *label == "" {
+ *label = agentLabel(os.Getenv, defaultLabel())
+ }
+ c := newConsoleClient(base, "")
+ var start startResponse
+ if _, err := c.do(ctx, http.MethodPost, "/auth/cli/start", map[string]string{"label": *label}, &start); err != nil {
+ return fmt.Errorf("starting the login at %s: %w", base, err)
+ }
+ if start.DeviceCode == "" || start.UserCode == "" {
+ return fmt.Errorf("%s did not return a login code — is that a CARLOS console?", base)
+ }
+ // The ready-made ?code= link is printed (Paul's ruling R1). Typing a code
+ // into a bare page is no help to an agent, whose human often reads the
+ // link out of a transcript, and the link is only a convenience: it
+ // approves nothing by itself. The controls that remain are on the
+ // console. The page shows the code, to be checked against this screen,
+ // and says what is asking. Approving needs a signed-in session plus a
+ // step-up on the Approve button. The account owner gets an email when a
+ // credential is issued, with a "That wasn't me" link that revokes it. And
+ // the code lapses after 10 minutes.
+ link := start.VerifyURIFull
+ if link == "" {
+ link = start.VerifyURI
+ }
+ if link == "" {
+ link = base + "/auth/cli"
+ }
+ // Printed, never opened: this frequently runs over SSH, where opening a
+ // browser would open it on the wrong machine.
+ pal := colorFor(out)
+ fmt.Fprintf(out, "\n%s\n\n %s\n\n", loginOpenLink, pal.link(link))
+ // The code is the one thing a person compares against the page, so it is
+ // the one thing given weight.
+ fmt.Fprintf(out, loginCheckCode+"\n\n", pal.head(start.UserCode))
+ deadline := loginDeadline(time.Now(), start.ExpiresIn)
+ if *noWait {
+ if err := savePendingLogin(pendingLogin{Console: base, DeviceCode: start.DeviceCode,
+ UserCode: start.UserCode, Label: *label, ExpiresAt: deadline, Interval: start.Interval}); err != nil {
+ return fmt.Errorf("saving the pending login: %w", err)
+ }
+ mutedf(out, "Once it is approved, run: carlos auth login --wait")
+ return nil
+ }
+ mutedf(out, "Waiting for approval (this code expires in %d minutes)…", start.ExpiresIn/60)
+ return pollLogin(ctx, c, base, start.DeviceCode, *label, start.Interval, deadline, out)
+}
+
func authWhoami(out io.Writer, args []string) error {
fs := flag.NewFlagSet("auth whoami", flag.ContinueOnError)
fs.SetOutput(out)
diff --git a/auth_test.go b/auth_test.go
index b15d338bb..a6878f1f3 100644
--- a/auth_test.go
+++ b/auth_test.go
@@ -289,17 +289,14 @@ func TestAuthLoginStoresACredential(t *testing.T) {
if err := authLogin(&out, []string{"-console", fc.ts.URL, "-label", "paul@laptop"}); err != nil {
t.Fatalf("authLogin: %v\n%s", err, out.String())
}
- // The human is told where to go and what to TYPE — that IS the flow.
- for _, want := range []string{fc.ts.URL + "/auth/cli", "type this code", "WXYZ-4823", "paul@keymail.dev"} {
+ // The human is given the approval link and the code to check against it.
+ for _, want := range []string{fc.ts.URL + "/auth/cli?code=WXYZ-4823", "WXYZ-4823", "paul@keymail.dev"} {
if !strings.Contains(out.String(), want) {
t.Fatalf("login output missing %q:\n%s", want, out.String())
}
}
- // And never the ready-made ?code= link. Printing that would teach people
- // that following a link somebody sent them is how this works, which is
- // precisely the habit device-code phishing needs.
- if strings.Contains(out.String(), "?code=") {
- t.Fatalf("login printed a one-click approval link:\n%s", out.String())
+ if strings.Contains(out.String(), "type this code") {
+ t.Fatalf("login still asks to type the code:\n%s", out.String())
}
if got, _ := fc.label.Load().(string); got != "paul@laptop" {
t.Fatalf("label sent = %q, want paul@laptop", got)
diff --git a/authpending.go b/authpending.go
new file mode 100644
index 000000000..b781645af
--- /dev/null
+++ b/authpending.go
@@ -0,0 +1,90 @@
+package main
+
+import (
+ "encoding/json"
+ "errors"
+ "os"
+ "path/filepath"
+ "time"
+)
+
+// pendingLogin is a login started with --no-wait and not yet finished. It
+// records the console it was started against so --wait goes back to the same
+// place whatever -console or the defaults say by then.
+type pendingLogin struct {
+ Console string `json:"console"`
+ DeviceCode string `json:"device_code"`
+ UserCode string `json:"user_code"`
+ Label string `json:"label"`
+ ExpiresAt time.Time `json:"expires_at"`
+ Interval int `json:"interval"`
+}
+
+// pendingLoginPath sits beside the credentials file, so one override
+// (CARLOS_CREDENTIALS) moves both.
+func pendingLoginPath() string {
+ return filepath.Join(filepath.Dir(credentialsPath()), "login-pending")
+}
+
+// savePendingLogin replaces the file, 0600, through a temp file in the same
+// directory. The device code is a secret until the login is claimed.
+func savePendingLogin(p pendingLogin) error {
+ path := pendingLoginPath()
+ dir := filepath.Dir(path)
+ if err := os.MkdirAll(dir, 0o700); err != nil {
+ return err
+ }
+ body, err := json.MarshalIndent(p, "", " ")
+ if err != nil {
+ return err
+ }
+ body = append(body, '\n')
+ tmp, err := os.CreateTemp(dir, ".login-pending-*")
+ if err != nil {
+ return err
+ }
+ defer os.Remove(tmp.Name())
+ if err := tmp.Chmod(0o600); err != nil {
+ tmp.Close()
+ return err
+ }
+ if _, err := tmp.Write(body); err != nil {
+ tmp.Close()
+ return err
+ }
+ if err := tmp.Close(); err != nil {
+ return err
+ }
+ return os.Rename(tmp.Name(), path)
+}
+
+// loadPendingLogin returns nil, nil when no login is waiting.
+func loadPendingLogin() (*pendingLogin, error) {
+ raw, err := os.ReadFile(pendingLoginPath())
+ if errors.Is(err, os.ErrNotExist) {
+ return nil, nil
+ }
+ if err != nil {
+ return nil, err
+ }
+ var p pendingLogin
+ if err := json.Unmarshal(raw, &p); err != nil {
+ return nil, errors.New(pendingLoginPath() + " is not readable as a pending login; delete it and run carlos auth login --no-wait again")
+ }
+ return &p, nil
+}
+
+// clearPendingLoginIf deletes the file only if it still holds deviceCode, so
+// a --wait that finishes late cannot remove the login a newer --no-wait
+// started. Compare-then-remove, no OS lock: the window is two syscalls wide,
+// and it builds the same on every platform.
+func clearPendingLoginIf(deviceCode string) error {
+ p, err := loadPendingLogin()
+ if err != nil || p == nil || p.DeviceCode != deviceCode {
+ return nil
+ }
+ if err := os.Remove(pendingLoginPath()); err != nil && !errors.Is(err, os.ErrNotExist) {
+ return err
+ }
+ return nil
+}
diff --git a/authpending_test.go b/authpending_test.go
new file mode 100644
index 000000000..52ba69c77
--- /dev/null
+++ b/authpending_test.go
@@ -0,0 +1,190 @@
+package main
+
+import (
+ "bytes"
+ "encoding/json"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "strings"
+ "testing"
+ "time"
+)
+
+func TestPendingLoginNewerSurvivesOlderWait(t *testing.T) {
+ useTempCredentials(t)
+ a := pendingLogin{Console: "https://a.example", DeviceCode: "dev-A", UserCode: "AAAA-1111", ExpiresAt: time.Now().Add(time.Minute)}
+ b := pendingLogin{Console: "https://b.example", DeviceCode: "dev-B", UserCode: "BBBB-2222", ExpiresAt: time.Now().Add(time.Minute)}
+ if err := savePendingLogin(a); err != nil {
+ t.Fatal(err)
+ }
+ if err := savePendingLogin(b); err != nil {
+ t.Fatal(err)
+ }
+ if err := clearPendingLoginIf(a.DeviceCode); err != nil {
+ t.Fatal(err)
+ }
+ got, err := loadPendingLogin()
+ if err != nil || got == nil || got.DeviceCode != "dev-B" {
+ t.Fatalf("after clearing A, pending = %+v, %v; want B kept", got, err)
+ }
+ if err := clearPendingLoginIf("dev-B"); err != nil {
+ t.Fatal(err)
+ }
+ if got, err := loadPendingLogin(); got != nil || err != nil {
+ t.Fatalf("after clearing B, pending = %+v, %v; want nil, nil", got, err)
+ }
+ // Clearing when nothing is there is not an error.
+ if err := clearPendingLoginIf("dev-B"); err != nil {
+ t.Fatal(err)
+ }
+}
+
+func TestPendingLoginFileMode(t *testing.T) {
+ useTempCredentials(t)
+ if err := savePendingLogin(pendingLogin{Console: "https://a.example", DeviceCode: "d"}); err != nil {
+ t.Fatal(err)
+ }
+ fi, err := os.Stat(pendingLoginPath())
+ if err != nil {
+ t.Fatal(err)
+ }
+ if fi.Mode().Perm() != 0o600 {
+ t.Fatalf("pending mode = %v, want 0600", fi.Mode().Perm())
+ }
+}
+
+func TestAuthLoginNoWaitThenWait(t *testing.T) {
+ useTempCredentials(t)
+ fc := newFakeConsole(t)
+ var out bytes.Buffer
+ if err := authLogin(&out, []string{"-console", fc.ts.URL, "--no-wait"}); err != nil {
+ t.Fatalf("--no-wait: %v\n%s", err, out.String())
+ }
+ if fc.polls.Load() != 0 {
+ t.Fatal("--no-wait polled")
+ }
+ if !strings.Contains(out.String(), fc.ts.URL+"/auth/cli?code=WXYZ-4823") {
+ t.Fatalf("--no-wait did not print the link:\n%s", out.String())
+ }
+ p, err := loadPendingLogin()
+ if err != nil || p == nil || p.Console != fc.ts.URL || p.DeviceCode != "device-secret" || p.UserCode != "WXYZ-4823" {
+ t.Fatalf("pending = %+v, %v", p, err)
+ }
+ if strings.Contains(out.String(), "device-secret") {
+ t.Fatal("printed the device code")
+ }
+
+ out.Reset()
+ // A different -console must be ignored: the pending file names the console.
+ if err := authLogin(&out, []string{"-console", "http://127.0.0.1:1", "--wait"}); err != nil {
+ t.Fatalf("--wait: %v\n%s", err, out.String())
+ }
+ f, _ := loadCredentials()
+ if c := f.find(fc.ts.URL); c == nil || c.Token != "cli-token" {
+ t.Fatalf("stored credential = %+v", c)
+ }
+ if p, _ := loadPendingLogin(); p != nil {
+ t.Fatalf("pending file survived an approved wait: %+v", p)
+ }
+}
+
+func TestAuthLoginPlainNeverTouchesPending(t *testing.T) {
+ useTempCredentials(t)
+ fc := newFakeConsole(t)
+ keep := pendingLogin{Console: "https://a.example", DeviceCode: "dev-keep", ExpiresAt: time.Now().Add(time.Minute)}
+ if err := savePendingLogin(keep); err != nil {
+ t.Fatal(err)
+ }
+ var out bytes.Buffer
+ if err := authLogin(&out, []string{"-console", fc.ts.URL}); err != nil {
+ t.Fatal(err)
+ }
+ if p, _ := loadPendingLogin(); p == nil || p.DeviceCode != "dev-keep" {
+ t.Fatalf("plain login changed the pending file: %+v", p)
+ }
+}
+
+func TestAuthLoginFlagsConflict(t *testing.T) {
+ useTempCredentials(t)
+ var out bytes.Buffer
+ if err := authLogin(&out, []string{"--wait", "--no-wait"}); err == nil {
+ t.Fatal("both flags accepted")
+ }
+}
+
+func TestAuthLoginWaitNoPending(t *testing.T) {
+ useTempCredentials(t)
+ var out bytes.Buffer
+ err := authLogin(&out, []string{"--wait"})
+ if err == nil || !strings.Contains(err.Error(), "no login waiting") {
+ t.Fatalf("--wait with nothing pending = %v", err)
+ }
+}
+
+func TestAuthLoginWaitTerminalStatesClear(t *testing.T) {
+ for _, status := range []string{"denied", "unknown", "expired"} {
+ t.Run(status, func(t *testing.T) {
+ useTempCredentials(t)
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ json.NewEncoder(w).Encode(map[string]any{"status": status, "interval": 0})
+ }))
+ defer ts.Close()
+ if err := savePendingLogin(pendingLogin{Console: ts.URL, DeviceCode: "d1", ExpiresAt: time.Now().Add(time.Minute)}); err != nil {
+ t.Fatal(err)
+ }
+ var out bytes.Buffer
+ if err := authLogin(&out, []string{"--wait"}); err == nil {
+ t.Fatal("want an error")
+ }
+ if p, _ := loadPendingLogin(); p != nil {
+ t.Fatalf("%s left the pending file: %+v", status, p)
+ }
+ })
+ }
+ t.Run("transient keeps", func(t *testing.T) {
+ useTempCredentials(t)
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusBadGateway)
+ }))
+ defer ts.Close()
+ if err := savePendingLogin(pendingLogin{Console: ts.URL, DeviceCode: "d1", ExpiresAt: time.Now().Add(1500 * time.Millisecond)}); err != nil {
+ t.Fatal(err)
+ }
+ var out bytes.Buffer
+ if err := authLogin(&out, []string{"--wait"}); err == nil {
+ t.Fatal("want an error")
+ }
+ if p, _ := loadPendingLogin(); p == nil {
+ t.Fatal("a transient failure removed the pending file")
+ }
+ })
+}
+
+func TestAgentLabel(t *testing.T) {
+ host, _ := os.Hostname()
+ env := func(m map[string]string) func(string) string { return func(k string) string { return m[k] } }
+ if got := agentLabel(env(map[string]string{"CLAUDECODE": "1"}), "me@box"); got != "Claude Code on "+host {
+ t.Fatalf("agent label = %q", got)
+ }
+ if got := agentLabel(env(nil), "me@box"); got != "me@box" {
+ t.Fatalf("plain label = %q", got)
+ }
+
+ useTempCredentials(t)
+ t.Setenv("CLAUDECODE", "1")
+ fc := newFakeConsole(t)
+ var out bytes.Buffer
+ if err := authLogin(&out, []string{"-console", fc.ts.URL, "--no-wait"}); err != nil {
+ t.Fatal(err)
+ }
+ if got, _ := fc.label.Load().(string); got != "Claude Code on "+host {
+ t.Fatalf("sent label = %q", got)
+ }
+ if err := authLogin(&out, []string{"-console", fc.ts.URL, "-label", "mine", "--no-wait"}); err != nil {
+ t.Fatal(err)
+ }
+ if got, _ := fc.label.Load().(string); got != "mine" {
+ t.Fatalf("-label did not win: %q", got)
+ }
+}