The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(tui_gateway): pin materialized-row profile stamp against the #99222 contract
Brooklyn Nicholson7b384285fa28
diff --git a/tests/tui_gateway/test_session_resume_materializes_minted_key.py b/tests/tui_gateway/test_session_resume_materializes_minted_key.pyindex 85b7777290b..ccb7eb6bb66 100644--- a/tests/tui_gateway/test_session_resume_materializes_minted_key.py+++ b/tests/tui_gateway/test_session_resume_materializes_minted_key.py@@ -33,13 +33,13 @@ def real_db(monkeypatch, tmp_path):monkeypatch.setattr(server, "_get_db", lambda: db)monkeypatch.setattr(server, "_resolve_model", lambda: "test-model")monkeypatch.setattr(server, "_enable_gateway_prompts", lambda: None)- monkeypatch.setattr(server, "_find_live_session_by_key", lambda _key: None)+ monkeypatch.setattr(server, "_find_live_session_by_key", lambda _key, _home=None: None)monkeypatch.setattr(server, "_schedule_agent_build", lambda *a, **k: None)monkeypatch.setattr(server, "_schedule_session_cap_enforcement", lambda *a, **k: None)monkeypatch.setattr(server, "_maybe_schedule_auto_continue", lambda *a, **k: None)monkeypatch.setattr(server, "_default_session_cwd", lambda *a, **k: str(tmp_path))monkeypatch.setattr(server, "_profile_configured_cwd", lambda _home: str(tmp_path))- monkeypatch.setattr(server, "_child_run_active", lambda _key: False)+ monkeypatch.setattr(server, "_child_run_active", lambda _key, _home=None: False)known = set(server._sessions)yield dbwith server._sessions_lock:@@ -67,7 +67,12 @@ def test_resume_materializes_row_for_minted_key(real_db):assert row is not None, "resume must materialize the DB row"assert row["source"] == "tui"assert row["model"] == "test-model"- assert row.get("profile_name") is None # launch/default profile+ # Materialization stamps the launch profile explicitly (the #99222 contract+ # _ensure_session_db_row applies on first-prompt persistence: profile_name_for_home+ # or _current_profile_name, never NULL). A bare create_session leaves NULL, so the+ # oracle is the production expression itself, not a bare insert.+ assert row.get("profile_name") == (+ server.profile_name_for_home(None) or server._current_profile_name())def test_resume_existing_row_unaffected(real_db):