test(tui_gateway): pin synchronous-build resume tests to eager_build

These three assert the eager build contract — stored runtime overrides /
profile db reach _make_agent synchronously, and the agent binds to the
compression tip. Under deferred-by-default the build runs off-thread, so
they raced the timer (green in CI, flaky locally). Pin them to
eager_build; deferred coverage lives in the protocol tests.
This commit is contained in:
Brooklyn Nicholson 2026-06-25 14:13:07 -05:00
parent 1ca1f9f2c7
commit e8561d61e6

View file

@ -1001,8 +1001,11 @@ def test_session_resume_follows_compression_tip(monkeypatch, tmp_path):
)
try:
# eager_build: this asserts the synchronously-built agent binds to the
# resolved tip (captured["agent_session_id"]); the compression-tip
# resolution itself runs before the build and is mode-agnostic.
resp = server.handle_request(
{"id": "1", "method": "session.resume", "params": {"session_id": "parent_root"}}
{"id": "1", "method": "session.resume", "params": {"session_id": "parent_root", "eager_build": True}}
)
finally:
db.close()
@ -1049,8 +1052,11 @@ def test_session_resume_passes_stored_runtime_to_agent(monkeypatch):
monkeypatch.setattr(server, "_init_session", fake_init_session)
# eager_build: this asserts the synchronous build contract (stored runtime
# overrides reach _make_agent, info comes from _session_info). The deferred
# default restores the same overrides via _start_agent_build off-thread.
resp = server.handle_request(
{"id": "1", "method": "session.resume", "params": {"session_id": "stored-session"}}
{"id": "1", "method": "session.resume", "params": {"session_id": "stored-session", "eager_build": True}}
)
assert resp["result"]["info"] == {"model": "gpt-5.4", "provider": "openai-codex"}
@ -1137,11 +1143,13 @@ def test_session_resume_profile_uses_profile_db_cwd(monkeypatch, tmp_path):
monkeypatch.setattr(approval, "load_permanent_allowlist", lambda: None)
try:
# eager_build: asserts the synchronous build receives the profile's db
# (the deferred default builds with the same db via _start_agent_build).
resp = server.handle_request(
{
"id": "1",
"method": "session.resume",
"params": {"session_id": target, "profile": "worker"},
"params": {"session_id": target, "profile": "worker", "eager_build": True},
}
)