feat: link Claude Code OAuth in onboarding#1727
feat: link Claude Code OAuth in onboarding#1727Michaelyklam wants to merge 2 commits intonesquena:masterfrom
Conversation
SummaryPulled the branch and walked the diff ( Cross-repo agent contractReading def resolve_anthropic_token() -> Optional[str]:
# Priority:
# 1. ANTHROPIC_TOKEN env var (OAuth/setup token saved by Hermes)
# 2. CLAUDE_CODE_OAUTH_TOKEN env var
# 3. Claude Code credentials (~/.claude.json or ~/.claude/.credentials.json)
# 4. ANTHROPIC_API_KEY env varSo the WebUI side's Code referenceThe credential-pool marker shape on entries = pool.setdefault("anthropic", [])
# ...
entry = {
"id": "anthropic-claude-code-" + uuid.uuid4().hex[:12],
"label": "Claude Code (linked)",
"auth_type": "oauth",
"priority": 0,
"source": "claude_code_linked",
"created_at": now,
}
entries.insert(0, entry)And the matching readiness check in for entry in entries:
if _oauth_payload_has_token(entry):
return True
if (
provider == "anthropic"
and isinstance(entry, dict)
and entry.get("auth_type") == "oauth"
and entry.get("source") == "claude_code_linked"
):
return TrueTwo things I like here: the marker entry has no token field at all (so a serialized auth.json dump is genuinely secret-free even for the linked case), and DiagnosisA few observations from the diff:
One small concernThe marker dedup loop scans Verification
|
|
Thanks @Michaelyklam — this shipped in v0.51.8 (commit GitHub didn't auto-close because the merge commit only references the squash-merged stage branch, not your fork's commit directly — closing manually for hygiene. Live now on https://get-hermes.ai/ and on existing installs after Release notes: https://github.com/nesquena/hermes-webui/releases/tag/v0.51.8 |
…p + test-isolation fix Constituent PRs: - nesquena#1725 (@Michaelyklam) — simplify compact Activity row summary - nesquena#1726 (@Michaelyklam) — delegate generic provider catalogs to Hermes CLI (slice of nesquena#1240) - nesquena#1727 (@Michaelyklam) — link Claude Code OAuth in onboarding (closes nesquena#1362) - nesquena#1728 (@starship-s) — preserve profile context when starting chats - nesquena#1729 (@Michaelyklam) — persist compact Activity disclosure state - nesquena#1730 (@Michaelyklam) — prevent sticky sidebar hover drag state - nesquena#1732 (@Sanjays2402) — unpin scroll on small upward motion during streaming (closes nesquena#1731) Plus 2 in-stage absorbed fixes: - test-isolation fix: monkeypatch.setattr(config, 'cfg', X) survives PR nesquena#1728's path/mtime-aware get_config() reload. Mandatory before tag (Opus stage-302). - Opus SHOULD-FIX #1: _lastScrollTop reset on session switch (nesquena#1732 follow-up). Tests: 4537 → 4584 passing (+47). 0 regressions. Full suite ~128s. Stably green. Pre-release verification: - All 7 PRs CI-green individually + rebased onto master - pytest 4584 passed, 0 failed (multiple runs) - node -c clean on all 4 modified .js files - 11/11 browser API endpoints PASS on isolated port 8789 - 20 QA tests via webui_qa_agent.sh PASS - Opus advisor: SHIP, 5/5 verification clean, 0 MUST-FIX, 1 SHOULD-FIX absorbed (_lastScrollTop reset), 1 SHOULD-FIX deferred (nesquena#1736 — _clear_anthropic_env_values race, onboarding-time-only) Closes nesquena#1362, nesquena#1731.
Thinking Path
What Changed
/api/onboarding/oauth/start,/poll, and/cancel, normalizinganthropic,claude, andclaude-codeto canonicalanthropic.credential_pool.anthropicmarker storage.ANTHROPIC_TOKEN/ANTHROPIC_API_KEYvalues when linking Claude Code OAuth so env API keys do not override linked OAuth credentials.window.open()or browser-visible tokens.Why It Matters
Claude Code / Claude Pro users no longer have to infer that they must leave the WebUI, authenticate on the host, then manually refresh. The WebUI now offers a guided, server-owned flow that can detect/link host Claude Code credentials while preserving the important safety boundary: tokens and credential paths stay on the server.
Closes #1362.
Verification
env -u HERMES_CONFIG_PATH -u HERMES_WEBUI_HOST /home/michael/.hermes/hermes-agent/venv/bin/python -m pytest tests/test_issue1362_codex_oauth_onboarding.py -q node --check static/onboarding.js env -u HERMES_CONFIG_PATH -u HERMES_WEBUI_HOST /home/michael/.hermes/hermes-agent/venv/bin/python -m pytest tests/test_issue1362_codex_oauth_onboarding.py tests/test_onboarding_mvp.py tests/test_sprint40.py tests/test_issue1202_oauth_provider_status.py -q env -u HERMES_CONFIG_PATH -u HERMES_WEBUI_HOST /home/michael/.hermes/hermes-agent/venv/bin/python -m pytest tests/ -q git diff --cached --check curl -L -s -o /dev/null -w '%{http_code} %{size_download}\n' https://raw.githubusercontent.com/Michaelyklam/hermes-webui/feat/issue-1362-claude-oauth/docs/pr-media/1362/claude-code-onboarding.pngResult:
Manual verification:
NO BLOCKERS.UI media:
Risks / Follow-ups
claude loginorclaude setup-tokenon the WebUI host.Model Used
AI assisted.
gpt-5.5