Skip to content

The agent that grows with you

Two tui_gateway server tests no longer fail on signed-in hosts or race the ctime clock (salvage #93665) (#126490)

Siddharth Balyan66873f6fc3d3
diff --git a/tests/hermes_cli/test_config_cache_signature.py b/tests/hermes_cli/test_config_cache_signature.py
index 1dcebba2839..7fbd259f442 100644
--- a/tests/hermes_cli/test_config_cache_signature.py
+++ b/tests/hermes_cli/test_config_cache_signature.py
@@ -12,6 +12,10 @@ def _replace_pinning_mtime(path, content: str) -> None:
before = path.stat()
other = path.with_name("other.yaml")
other.write_text(content, encoding="utf-8")
+ # ctime ticks at the kernel's coarse clock (~4 ms): an in-place rewrite inside the tick of the
+ # cached read leaves every stat field equal. Wait until the fs clock has passed that ctime.
+ while other.stat().st_ctime_ns <= before.st_ctime_ns:
+ os.utime(other)
shutil.copy2(other, path)
os.utime(path, ns=(before.st_atime_ns, before.st_mtime_ns))
diff --git a/tests/tui_gateway/test_tui_gateway_server.py b/tests/tui_gateway/test_tui_gateway_server.py
index 20e06ba5c9e..906065fc88f 100644
--- a/tests/tui_gateway/test_tui_gateway_server.py
+++ b/tests/tui_gateway/test_tui_gateway_server.py
@@ -16940,6 +16940,8 @@ def test_model_options_preserves_canonical_custom_row_after_agent_init(monkeypat
"hermes_cli.auth.is_provider_explicitly_configured",
lambda _slug: False,
)
+ # A host signed in to Claude Code / Anthropic OAuth would otherwise keep the anthropic row.
+ monkeypatch.setattr("hermes_cli.inventory._anthropic_oauth_credentials_present", lambda: False)
monkeypatch.setattr("hermes_cli.inventory._apply_pricing", lambda *_args, **_kwargs: None)
monkeypatch.setattr("hermes_cli.inventory._apply_capabilities", lambda *_args, **_kwargs: None)
@@ -22757,6 +22759,10 @@ def test_load_cfg_raw_sees_replacement_with_pinned_mtime_and_size(monkeypatch, t
st = cfg.stat()
other = tmp_path / "other.yaml"
other.write_text("model:\n default: aaaa-route\n", encoding="utf-8")
+ # ctime ticks at the kernel's coarse clock (~4 ms): an in-place rewrite inside the tick of the
+ # cached read leaves every stat field equal. Wait until the fs clock has passed that ctime.
+ while other.stat().st_ctime_ns <= st.st_ctime_ns:
+ os.utime(other)
shutil.copy2(other, cfg)
os.utime(cfg, ns=(st.st_atime_ns, st.st_mtime_ns))
assert server._load_cfg_raw()["model"]["default"] == "aaaa-route"