Share repair histories while debug artifacts wait for indices
This commit is contained in:
@@ -142,6 +142,7 @@ func runRepairBranch(ctx context.Context, branchInput repairBranchInput) (repair
|
||||
promptID := branchInput.promptID
|
||||
current := original
|
||||
findings := repairFindings(original.ProposalIndex, branchInput.rejected)
|
||||
var history repairHistory
|
||||
buildRequest := func() (*structuredoutput.Request, error) {
|
||||
request := proposal_generation.RepairRequest{
|
||||
ProposalRef: proposalRef,
|
||||
@@ -192,6 +193,8 @@ func runRepairBranch(ctx context.Context, branchInput repairBranchInput) (repair
|
||||
record.Revision = &snapshot
|
||||
}
|
||||
feedback := findings
|
||||
prepared := history.retain(completion.Prepared)
|
||||
prompt, finalContent := completion.Prompt, completion.FinalContent
|
||||
record.Artifacts, _ = structuredoutput.WriteIndexedInteraction(input.Interactions, func(offset int, resolvePath func(string) string) structuredoutput.Interaction {
|
||||
index := proposalIndex + offset
|
||||
name := fmt.Sprintf("%s:section-%04d:proposal-%04d:attempt-%04d:repair", input.Spec.InstanceName, section, index, attemptNumber)
|
||||
@@ -217,9 +220,9 @@ func runRepairBranch(ctx context.Context, branchInput repairBranchInput) (repair
|
||||
return structuredoutput.Interaction{
|
||||
Name: name,
|
||||
Context: structuredoutput.DiagnosticContext{StageIndex: &input.Spec.Index, StageID: input.Spec.ID, Role: "correction_repair", ModuleKey: input.Spec.ModuleKey, ModuleInstance: input.Spec.InstanceName, SectionIndex: input.SectionIndex, ProposalIndex: &index, RepairAttempt: &attemptNumber},
|
||||
RequestMetadata: map[string]any{"stage_index": input.Spec.Index, "stage_id": input.Spec.ID, "proposal_index": index, "repair_attempt": attemptNumber, "prompt_id": promptID, "prompt": completion.Prompt, "feedback": feedback},
|
||||
RequestPayload: completion.Prepared,
|
||||
ResponsePayload: map[string]any{"decoded": response, "final_content": completion.FinalContent, "revision": correction, "decisions": decisions, "rejections": rejections},
|
||||
RequestMetadata: map[string]any{"stage_index": input.Spec.Index, "stage_id": input.Spec.ID, "proposal_index": index, "repair_attempt": attemptNumber, "prompt_id": promptID, "prompt": prompt, "feedback": feedback},
|
||||
RequestPayload: prepared,
|
||||
ResponsePayload: map[string]any{"decoded": response, "final_content": finalContent, "revision": correction, "decisions": decisions, "rejections": rejections},
|
||||
ErrorPayload: failure,
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user