The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: align suites with the unified runtime contracts
teknium1d02a9c1e2014
diff --git a/apps/desktop/src/components/assistant-ui/thread/list-session-scroll.test.tsx b/apps/desktop/src/components/assistant-ui/thread/list-session-scroll.test.tsxindex d6f88e92457..a3ea721e3c4 100644--- a/apps/desktop/src/components/assistant-ui/thread/list-session-scroll.test.tsx+++ b/apps/desktop/src/components/assistant-ui/thread/list-session-scroll.test.tsx@@ -114,10 +114,10 @@ function ScrollHarness({<AssistantRuntimeProvider runtime={runtime}><TranscriptWindowProvider value={window ?? { olderAvailable: false, expandWindow: () => {} }}><Thread+ clampToComposer={clampToComposer}scrollProfile={scrollProfile}sessionId={sessionId}sessionKey={sessionKey}- clampToComposer={clampToComposer}/></TranscriptWindowProvider></AssistantRuntimeProvider>@@ -130,6 +130,7 @@ describe('list session-scroll restore', () => {// so streamed growth paints at the stale scrollTop and the viewport drifts// up before the re-pin. The transcript ResizeObserver closes that frame.const previousObserver = globalThis.ResizeObserver+const observers = new Set<{callback: ResizeObserverCallbacktargets: Set<Element>@@ -250,8 +251,9 @@ describe('list session-scroll restore', () => {)const { container, unmount } = render(- <ScrollHarness isRunning messages={sessionMessages('clr')} sessionKey="clr" clampToComposer />+ <ScrollHarness clampToComposer isRunning messages={sessionMessages('clr')} sessionKey="clr" />)+const vp = viewportEl(container)const clearance = vp.querySelector('[data-slot="aui_composer-clearance"]')diff --git a/tests/e2e/core/providers/_oauth_helpers.py b/tests/e2e/core/providers/_oauth_helpers.pyindex 2720b3302f6..e42ec0476e8 100644--- a/tests/e2e/core/providers/_oauth_helpers.py+++ b/tests/e2e/core/providers/_oauth_helpers.py@@ -210,8 +210,12 @@ def start_anthropic_rig(root: Path, decide: Callable[[dict[str, Any]], Any], *,expires_at_ms: int | None = None) -> AnthropicOAuthRig:"""``expires_at_ms`` is the seeded row's clock expiry; default: an hour ahead, so only thevendor's 401 (early revocation/expiry) can trigger the refresh."""+ from tests.e2e.core.providers._anthropic_helpers import become_subreaperfrom tests.fakes.providers.oauth_token_server import OAuthTokenServer, TLSInterceptProxy, make_test_ca+ # The child's first connect spawns the profile's gateway daemon (detached, reparented to init);+ # as subreaper it stays in this test's tree so ``kill_tagged`` passes the live-system guard.+ become_subreaper()ca = make_test_ca(root / "ca", ANTHROPIC_TOKEN_HOSTS)tokens = OAuthTokenServer().start()proxy = TLSInterceptProxy(tokens, ca, ANTHROPIC_TOKEN_HOSTS).start()diff --git a/tests/e2e/core/providers/test_fallback_providers.py b/tests/e2e/core/providers/test_fallback_providers.pyindex 3d3de656c2c..6eef2ae40cb 100644--- a/tests/e2e/core/providers/test_fallback_providers.py+++ b/tests/e2e/core/providers/test_fallback_providers.py@@ -46,7 +46,7 @@ pytestmark = pytest.mark.skipif(not sys.platform.startswith("linux"), reason="su# KnownBugError from bug_assertions() matching the pattern XFAILs the cell (known_gate).KNOWN: dict[str, tuple[str, str]] = {"unreachable_portal_falls_back": (- r"(?s)fallback_providers never consulted: .*agent failed: \[Errno 111\] Connection refused",+ r"(?s)fallback_providers never consulted: .*\[Errno 111\] Connection refused","#120608 transport error during credential resolution skips fallback_providers"),}diff --git a/tests/e2e/core/providers/test_native_vertex_tools.py b/tests/e2e/core/providers/test_native_vertex_tools.pyindex 9f6481acfc9..9d1b31fa159 100644--- a/tests/e2e/core/providers/test_native_vertex_tools.py+++ b/tests/e2e/core/providers/test_native_vertex_tools.py@@ -168,20 +168,22 @@ def test_tool_result_goes_back_paired_to_the_signed_call(results: dict[str, Any]def test_wire_scheme_bearer_and_single_token_mint(results: dict[str, Any]) -> None:"""Every request hits the configured project/location path on the regional host with a bearer the- OAuth endpoint minted from a verified SA JWT; one mint per process, reused across API calls."""+ OAuth endpoint minted from a verified SA JWT; one mint per agent process, reused across API+ calls. Both turns run in the profile's gateway daemon (one process), so a still-valid token+ is reused across the resume instead of re-minted."""res = results["session"]fake = res["fake"]_ok(res["turn1"], "turn 1")_ok(res["turn2"], "turn 2")assert all(r["claims"] for r in fake.token_requests), fake.token_requestsassert [c["target"] for c in fake.connects if c["allowed"]], "no request reached Vertex through the proxy"- per_process = [fake.requests[: res["boundary"]], fake.requests[res["boundary"]:]]minted = fake.minted_tokens()- assert res["tokens_after_turn1"] == 1 and len(minted) == 2, (- f"expected one token exchange per process, saw {len(fake.token_requests)}: {fake.token_requests}")- for token, reqs in zip(minted, per_process):+ assert res["tokens_after_turn1"] == 1 and len(minted) == 1, (+ f"expected one token exchange for the serving process, saw {len(fake.token_requests)}: {fake.token_requests}")+ per_turn = [fake.requests[: res["boundary"]], fake.requests[res["boundary"]:]]+ for reqs in per_turn:assert len(reqs) >= 2- assert {r["auth"] for r in reqs} == {f"Bearer {token}"}, "bearer not the minted token / not reused"+ assert {r["auth"] for r in reqs} == {f"Bearer {minted[0]}"}, "bearer not the minted token / not reused"expected_path = f"/v1beta1/projects/{PROJECT}/locations/{REGION}/endpoints/openapi/chat/completions"assert {(r["host"], r["path"]) for r in fake.requests} == {(f"{REGION}-aiplatform.googleapis.com", expected_path)}assert {r["body"]["model"] for r in fake.requests} == {"google/gemini-3-flash-preview"}diff --git a/tests/e2e/core/upgrade/test_config_roundtrip_properties.py b/tests/e2e/core/upgrade/test_config_roundtrip_properties.pyindex 9693397aeb7..4bf84e339da 100644--- a/tests/e2e/core/upgrade/test_config_roundtrip_properties.py+++ b/tests/e2e/core/upgrade/test_config_roundtrip_properties.py@@ -286,6 +286,10 @@ def gen_case(seed: int, *, long: bool = False, n_sections: tuple = (5, 11), exclsec = sections[0]leaf = next(p for p in _leaves(tree) if p[0] == sec)_set(tree, leaf, "A" * 76 + "D:\\CentBrowserPortable " + "B" * 60)+ if null_leaves and not any(v is None for v in _leaves(tree).values()):+ # The draw depends on DEFAULT_CONFIG's leaf population, so a new default key reshuffles+ # every seed; the explicit-null property must not hinge on which seed happened to roll one.+ _set(tree, next(p for p in _leaves(tree) if p[0] == sections[0]), None)if "providers" not in exclude_top: # a provider name with a literal dot (#84064 family)tree["providers"] = {f"acme.v{seed % 7}": {"base_url": f"http://127.0.0.1:9/v{seed}", "api_mode": "chat_completions"}}if "c18_custom_root" not in exclude_top:diff --git a/tests/e2e/core/windows/test_cron_scripts.py b/tests/e2e/core/windows/test_cron_scripts.pyindex c9aaebcba47..b29e3e8fc86 100644--- a/tests/e2e/core/windows/test_cron_scripts.py+++ b/tests/e2e/core/windows/test_cron_scripts.py@@ -60,7 +60,8 @@ def _run_script_job(home: WinHome, script: str, env_extra: dict[str, str] | Noneassert created.returncode == 0 and match, created.tail()job_id = match.group(1)ran = hermes(home, "cron", "run", job_id, cwd=home.profile, env_extra=env_extra)- assert ran.returncode == 0 and "Ran now:" in ran.stdout, f"job did not run synchronously:\n{ran.tail()}"+ # A synchronous failure exits 1 by contract ("Ran now: failed."); the caller judges it.+ assert ran.returncode in (0, 1) and "Ran now:" in ran.stdout, f"job did not run synchronously:\n{ran.tail()}"jobs = json.loads((home.hermes_home / "cron" / "jobs.json").read_text(encoding="utf-8"))["jobs"]job = next(j for j in jobs if j["id"] == job_id)outputs = sorted((home.hermes_home / "cron" / "output" / job_id).glob("*.md"))diff --git a/tests/hermes_cli/test_gateway_chat.py b/tests/hermes_cli/test_gateway_chat.pyindex 03b15b959b5..445fb035d73 100644--- a/tests/hermes_cli/test_gateway_chat.py+++ b/tests/hermes_cli/test_gateway_chat.py@@ -8,7 +8,7 @@ def test_unsupported_launch_options_fail_before_connection(monkeypatch, capsys):from hermes_cli import gateway_chatcalls = []monkeypatch.setattr(gateway_chat, "connect_gateway", lambda: calls.append(True))- for option in ("checkpoints", "worktree", "usage_file", "run_budget"):+ for option in ("checkpoints", "worktree", "run_budget"):args = argparse.Namespace(**{option: True})assert gateway_chat.launch_from_args(args) == 2assert option.replace("_", "-") in capsys.readouterr().err@@ -18,9 +18,15 @@ def test_unsupported_launch_options_fail_before_connection(monkeypatch, capsys):assert "--continue" in capsys.readouterr().errassert gateway_chat.launch_from_args(argparse.Namespace(create_if_missing=True)) == 2assert "create-if-missing" in capsys.readouterr().err- assert gateway_chat.launch_from_args(argparse.Namespace(continue_last="named", model="m", query="x")) == 2- assert calls == []- assert gateway_chat.launch_from_args(argparse.Namespace(resume="stored", source="tui", query="x")) == 2+ # Creation flags on resume are judged against the frozen route: repeating the launch+ # flags is fine (scripts re-run one command line), changing one is refused.+ frozen = {"info": {"launch_request": {"source": "cli", "model": "m", "toolsets": ["file"], "reasoning": "high"},+ "cwd": "/w"}}+ gateway_chat.check_resume_policy(argparse.Namespace(resume="stored", model="m", toolsets="file",+ reasoning="high", query="x"), frozen)+ for override in ({"model": "other"}, {"source": "tui"}, {"toolsets": "browser"}, {"in_dir": "/elsewhere"}):+ with pytest.raises(gateway_chat.GatewayClientError):+ gateway_chat.check_resume_policy(argparse.Namespace(resume="stored", query="x", **override), frozen)# Bypass launches read no profile default model, so one must be explicit.assert gateway_chat.launch_from_args(argparse.Namespace(safe_mode=True, query="x")) == 1assert "--model" in capsys.readouterr().errdiff --git a/ui-tui/src/__tests__/createGatewayEventHandler.test.ts b/ui-tui/src/__tests__/createGatewayEventHandler.test.tsindex 08e87abf193..d52d5854050 100644--- a/ui-tui/src/__tests__/createGatewayEventHandler.test.ts+++ b/ui-tui/src/__tests__/createGatewayEventHandler.test.ts@@ -1759,7 +1759,12 @@ describe('createGatewayEventHandler', () => {if (race === 'settled acknowledgement') {emit('message.complete', { text: 'completed before the interrupt reached the server' })- expect(appended).toEqual([{ role: 'assistant', text: 'completed before the interrupt reached the server' }])+ // The streamed tail the user watched is kept as its own segment when the final+ // text does not carry it (#61520); the final lands once, after it.+ expect(appended).toEqual([+ { role: 'assistant', text: 'partial' },+ { role: 'assistant', text: 'completed before the interrupt reached the server' }+ ])expect(getUiState().busy).toBe(false)}}