Skip to content

The agent that grows with you

fix(auth): qwen OAuth login reaches _mark_qwen_oauth_active in its moved owner

Teknium38742342b2b0
diff --git a/hermes_cli/auth_commands.py b/hermes_cli/auth_commands.py
index a3c76ad5643..6bc57fde25c 100644
--- a/hermes_cli/auth_commands.py
+++ b/hermes_cli/auth_commands.py
@@ -187,8 +187,10 @@ def _anthropic_oauth_login(args) -> dict:
def _qwen_oauth_login(args) -> dict:
+ from hermes_cli.auth_qwen import _mark_qwen_oauth_active
+
creds = auth_mod.resolve_qwen_runtime_credentials(refresh_if_expiring=False)
- auth_mod._mark_qwen_oauth_active(creds)
+ _mark_qwen_oauth_active(creds)
return creds
diff --git a/tests/hermes_cli/test_auth_commands.py b/tests/hermes_cli/test_auth_commands.py
index 682807add32..a0c5fe8e5a8 100644
--- a/tests/hermes_cli/test_auth_commands.py
+++ b/tests/hermes_cli/test_auth_commands.py
@@ -1110,3 +1110,20 @@ def test_auth_remove_env_seeded_dotenv_with_bom_no_shell_hint(tmp_path, monkeypa
out = capsys.readouterr().out
assert "Cleared DEEPSEEK_API_KEY from .env" in out
assert "still set in your shell environment" not in out
+
+
+def test_qwen_oauth_login_marks_active_through_moved_owner(monkeypatch):
+ """`_mark_qwen_oauth_active` lives in `auth_qwen`; the login flow must reach it
+ without depending on a re-export from the `auth` facade (AttributeError on head before)."""
+ import hermes_cli.auth_commands as auth_commands
+ import hermes_cli.auth_qwen as auth_qwen
+
+ creds = {"access_token": "tok"}
+ marked = []
+ monkeypatch.setattr(
+ auth_commands.auth_mod, "resolve_qwen_runtime_credentials", lambda **kw: creds
+ )
+ monkeypatch.setattr(auth_qwen, "_mark_qwen_oauth_active", lambda c: marked.append(c))
+
+ assert auth_commands._qwen_oauth_login(None) is creds
+ assert marked == [creds]