Path: redb-route/tests/redb.Route.Tests.Llm/ReplayProviderThinkingTests.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests.Llm/ReplayProviderThinkingTests.cs ---- using redb.Route.Tests.Llm.TestHelpers; namespace redb.Route.Tests.Llm; /// /// Wave 16.2 (debt from 16.1): a thinking block survives the replay fixture. The snapshot has a slot /// for the thought, its signature and a redacted payload on both sides — a recorded block /// without them came back as Type = "unknown" and vanished, so an eval replay of a tool loop /// silently lost the reasoning the provider is supposed to get back. /// public sealed class ReplayProviderThinkingTests { [Fact] public async Task ThinkingBlock_SurvivesReplaySnapshot() { var fixture = Path.Combine(Path.GetTempPath(), $"redb-replay-{Guid.NewGuid():N}.json"); try { // The request side: the shape a second iteration of a tool loop sends — the assistant turn // that carries the reasoning, then the tool result. var request = new LlmRequest { Messages = [ LlmMessage.User("status of order 42?"), new LlmMessage { Role = "assistant", Content = [ new LlmThinkingBlock("previous reasoning", "sig-prev"), new LlmToolUseBlock("tu_1", "order_lookup", """{"orderId":"42"}""") ] }, new LlmMessage { Role = "user", Content = [new LlmToolResultBlock("tu_1", """{"status":"shipped"}""")] } ] }; var inner = new FakeProvider().Enqueue(new LlmResponse { Content = [new LlmThinkingBlock("recorded reasoning", "sig-9"), new LlmTextBlock("shipped")], StopReason = LlmStopReason.EndTurn, Usage = new LlmUsage(3, 4) }); var recorder = new ReplayProvider(fixture, ReplayMode.Record, inner); var recorded = await recorder.CompleteAsync(request); recorded.Content.OfType().Should().ContainSingle(); recorder.EntryCount.Should().Be(1); var snapshot = await File.ReadAllTextAsync(fixture); snapshot.Should().Contain("sig-prev", "the request snapshot keeps the signature that makes the block replayable"); snapshot.Should().Contain("sig-9", "the response snapshot keeps it too"); snapshot.Should().Contain("thinking", "the block is recorded under its own kind, not as \"unknown\""); var replayed = await new ReplayProvider(fixture, ReplayMode.Replay).CompleteAsync(request); var block = replayed.Content.OfType().Should().ContainSingle( "a block recorded without its fields comes back as \"unknown\" and is dropped").Subject; block.Text.Should().Be("recorded reasoning"); block.Signature.Should().Be("sig-9"); } finally { if (File.Exists(fixture)) File.Delete(fixture); } } }