The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
chore: stack on #115730 to resolve hermes_cli/auth_codex.py conflict
teknium120751ae92cff
diff --cc hermes_cli/auth_codex.pyindex 4687f9b834b,daa8d97fd0e..d7602740f32--- a/hermes_cli/auth_codex.py+++ b/hermes_cli/auth_codex.py@@@ -508,22 -491,16 +514,28 @@@ def resolve_codex_runtime_credentials_read_codex_tokens)read_error: Optional[AuthError] = Nonedata = None+ observed: Optional[str] = Nonetry:- with _auth_store_lock():- # Observe the singleton in the same locked snapshot the read validates, so recovery can- # compare-and-swap against exactly the credential it is repairing (#73667).- from hermes_cli.auth import _load_auth_store, _load_provider_state- raw = (_load_provider_state(_load_auth_store(), "openai-codex") or {}).get("tokens")- observed = raw.get("access_token") if isinstance(raw, dict) else None- # A read-only report takes no store lock: ``_save_auth_store`` replaces auth.json- # atomically, and materialising ``auth.lock`` is itself a write a diagnostic must not make.- data = _read_codex_tokens(_lock=not read_only)++ if read_only:++ # A read-only report takes no store lock: ``_save_auth_store`` replaces auth.json++ # atomically, and materialising ``auth.lock`` is itself a write a diagnostic must not++ # make. No recovery follows a read-only read, so no observed token is needed.+ data = _read_codex_tokens(_lock=False)++ else:++ with _auth_store_lock():++ # Observe the singleton in the same locked snapshot the read validates, so recovery++ # can compare-and-swap against exactly the credential it is repairing (#73667).++ from hermes_cli.auth import _load_auth_store, _load_provider_state++ raw = (_load_provider_state(_load_auth_store(), "openai-codex") or {}).get("tokens")++ observed = raw.get("access_token") if isinstance(raw, dict) else None++ data = _read_codex_tokens(_lock=False)except AuthError as exc:read_error = exc- if exc.relogin_required and exc.code in {+ if not read_only and exc.relogin_required and exc.code in {"codex_auth_missing_access_token", "codex_auth_missing_refresh_token","codex_auth_invalid_shape"}:- imported = _recover_codex_tokens_from_cli(str(exc.code or "auth_error"))+ imported = _recover_codex_tokens_from_cli(+ str(exc.code or "auth_error"), observed_access_token=observed)if imported:data = {"tokens": imported, "last_refresh": imported.get("last_refresh")}if data is None: