Skip to content

fix(auth): wire plugin-home staleAuth into setup verified verdict (v2.2.1, #2) - #13

Merged
tgkim-openerd merged 2 commits into
mainfrom
fix/issue-2-staleauth-verified-wiring
Jun 8, 2026
Merged

tgkim-openerd merged 2 commits into
mainfrom
fix/issue-2-staleauth-verified-wiring

Conversation

@tgkim-openerd

Copy link
Copy Markdown
Collaborator

요약

issue #2 (setup --json 가 verified:true 인데 직후 rescue 가 refresh token already used 로 실패하는 false-positive advisory) 의 fix #1 구현 + v2.2.1 release.

Root cause

plugin v2.0 의 dual-home 분리(buildPluginCodexEnv 가 CODEX_HOME=$HOME/.codex/claude-code/ 주입)로 root ~/.codex/auth.json 와 plugin home auth.json 두 개가 존재. codex login 은 root 만 rotate → plugin home 의 refresh_token 이 stale → 다음 rescue 가 stale token 으로 refresh 강제 → 서버 reuse-detection 401. inspectPluginHomeFreshness() 가 mtime skew(staleAuth)를 이미 계산하지만 verified verdict 에 배선되지 않아 setup 이 계속 green 을 띄움.

변경

  • lib/codex.mjs: 순수 helper computeStaleHomeAuth(advisory, env) (named export + __testHooks). home pin(CODEX_PLUGIN_USE_DEFAULT_HOME=1 / explicit CODEX_HOME) 시엔 dual-home 자체가 없어 무강등.
  • codex-companion.mjs buildSetupReport: stale & unpinned 시 auth.verified=false + ready=false, staleHomeAuth/verificationNote 필드 추가 (additive only — 기존 loggedIn/verified shape 보존, fixture parity 유지).
  • daily-evolve/lib/auth-health-check.mjs parseSetupJson: staleHomeAuth → NOT_VERIFIED(→ FALLBACK_HEURISTIC) + remedy hint 를 subscription 이 아닌 cp ~/.codex/auth.json ~/.codex/claude-code/auth.json sync 로 분기.

검증

  • 신규 tests/plugin-home-verified-wiring.test.mjs (10) + auth-health-check.test.mjs staleHomeAuth case. 전체 tests 619 / pass 615 / fail 3 — fail 3 은 기존 documented baseline flake(runtime.test.mjs job 미기록, Windows-only). 회귀 0.
  • real-backend e2e: pinned+stale → 무강등 / unpinned+stale → verified:false+staleHomeAuth:true+ready:false 양 분기를 라이브 setup --json 출력으로 확인.
  • 4-agent code-review(security/quality/architecture + tsc): R1 6 finding(med 1 + low 5) → 수정 → R2 0 수렴.

비범위 (follow-up)

Closes #2

setup --json reported verified:true while the next rescue failed with
`refresh token already used`. The dual-home split (CODEX_HOME=~/.codex/claude-code)
means `codex login` rotates only root auth.json, leaving the plugin-home copy
stale. inspectPluginHomeFreshness already detected the mtime skew but never fed
it into the verdict, so the green light was a false-positive advisory.

- new pure computeStaleHomeAuth(advisory, env) in lib/codex.mjs (named export +
  __testHooks); home-pinned (USE_DEFAULT_HOME=1 / explicit CODEX_HOME) means no
  dual-home, so no downgrade
- buildSetupReport downgrades auth.verified + ready and adds staleHomeAuth /
  verificationNote (additive only - loggedIn/verified shape preserved)
- daily-evolve parseSetupJson routes staleHomeAuth -> NOT_VERIFIED with an
  auth.json-sync hint instead of a misleading subscription hint
- tests: plugin-home-verified-wiring.test.mjs (10) + auth-health-check staleHomeAuth case

Refs #2 (fix #1). Follow-up (deferred): fix #2 broker self-heal copy root->plugin.
@tgkim-openerd
tgkim-openerd merged commit 32b525b into main Jun 8, 2026
@tgkim-openerd
tgkim-openerd deleted the fix/issue-2-staleauth-verified-wiring branch June 8, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] setup --json reports verified:true but rescue agent fails with 'refresh token already used' (false-positive advisory)

1 participant