Skip to content

fix: recover Claude native login without Gateway restart - #172471

Merged
obviyus merged 11 commits into
mainfrom
fix/claude-native-auth-owner
Oct 14, 2026
Merged

obviyus merged 11 commits into
mainfrom
fix/claude-native-auth-owner

Conversation

@obviyus

@obviyus obviyus commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes native Claude spawns staying blocked after a failed login capture even when the user signs in again, without restarting the Gateway. A timeout or malformed auth-status response also incorrectly counted as a logout.

User Impact

The next spawn after login recovery rechecks authentication and can run immediately. Only an explicit loggedIn: false from claude auth status --json blocks the native route; timeout, command failure, and malformed responses remain inconclusive and let Claude try the request.

Claude still owns login and token refresh. No token storage is read or copied. There are no UI, setup-flow, metadata-observer, or native-status transport changes.

Why This Change Was Made

The existing provider-discovery capture now expires after 60 seconds. Admission awaits the existing native-login recheck and rematerializes its auth fact. The CLI-runtime evaluator retains native-route provenance even when authentication is missing, so both direct CLI selections and provider aliases reach that recheck.

Evidence

The base and candidate ran as isolated gui/501 LaunchAgents with the login Keychain. A PATH shim intercepted only claude auth status; all inference calls used the real Claude executable.

  • Base 46ed68fb425d: a real child first replied OK. After explicit missing-login injection, restoring the real status command without a restart left both the immediate and 65-second-later spawn refused. No fresh status probe occurred (gui-base-shim/: healthy.json, missing-initial.json, recovered-immediate.json, recovered-expired.json, probes.log).
  • Candidate a2326dac1d66: explicit missing login refused the spawn with the existing “Restore that account before spawning this model” message. Switching to real status without a restart caused the next spawn to re-probe, be admitted, and complete a real Claude turn with OK. A status shim sleeping 12 seconds also admitted the spawn as inconclusive, and the real child replied OK (gui-candidate-final/: summary.json, missing-initial.json, recovered-next.json, timeout.json, probes.log). Both probe contexts reported Aqua; the isolated profile was torn down.

Redacted Gateway responses, completed turns, and probe logs are available for inspection.

  • Earlier SSH-session observations were invalid for this defect because that background session had a different Keychain search list.
  • 105 focused tests passed across model-runtime-choice, native-choice, model-auth-availability, provider-discovery, and CLI auth status. One candidate build passed.
  • Final head 4515d276fcbb only adds explicit ignored-promise/undefined syntax and aligns existing plugin and model-list tests with the native-auth policy and route identity. It preserves the GUI-tested execution behavior. Its 55 focused tests and type-aware lint passed; the bounded candidate review found no actionable defects.
  • Against the PR base: production +59/-28 (net +31); tests +110/-11 (net +99); docs +6/-5 (net +1). The superseded broader implementation and dependent draft are no longer in scope.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts commands Command implementations agents Agent runtime and tooling extensions: anthropic size: XL labels Oct 14, 2026
@obviyus
obviyus marked this pull request as ready for review October 14, 2026 20:06
@clawsweeper

clawsweeper Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment @clawsweeper review. Please avoid repeated requests while a review is queued or running; agents should not request reviews automatically.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 4515d276fcbb7d68a984845f648645552cfdfb63
  • Maintainer: @obviyus
  • Repository role: admin

These security sensitive 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.
  • src/agents/prepared-model-runtime.catalog-auth.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@obviyus

obviyus commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

@openclaw-barnacle openclaw-barnacle Bot removed the scripts Repository scripts label Oct 14, 2026
@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 14, 2026
@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR refreshes unavailable native Claude login before spawn admission and lets Claude handle authentication when status probes are inconclusive.

Example: A Gateway captures missing Claude login, then the user signs in again.

  • Before: The next spawn remains refused, including after 65 seconds, until the Gateway restarts.
  • After: The next spawn rechecks login and completes a real Claude turn with the reply “OK”.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused owner-level repair with shipped-entry-point recovery evidence, preserved authentication boundaries, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): Published redacted sessions_spawn responses, agent.wait results, and probe logs exercise isolated macOS Gateways with real Claude inference: explicit logout is refused, restored login succeeds on the next spawn without restart, and a timed-out status probe permits a successful turn; inspection confirms subsequent commits preserve that behavior.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Native Claude spawns remain unavailable after login recovers, and inconclusive status checks can block an otherwise working native login.
Reason: The maintainer-authored direction addresses a demonstrated execution failure with a focused repair and real inference evidence.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR fixes a demonstrated native Claude spawn failure that remains on current main, with no actionable defects found.

