Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(agents): a stale Claude OAuth token no longer locks the Max login out
Ruben Lütke9b09c6e49a9e
diff --git a/jarvis/claude_auth.py b/jarvis/claude_auth.pyindex 8ed325c8a1..ad8adbd2a6 100644--- a/jarvis/claude_auth.py+++ b/jarvis/claude_auth.py@@ -345,7 +345,11 @@ class ClaudeAuthService:if oauth_expired:# Honest expired-state (2026-07-06): the bearer exists but died in# place — presence-only reporting showed a green "Connected via- # Claude Max" card while every subagent spawn 401'd.+ # Claude Max" card while every subagent spawn 401'd. The ADVICE+ # matters though: a stale ACCESS token refreshes automatically the+ # next time `claude` runs — a full re-login is only needed when+ # that refresh fails (Windows test-machine confusion 2026-07-18:+ # a logged-in Max user was told to sign in again).log.info("claude status: installed=True connected=False (subscription ""login expired)"@@ -355,8 +359,10 @@ class ClaudeAuthService:connected=False,mode="unknown",message=(- "Claude subscription login has expired — run 'claude /login' "- "to sign in again, or add an Anthropic API key."+ "Claude login token has expired — it refreshes itself the "+ "next time claude runs: open a terminal and run 'claude' "+ "once (only if that fails, sign in again via "+ "'claude /login' or add an Anthropic API key)."),version=version,subscription_type=sub_type,diff --git a/jarvis/ui/web/server.py b/jarvis/ui/web/server.pyindex 24b193d6c8..575e3a3dab 100644--- a/jarvis/ui/web/server.py+++ b/jarvis/ui/web/server.py@@ -978,19 +978,28 @@ class WebServer:shared_key_set = Falseapi_key_set = dedicated_key_set or shared_key_setoauth_connected = False+ oauth_stale = False# Claude Max users authenticate the subagent via the LIVE OAuth# login in ~/.claude/.credentials.json (read by ClaudeDirectWorker),# not a stored API key — count that as configured so a fresh# Claude-Max user (only ran `claude login`) is not falsely locked.+ # An EXPIRED-in-place access token still counts as a configured+ # login: `claude` refreshes it automatically the next time it+ # runs, so locking the card would tell a logged-in Max user+ # "not connected" (Windows test-machine report 2026-07-18). The+ # spawn-time viability gate keeps re-reading the live file.if mapping.jarvis == "claude-api":try:- from jarvis.missions.isolation.env import (- read_live_claude_oauth_token,+ from jarvis.claude_credentials import (+ freshest_claude_oauth,)- oauth_connected = bool(read_live_claude_oauth_token())+ snapshot_status = freshest_claude_oauth().status+ oauth_connected = snapshot_status == "valid"+ oauth_stale = snapshot_status == "expired"except Exception: # noqa: BLE001oauth_connected = False+ oauth_stale = False# claude-api is dual-billed like Codex/Antigravity: the Claude Max# subscription (claude CLI OAuth login) OR an Anthropic API key.# Every other MAPPINGS provider bills per token on an API account.@@ -1006,7 +1015,7 @@ class WebServer:else "legacy_shared"if shared_key_setelse "oauth"- if oauth_connected+ if oauth_connected or oauth_staleelse "none")mapping_rows.append(@@ -1015,11 +1024,12 @@ class WebServer:"worker_slug": mapping.worker_slug,"env_var": mapping.env_var,"env_fallback": mapping.env_fallback,- "key_set": api_key_set or oauth_connected,+ "key_set": api_key_set or oauth_connected or oauth_stale,"api_key_set": api_key_set,"dedicated_key_set": dedicated_key_set,"shared_key_set": shared_key_set,"oauth_connected": oauth_connected,+ "oauth_stale": oauth_stale,"credential_source": credential_source,"secret_key": secret_key,"dashboard_url": spec.dashboard_url if spec else None,diff --git a/tests/integration/test_jarvis_agent_active_brain.py b/tests/integration/test_jarvis_agent_active_brain.pyindex 5f09665b13..955c8ccb1a 100644--- a/tests/integration/test_jarvis_agent_active_brain.py+++ b/tests/integration/test_jarvis_agent_active_brain.py@@ -392,18 +392,43 @@ def test_claude_api_row_key_set_via_max_oauth(monkeypatch: pytest.MonkeyPatch) -assert row["key_set"] is True+def _patch_claude_oauth(monkeypatch: pytest.MonkeyPatch, status: str) -> None:+ """Stub the freshest-login snapshot the claude-api row reads."""+ from types import SimpleNamespace++ monkeypatch.setattr(+ "jarvis.claude_credentials.freshest_claude_oauth",+ lambda **_k: SimpleNamespace(status=status),+ )++def test_claude_api_row_locked_without_key_or_oauth(monkeypatch: pytest.MonkeyPatch) -> None:import jarvis.core.config as cfg_modmonkeypatch.setattr(cfg_mod, "get_secret", lambda *_a, **_k: None)- monkeypatch.setattr(- "jarvis.missions.isolation.env.read_live_claude_oauth_token", lambda: None- )+ _patch_claude_oauth(monkeypatch, "absent")cfg = load_config()row = next(r for r in _status(cfg)["mapping"] if r["jarvis"] == "claude-api")assert row["key_set"] is False+def test_claude_api_row_stays_configured_on_a_stale_oauth_token(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ """An EXPIRED-in-place access token is a login that `claude` refreshes on+ its next run — the card must stay selectable instead of telling a+ logged-in Max user "not connected" (Windows test-machine 2026-07-18)."""+ import jarvis.core.config as cfg_mod++ monkeypatch.setattr(cfg_mod, "get_secret", lambda *_a, **_k: None)+ _patch_claude_oauth(monkeypatch, "expired")+ cfg = load_config()+ row = next(r for r in _status(cfg)["mapping"] if r["jarvis"] == "claude-api")+ assert row["key_set"] is True+ assert row["oauth_stale"] is True+ assert row["oauth_connected"] is False++def test_subagent_switch_accepts_claude_max_oauth(monkeypatch: pytest.MonkeyPatch) -> None:"""OAuth login present, no API key -> claude-api selectable as subagent."""import jarvis.core.config as cfg_mod