Carry proposal exchanges into repair replay

This commit is contained in:
2026-11-11 04:18:05 +00:00
parent eb45d0b623
commit 00848203d7
10 changed files with 267 additions and 41 deletions

View File

@@ -18,7 +18,9 @@ import (
)
func TestExecuteModuleProposalBuildsMessagesFromSectionAndDescription(t *testing.T) {
exchange := &structuredoutput.Exchange{PromptID: "captured", FinalContent: "response"}
client := &fakeStructuredClient{
completion: structuredoutput.Response{Exchange: exchange},
responses: []StructuredCorrectionSet{
{Corrections: []StructuredCorrectionProposal{{SegmentReference: 1, OriginalText: "teh", CorrectedText: "the", Confidence: 0.9}}},
},
@@ -39,9 +41,10 @@ func TestExecuteModuleProposalBuildsMessagesFromSectionAndDescription(t *testing
Section: &section,
},
RunSpec: contracts.ModuleRunSpec{
ModuleKey: "grammar",
InstanceName: "grammar",
ReplacementPolicy: proposals.ReplacementPolicyRequireUnique,
CaptureProposalExchange: true,
ModuleKey: "grammar",
InstanceName: "grammar",
ReplacementPolicy: proposals.ReplacementPolicyRequireUnique,
},
LLMClient: client,
},
@@ -53,6 +56,9 @@ func TestExecuteModuleProposalBuildsMessagesFromSectionAndDescription(t *testing
if len(client.calls) != 1 || client.calls[0].PromptID != prompts.PromptIDModuleGrammarProposal || client.calls[0].Context.SectionIndex == nil || *client.calls[0].Context.SectionIndex != 7 {
t.Fatalf("unexpected stage name calls: %+v", client.calls)
}
if !client.calls[0].CaptureExchange || out.Exchange != exchange {
t.Fatalf("exchange was not passed through: %+v", out.Exchange)
}
variables := client.calls[0].Variables
if !strings.Contains(variables["SectionJSON"], `"section_index": 7`) ||
!strings.Contains(variables["SectionJSON"], "teh") ||