Priority: P1
Reviewed head: 4515d276fcbb7d68a984845f648645552cfdfb63

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A base-versus-head run of the new automated regressions is not supplied; the real Gateway comparison demonstrates the reported failure and recovery.
Agent review details

How this fits together

The Anthropic plugin observes Claude CLI login, the prepared catalog owns published availability, and model-choice admission consumes those facts before dispatching execution to Claude.

flowchart LR
  A[Spawn request] --> B[Model choice admission]
  B --> C[Prepared catalog owner]
  C --> D[Anthropic login discovery]
  D --> E[Claude auth status]
  E --> C
  C --> B
  B --> F[Claude CLI execution]
Loading

Technical review

Best possible solution:

Land the recovery through the existing catalog owner while retaining Claude’s native authentication and selected-account boundaries.

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

The supplied real-Gateway comparison demonstrates the failure, and current main retains the same responsible code; this read-only review executed no target code.

Is this the best way to solve the issue?

The patch repairs stale admission facts at their existing owner, preserves route identity, and distinguishes confirmed logout from an inconclusive observation without introducing another authentication owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Native authentication and readiness interpretation changes intended behavior with a stated reason (750a64e: Claude must own its login and single-use refresh-token family; later availability work required a positive probe. This PR explains and demonstrates why an inconclusive observation should defer authentication to Claude.)
  • Shared native-login captures changes intended behavior with a stated reason (d40d26a: Sharing an observation across workspaces prevented repeated startup subprocesses for large agent rosters. The patch retains sharing and cancellation scope while bounding stale captures.)
  • Catalog-owned login rechecks keeps the original intent (0a5311b: Native availability rechecks reuse prepared ambient credentials and current owner-held profiles without catalog-worker reconstruction; the patch makes that same operation awaitable and forceable.)
  • Native model-choice renewal keeps the original intent (cf91c614b29ce76dadabb35c0ea18a36b7f717: Unavailable native readiness is renewed through the catalog owner and admission is re-evaluated; this PR supplies missing CLI route provenance and refreshes login before that existing renewal.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit f215c40 adds src/agents/prepared-model-runtime.catalog-auth.ts:479 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f215c401e69a; files: src/agents/prepared-model-runtime.catalog-auth.ts)
  • Peter Steinberger: Raw commit 0a5311b adds src/agents/prepared-model-runtime.catalog-auth.ts:490 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0a5311bc95c2; files: src/agents/prepared-model-runtime.catalog-auth.ts)

PR surface

Source +31, Tests +99, Docs +1. Total +131 across 16 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 9 59 28 +31
Tests 6 110 11 +99
Docs 1 6 5 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 175 44 +131

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +59/-28; tests +110/-11 The production growth supports expiry and awaitable recovery within existing owners; tests cover response classification, capture expiry, recovery admission, and route identity.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P1: A recovered native Claude login can still leave real subagent spawns blocked until Gateway restart.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-14T20:28:48.469Z sha c3a6734 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-14T21:01:16.107Z sha a2326da :: needs maintainer review before merge. :: none

Reviewed October 14, 2026, 5:33 PM ET / 21:33 UTC (Revision 3).

@obviyus obviyus changed the title fix(anthropic): keep working native Claude logins usable fix: recover Claude native login without Gateway restart Oct 14, 2026
@obviyus

obviyus commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Oct 14, 2026
@obviyus

obviyus commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

Redacted execution evidence for the base and final candidate. These are selected fields from the saved sessions_spawn responses and agent.wait results, plus the auth-status probe logs; model/session identifiers are omitted. Both Gateways were isolated gui/501 LaunchAgents, and the probe reported Aqua. The shim intercepted only claude auth status; all inference used the real Claude executable.

The missing → real transition did not restart the Gateway. The timeout case used a 12-second sleep before delegating to the real status command. Both successful candidate children completed a real turn with OK.

