test(tui_gateway): accept repair_alternation in resume-path DB doubles

The lazy session.resume path now calls
db.get_messages_as_conversation(target, repair_alternation=True), but the
fake _DB stubs in test_protocol.py still declared the pre-change signature,
so the resume raised "unexpected keyword argument 'repair_alternation'"
and the three session_resume_lazy tests failed.

Mirror the real get_messages_as_conversation signature in the stubs by
accepting (and ignoring) repair_alternation.
This commit is contained in:
Frowtek 2026-07-16 18:54:28 +03:00 committed by Teknium
parent 4579f26308
commit 7ada946436

View file

@ -346,7 +346,7 @@ def test_session_resume_returns_hydrated_messages(server, monkeypatch):
def reopen_session(self, _sid):
return None
def get_messages_as_conversation(self, _sid, include_ancestors=False):
def get_messages_as_conversation(self, _sid, include_ancestors=False, repair_alternation=False):
return [
{"role": "user", "content": "hello"},
{"role": "assistant", "content": "yo", "reasoning": "thoughts"},
@ -406,7 +406,7 @@ def test_session_resume_defaults_to_deferred_build(server, monkeypatch):
def reopen_session(self, _sid):
return None
def get_messages_as_conversation(self, _sid, include_ancestors=False):
def get_messages_as_conversation(self, _sid, include_ancestors=False, repair_alternation=False):
return [
{"role": "user", "content": "hello"},
{"role": "assistant", "content": "yo"},
@ -547,7 +547,7 @@ def test_session_resume_handles_multimodal_list_content(server, monkeypatch):
def reopen_session(self, _sid):
return None
def get_messages_as_conversation(self, _sid, include_ancestors=False):
def get_messages_as_conversation(self, _sid, include_ancestors=False, repair_alternation=False):
return [multimodal_user, text_only_assistant]
monkeypatch.setattr(server, "_get_db", lambda: _DB())
@ -597,7 +597,7 @@ def test_session_resume_lazy_registers_watch_session_without_agent(server, monke
def reopen_session(self, _sid):
return None
def get_messages_as_conversation(self, _sid, include_ancestors=False):
def get_messages_as_conversation(self, _sid, include_ancestors=False, repair_alternation=False):
return [
{"role": "user", "content": "delegated goal"},
]
@ -670,7 +670,7 @@ def test_session_resume_lazy_reports_running_for_inflight_child(server, monkeypa
def reopen_session(self, _sid):
return None
def get_messages_as_conversation(self, _sid, include_ancestors=False):
def get_messages_as_conversation(self, _sid, include_ancestors=False, repair_alternation=False):
return [{"role": "user", "content": "delegated goal"}]
monkeypatch.setattr(server, "_get_db", lambda: _DB())
@ -721,7 +721,7 @@ def test_session_resume_lazy_tolerates_missing_row_for_active_child(server, monk
def reopen_session(self, _sid):
return None
def get_messages_as_conversation(self, _sid, include_ancestors=False):
def get_messages_as_conversation(self, _sid, include_ancestors=False, repair_alternation=False):
# No rows for an unwritten session.
return []
@ -818,7 +818,7 @@ def test_session_resume_reuses_existing_live_session(server, monkeypatch):
def reopen_session(self, _sid):
return None
def get_messages_as_conversation(self, _sid, include_ancestors=False):
def get_messages_as_conversation(self, _sid, include_ancestors=False, repair_alternation=False):
return [
{"role": "user", "content": "hello"},
{"role": "assistant", "content": "yo"},
@ -1035,7 +1035,7 @@ def test_session_resume_live_payload_uses_current_history_with_ancestors(server,
def reopen_session(self, _sid):
return None
def get_messages_as_conversation(self, _sid, include_ancestors=False):
def get_messages_as_conversation(self, _sid, include_ancestors=False, repair_alternation=False):
if include_ancestors:
return ancestor_history + current_history
return list(current_history)