fix(managed-agent): keep the text-order snapshot test deterministic

CI (Runtime Broker and Managed Agent MariaDB) caught
preservesTextOrderAcrossToolsAndReasoningInSnapshots racing the 10ms
materializer: a scheduler tick can create the snapshot mid-sequence, and a
non-terminal catch-up drain inside the 5s floor then legally leaves it
behind. The trailing event is now terminal so the explicit drain always
rewrites; the content-ordering assertion is unchanged.
This commit is contained in:
wenshao committed 2026-10-03 04:31:03 +08:00
1 parent 7de58603bc
commit b0d357ae9c
1 file changed
+5 -1
@@ -1022,9 +1022,13 @@ class ManagedAgentServerIntegrationTest {
store.appendPublicEventIfAbsent(tenant, session.sessionId(), turnId,
"item.reasoning.delta", Map.of("text", "thought"),
false, "thought");
// The trailing event is terminal so the explicit drain below always
// rewrites the snapshot: the 10ms materializer may otherwise create
// the snapshot mid-sequence, and a non-terminal catch-up inside the
// 5s floor would legally leave the snapshot behind.
store.appendPublicEventIfAbsent(tenant, session.sessionId(), turnId,
"item.output_text.delta", Map.of("text", "final"),
false, "final");
true, "final");
store.materializeNextBatch(tenant, session.sessionId(), 100);
assertThat(store.findSnapshot(tenant, session.sessionId()))
.get().satisfies(snapshot -> assertThat(snapshot.items())