{
  "base": {
    "head": "46ed68fb425dcee69647e8a5d32c4a22259a54c7",
    "context": "gui/501 (Aqua)",
    "healthy": {
      "spawnStatus": "accepted",
      "waitStatus": "ok",
      "terminalReply": "OK"
    },
    "missing-initial": {
      "spawnStatus": "error",
      "message": "The selected account or native runtime is unavailable for [model]. Restore that account before spawning this model."
    },
    "recovered-immediate": {
      "spawnStatus": "error",
      "message": "The selected account or native runtime is unavailable for [model]. Restore that account before spawning this model."
    },
    "recovered-expired": {
      "spawnStatus": "error",
      "message": "The selected account or native runtime is unavailable for [model]. Restore that account before spawning this model."
    },
    "probeLog": [
      "2026-10-14T20:34:14Z missing",
      "2026-10-14T20:34:14Z missing",
      "2026-10-14T20:34:15Z missing"
    ]
  },
  "candidate": {
    "head": "a2326dac1d663e892640ff30a202acd2bac00307",
    "context": "gui/501 (Aqua)",
    "missing-initial": {
      "spawnStatus": "error",
      "message": "The selected account or native runtime is unavailable for [model]. Restore that account before spawning this model."
    },
    "recovered-next": {
      "spawnStatus": "accepted",
      "waitStatus": "ok",
      "terminalReply": "OK"
    },
    "timeout": {
      "spawnStatus": "accepted",
      "waitStatus": "ok",
      "terminalReply": "OK"
    },
    "probeLog": [
      "2026-10-14T20:52:41Z missing",
      "2026-10-14T20:52:41Z missing",
      "2026-10-14T20:52:41Z missing",
      "2026-10-14T20:52:42Z real",
      "2026-10-14T20:52:43Z real",
      "2026-10-14T20:53:57Z timeout",
      "2026-10-14T20:54:07Z timeout",
      "2026-10-14T20:54:18Z timeout"
    ]
  }
}

@openclaw-barnacle openclaw-barnacle Bot added size: M and removed app: web-ui App: web-ui commands Command implementations size: XL labels Oct 14, 2026
@obviyus

obviyus commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 14, 2026
@obviyus
obviyus merged commit 6f53333 into main Oct 14, 2026
133 checks passed
@obviyus
obviyus deleted the fix/claude-native-auth-owner branch October 14, 2026 22:19
@obviyus

obviyus commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in 6f53333. Native Claude login recovery now rechecks the existing auth owner before spawn admission; explicit logout still blocks, and inconclusive probes defer authentication to Claude. The isolated gui/501 comparison covers missing → recovery without restart and a 12-second timeout, including real Claude replies. Exact-head CI is green and ClawSweeper is ready. Redacted execution evidence: #172471 (comment). Thanks to everyone who reported and helped narrow this recovery failure.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
…2471)

## What Problem This Solves

Fixes native Claude spawns staying blocked after a failed login capture even when the user signs in again, without restarting the Gateway. A timeout or malformed auth-status response also incorrectly counted as a logout.

## User Impact

The next spawn after login recovery rechecks authentication and can run immediately. Only an explicit `loggedIn: false` from `claude auth status --json` blocks the native route; timeout, command failure, and malformed responses remain inconclusive and let Claude try the request.

Claude still owns login and token refresh. No token storage is read or copied. There are no UI, setup-flow, metadata-observer, or native-status transport changes.

## Why This Change Was Made

The existing provider-discovery capture now expires after 60 seconds. Admission awaits the existing native-login recheck and rematerializes its auth fact. The CLI-runtime evaluator retains native-route provenance even when authentication is missing, so both direct CLI selections and provider aliases reach that recheck.

## Evidence

The base and candidate ran as isolated `gui/501` LaunchAgents with the login Keychain. A PATH shim intercepted only `claude auth status`; all inference calls used the real Claude executable.

- **Base `5c5b6e9020cd`:** a real child first replied `OK`. After explicit missing-login injection, restoring the real status command without a restart left both the immediate and 65-second-later spawn refused. No fresh status probe occurred (`gui-base-shim/`: `healthy.json`, `missing-initial.json`, `recovered-immediate.json`, `recovered-expired.json`, `probes.log`).
- **Candidate `a2326dac1d66`:** explicit missing login refused the spawn with the existing “Restore that account before spawning this model” message. Switching to real status without a restart caused the next spawn to re-probe, be admitted, and complete a real Claude turn with `OK`. A status shim sleeping 12 seconds also admitted the spawn as inconclusive, and the real child replied `OK` (`gui-candidate-final/`: `summary.json`, `missing-initial.json`, `recovered-next.json`, `timeout.json`, `probes.log`). Both probe contexts reported `Aqua`; the isolated profile was torn down.

Redacted [Gateway responses, completed turns, and probe logs](openclaw#172471 (comment)) are available for inspection.

- Earlier SSH-session observations were invalid for this defect because that background session had a different Keychain search list.
- 105 focused tests passed across model-runtime-choice, native-choice, model-auth-availability, provider-discovery, and CLI auth status. One candidate build passed.
- Final head `4515d276fcbb` only adds explicit ignored-promise/undefined syntax and aligns existing plugin and model-list tests with the native-auth policy and route identity. It preserves the GUI-tested execution behavior. Its 55 focused tests and type-aware lint passed; the bounded candidate review found no actionable defects.
- Against the PR base: production **+59/-28 (net +31)**; tests **+110/-11 (net +99)**; docs **+6/-5 (net +1)**. The superseded broader implementation and dependent draft are no longer in scope.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: anthropic gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. security-sensitive-changed size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant