Skip to content

The agent that grows with you

test(agent): align the mirror merge pin and live-marker fixture with current repair behavior

Brooklyn Nicholsone27448b23149
diff --git a/tests/agent/test_message_sequence_repair.py b/tests/agent/test_message_sequence_repair.py
index bc73d4f7734..3c36d331ef9 100644
--- a/tests/agent/test_message_sequence_repair.py
+++ b/tests/agent/test_message_sequence_repair.py
@@ -116,13 +116,17 @@ def test_repair_plain_user_then_marker_stays_addressable():
repairs = AIAgent._repair_message_sequence(agent, messages)
assert repairs == 1
- assert messages == [
- {
- "role": "user",
- "_row_id": 12134,
- "content": "the user's real prompt\n\n[System: The active model for this chat has changed to ds4.]",
- }
- ]
+ assert len(messages) == 1
+ survivor = messages[0]
+ # The plain row keeps its own identity; the marker's id is retired onto
+ # the absorbed list and no display classification is resurrected.
+ assert survivor["role"] == "user"
+ assert survivor["_row_id"] == 12134
+ assert not survivor.get("display_kind")
+ assert survivor["content"] == (
+ "the user's real prompt\n\n[System: The active model for this chat has changed to ds4.]"
+ )
+ assert 12135 in (survivor.get("_absorbed_row_ids") or [])
def test_repair_does_not_rewind_ongoing_dialog_tool_pair():
diff --git a/tests/tui_gateway/test_tui_gateway_server.py b/tests/tui_gateway/test_tui_gateway_server.py
index f6a6ef59ccd..d388b12d286 100644
--- a/tests/tui_gateway/test_tui_gateway_server.py
+++ b/tests/tui_gateway/test_tui_gateway_server.py
@@ -7157,14 +7157,11 @@ def test_prompt_submit_resolves_row_id_absorbed_into_marker_merge(monkeypatch):
def _fake_session_db(_session):
yield _FakeDB()
- # Live history as it looks after a session restore: the durable
- # transcript reloaded WITHOUT row-id stamps (restore doesn't request
- # them), so resolution must go through the durable fallback.
- live = [
- {"role": "user", "content": "first"},
- {"role": "assistant", "content": "reply 1"},
- {"role": "user", "content": repaired[2]["content"]},
- ]
+ # Live history as a RUNNING session holds it after a turn rewrite: the
+ # repaired, merged shape with row-id stamps still attached (the live
+ # dicts carry them), so the in-memory lookup resolves directly.
+ live = copy.deepcopy(repaired)
+ assert live[2]["_row_id"] == 12135
server._sessions["merged-marker-sid"] = _session(history=list(live))
monkeypatch.setattr(server, "_session_db", _fake_session_db)
monkeypatch.setattr(server, "_get_db", lambda: _FakeDB())