Skip to content

fix: /model says sign-in needed when Claude CLI is already signed in - #196705

Open
Yun-0000 wants to merge 1 commit into
openclaw:mainfrom
Yun-0000:fix/claude-cli-model-sign-in
Open

Yun-0000 wants to merge 1 commit into
openclaw:mainfrom
Yun-0000:fix/claude-cli-model-sign-in

Conversation

@Yun-0000

@Yun-0000 Yun-0000 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #196694

What Problem This Solves

Fixes: /model says Claude needs a sign-in, and choosing anthropic/* says no runtime is available, when Claude CLI is already signed in and agent turns on that runtime still succeed.

User Impact

A configured claude-cli runtime stays selectable after its native login has been prepared. A signed-out CLI still cannot be selected, and an explicit account that is missing still cannot be selected.

Why This Change Was Made

Model selection looked up the CLI backend without the prepared config or plugin metadata. When that backend was declared only by metadata, and the process had not registered it yet, selection stopped before the prepared native login was checked. The lookup now uses that prepared context. A native profile id by itself is still not treated as a login.

Evidence

Node v24.22.2, pnpm 12.15.0, Vitest 5.0.5. Package 2026.11.2. Base c321c038b59.

The production entry is evaluateRuntimeModelAuth, which /model uses while building the catalog decision. This host has no Claude CLI login, so the proof prepares a native oauth mode and a metadata snapshot that declares claude-cli, with no ambient runtime registration.

Red, before the lookup change:

  • pnpm test src/agents/model-auth-availability.runtime-policy.test.ts --maxWorkers=1 -t "keeps a prepared Claude CLI login"
  • The case took 924ms and failed: availability was false where the prepared login expects true. Vitest duration 68.83s. Command wall 74.83s, including compiler preparation.

Green, head 7276006d754:

  • pnpm test src/agents/model-auth-availability.runtime-policy.test.ts src/agents/model-runtime-choice.native.test.ts src/agents/cli-backends.test.ts --maxWorkers=1
  • 41 passed. The new case took 233ms. The other runtime-policy cases took 243ms and 551ms. Vitest duration 68.36s. Command wall 71.71s, including about 50s of compiler preparation. Signed-out selection stays unavailable, and a missing pinned account stays unavailable.
  • node scripts/run-oxlint.mjs --tsconfig tsconfig.core.json on the three touched source files passed.
  • pnpm exec oxfmt --write on those files, then git diff --check, passed.
  • pnpm check:test-lines-ratchet --base upstream/main --no-merge-base: Test lines OK: 6628762; ceiling: 6628762; slack: 0. Net delta +56. Allocation config/test-lines-allocations/claude-cli-metadata-model-auth.txt is 55, which covers the one line of missing slack on this base.
  • pnpm tsgo:core exited 0.

CI on 7276006d754: changed-file tests, lint, typecheck, guards, and baseline ratchets passed (https://github.com/openclaw/openclaw/actions/runs/42835294043). Dependency review passed. openclaw/security-sensitive-review is still waiting for a maintainer command on this head, and the commit status openclaw/ci-gate fails for that approval rather than a test assertion (https://github.com/openclaw/openclaw/actions/runs/42836980655). Merge-tree against upstream main f5d0c194fcd on 2026-11-11 has no conflicts.

ClawSweeper's review of this head found no code defects. It still asks for a shipped /model listing and selection of a metadata-resolved Claude CLI model with a real prepared login, followed by a successful turn. This host has no signed-in claude binary, so that capture is not available. No re-review was requested.

Not run: a live /model turn against a signed-in claude binary, full pnpm test, and pnpm check.

Release note: /model no longer asks for a Claude sign-in when the Claude CLI login is already prepared.

Model selection resolved the CLI backend without plugin metadata, so a prepared native login was treated as missing.
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Maintainer security review required

This external contributor PR changes sensitive security components. A maintainer must review these changes before merging.

Current SHA: 7276006d754ecf850c61e1703940e85dceb5d95c

These sensitive security changes were made:

  • src/agents/model-auth-availability.cli-runtime.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

After reviewing the changes, post a new PR comment containing only approval commands, each on its own line:

/allow-security-sensitive-change

A later push requires a fresh approval comment.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 10, 2026
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR passes prepared config, environment, and plugin metadata into CLI backend lookup so model selection recognizes an already prepared Claude CLI login.

Example: Claude Code is signed in, anthropic/claude-opus-5-5 is configured for claude-cli, and the backend is available through plugin metadata before runtime registration.

  • Before: /model reports “Sign-in needed” and rejects selection even though agent turns through Claude CLI succeed.
  • After: Model selection recognizes the backend and accepts its prepared native login.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and source-consistent, but the external-PR behavior-proof gate remains unmet.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Users already signed in to Claude Code see sign-in errors and cannot select configured Claude CLI models despite working agent turns.
Reason: The change restores the documented runtime-selection contract without a new setting, default, credential shortcut, or parallel owner.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: this PR narrowly repairs a source-confirmed current-main authentication availability bug, with no actionable code findings.

Priority: P2
Reviewed head: 7276006d754ecf850c61e1703940e85dceb5d95c

Before merge

  • Add real behavior proof - The supplied regression exercises the real auth evaluator with an injected setup resolver and synthetic prepared OAuth facts; it does not exercise the shipped /model flow or a signed-in Claude binary. The reporter's live result used an additional authentication shortcut, so it does not prove this exact patch. Supply redacted terminal output, logs, or a recording of the changed path, removing IPs, API keys, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Await maintainer action - A maintainer must review and approve the security-sensitive change at head 7276006 using the enforced approval command.

Findings

None.

Tests

  • Missing end-to-end proof: Provide a capture from this head showing /model listing and selecting a metadata-resolved Claude CLI model with a real prepared login, followed by a successful turn on that runtime.
Agent review details

How this fits together

The shared model-auth resolver combines configured runtime choices, plugin metadata, and prepared credential facts into availability decisions consumed by model catalogs and model selection.

flowchart TD
  A[Model command or picker] --> B[Shared model auth resolver]
  C[Config and plugin metadata] --> D[CLI backend binding]
  B --> D
  D --> E[Account policy and prepared login]
  E --> F[Model availability decision]
  F --> A
Loading

Technical review

Best possible solution:

Resolve metadata-declared backends through the existing setup owner while preserving prepared-login, plugin-enablement, and explicit-account checks.

Do we have a high-confidence way to reproduce the issue?

Current-main source establishes the missing-context rejection path, supported by the released-version report and the contributor's reported red-before/green-after regression; this review ran no target code.

Is this the best way to solve the issue?

This is a small repair at the existing lookup boundary: it restores context rather than inventing login evidence, and leaves account selection and plugin policy with their current owners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4ec97ef5e73e.

Provenance checked

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

PR surface

Source +14, Tests +56, Other +3. Total +73 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 17 3 +14
Tests 1 56 0 +56
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 3 0 +3
Total 4 76 3 +73

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus regression-test growth Production +17/-3; tests +56/-0 The growth forwards context through existing owners and adds a focused metadata-only regression with signed-out and missing-account controls.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Existing Claude CLI users can run turns but cannot select configured models through /model, a bounded authentication-selection defect.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Capture the shipped /model selection and subsequent Claude CLI turn on this head in the metadata-only backend scenario.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 10, 2026, 9:49 AM ET / 14:49 UTC.

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

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. security-review-required security-sensitive-changed size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

1 participant