I ran GPT 6.1 Sol against GPT 6 Sol on 24 tasks from my own repo, and found that it maintained quality while cutting cost in half
GPT 6.1 Sol was something of a surprise drop, coming just about a week after GPT 6 Sol released. In my day to day use, it's honestly pretty hard to tell a distinct difference between the two (especially given the short shelf life of GPT 6 Sol).
Given the new model, the reduced Codex subscription usage limits, and the rumors that GPT 6.1 Sol was a so-called "Astra Lite", I wanted to see if, via controlled measurement, there was actually a difference between these two models.
The setup was 24 changes that merged into my repo, a small to medium Go and TypeScript codebase for evaluating coding agents. I ran each model in Codex at medium reasoning, one attempt per task.
TL;DR:
GPT 6.1 Sol is a cheaper replacement that holds quality, but the shape of its patches looks different.
- Quality of the code held, and leaned slightly toward GPT 6.1 Sol: 9 wins, 10 ties and 5 losses head to head.
- GPT 6.1 Sol's diffs were bigger, with more test and implementation code.
- GPT 6.1 Sol cost about half as much on the typical task and took about as long.
- GPT 6.1 Sol ranks second of 14 on my leaderboard. Opus 5 ranks first.
GPT 6.1 Sol cost less on 22 of 24 tasks.
GPT 6.1 Sol's cost as a share of GPT 6 Sol's · log scale
How I grade
Before going into the results, it's worth a quick detour on how I even arrive at these. Many community model benchmarks are vibey and don't exactly inspire confidence in how they are run. Here's how I run mine:
- I run these with Stet, a tool I'm building to use a repo's merged changes to evaluate coding agents.
- Each task is a merged change in my private repo, with the repo snapshot from just before it merged, a prompt and the tests, which the agent never sees.
- The agent is prevented from fetching the result via GitHub (agents try this surprisingly often!).
- I look at a few different signals:
- Correctness: original tests passing or failing, or "equivalence" (is this the same change?) to the merged change.
- Checklist: each task has required behaviors that are judged item by item by an agent judge (GPT 5.6 Terra for now).
- A model writes them for each task from the prompt, the merged change and its tests, without seeing any agent's patch.
- The same judge grades checklist and review for every model on the board.
- Code review: covers code reuse, abstraction levels, test style, code nothing calls, guards and scope. Basically: would a senior engineer want to merge this?
- Correctness, checklist and review combine into one score per patch: correctness counts 53%, checklist and review 47%. The two models are compared task by task, and close scores count as ties.
Two tasks, from prompt to production ship score
Keep replayed tests and repaired grades tied to the original run
Task prompt the agent saw
Make test-command replay and validation repair preserve provenance: retry recoverable failures with recorded attempt history, replay only the actual test invocation from recorded commands, and keep repaired grades tied to their original measurement context. Reject unsafe or ambiguous commands and unrecoverable failures rather than guessing or silently degrading.
Required interface (use these exact names and signatures):
- AttemptCount int json:"attempt_count,omitempty"
- EffectiveTestCommands []string
- EquivalenceAI AIClient
- EquivalencePrompt string
- EquivalencePromptContext *PromptContext
- EquivalencePromptMode EquivalencePromptMode
- RecoveredAfterRetry bool json:"recovered_after_retry,omitempty"
- func RenderEquivalencePromptForMode(promptCtx PromptContext, mode EquivalencePromptMode) (string, error) {
- RequireRepoContext bool
- RetryCount int json:"retry_count,omitempty"
- RetryReasons []string json:"retry_reasons,omitempty"
- ReviewAI AIClient
- ReviewPrompt string
- ReviewPromptContext *PromptContext
Required exact strings (use this copy verbatim):
- could not be composed with the canonical reference test patch
Both reached the same correctness rung; GPT 6.1 Sol led the production ship score by 0.143, beyond the ±0.025 tie cutoff.
stet runs repair-ai-coverage --out /path/to/h2h-output --model-key model-one --cUse `--parse-retries` when saved `code_review` prompts exist but evaluatorresponses failed JSON/schema parsing. The command rewrites validation artifactsonly after a successful repair and regenerates summaries/task details.only after a successful repair and regenerates summaries/task details. Storedprompts retain their measurement mode and truncation. Missing-prompt repairrequires the original task projection, matching artifact digests, persisted testcommands, and complete repository context; unavailable provenance staysunresolved. Attempt counts and retry reasons distinguish recovery from aninitial successful grade; assertions and unrecoverable runtime errors are notretried.Regrade additive custom or bundled graders from canonical task details:const coverageValidationGolden = `{ }, "equiv_rescue_policy": "on", "equivalence": { "attempt_count": 1, "confidence": 0.95, "evaluator_model": "judge-a", "issue_type": "stylistic",func (p *repairAICoverageProducer) Produce(mctx *MutationContext) (*ProduceResul var mu sync.Mutex runWithConcurrency(jobs, min(len(jobs), coverageRepairWorkers), func(job repairJob) { reporter.recordTaskStart(variant, job.TaskID, job.CurrentWork, time.Now().UTC()) result, repairErr := validate.RepairCoverage(ctx, validate.CoverageRepairConfig{ repairCfg := validate.CoverageRepairConfig{ Existing: job.Validation, AI: ai, AIModelID: resolvedAIModelID, RepairEquivalence: repairEquivalence && needsRepairCoverage(job.Validation, TaskGraderEquivalence, resolvedAIModelID), RepairCodeReview: repairCodeReview && needsRepairCoverage(job.Validation, TaskGraderCodeReview, resolvedAIModelID), ReviewParseRetries: cfg.ParseRetries, }) } cleanup, reconstructionIssues := prepareCoverageRepairPrompts(&repairCfg, manifest, NewTaskArtifacts(outputRoot, variant, job.TaskID, "")) if cleanup != nil { defer cleanup() } result := validate.CoverageRepairResult{Validation: job.Validation} var repairErr error if repairCfg.RepairEquivalence || repairCfg.RepairCodeReview { result, repairErr = validate.RepairCoverage(ctx, repairCfg) } result.Unresolved = append(result.Unresolved, reconstructionIssues...) if repairErr != nil { reporter.recordTaskEnd(variant, job.TaskID, job.CurrentWork, "failed", time.Now().UTC()) mu.Lock()func RunAdaptedReferenceTest(ctx context.Context, ai AIClient, promptCtx PromptC composedDiff, composeErr := composeAdaptedReferenceTestPatch(runCtx, inputs, referenceTestPatch, canonicalDiff) if composeErr != nil { result.Reason = "patch_compose_failed" result.Summary = fmt.Sprintf("compose canonical reference test patch and adapted_diff: %v", composeErr) result.Summary = fmt.Sprintf("adapted_diff could not be composed with the canonical reference test patch: %v", composeErr) return result } composedPayload := payloadimport ( "strings" "time" "stet/internal/commandlist" "stet/internal/filecopy" "stet/internal/gitops" "stet/internal/harness"func legacyCommandsThatNameAgentTests(commands, agentFiles []string) []string { files := normalizeAgentTestFiles(agentFiles) var out []string for _, command := range normalizeCommands(commands) { if commandHasPotentialNonPathTestSelection(command) || receiptBackedCommandHasShellControl(command) { if _, _, safe := commandlist.TestInvocation(command); !safe || commandHasPotentialNonPathTestSelection(command) || receiptBackedCommandHasShellControl(command) { continue } for _, file := range files {import ( "fmt" "os" "path/filepath" "strconv" "strings" "stet/internal/commandlist" "stet/internal/shellcmd")func replaceExactFinalTestPath(command, sourcePath, replacement string) (string,}func certifiedGoReplayCommand(command, sourcePath string) (string, bool) { if !strings.HasSuffix(strings.ToLower(sourcePath), ".go") || !goCommandTargetsAgentTestFiles(command, []string{sourcePath}) { _, fields, safe := commandlist.TestInvocation(command) if !safe || len(fields) < 3 || fields[0].Value != "go" || fields[1].Value != "test" || !strings.HasSuffix(strings.ToLower(sourcePath), ".go") { return "", false } replay, changed := removeGoRunSelector(command) if !changed || hasRemainingGoTestSelector(replay) { // Require one explicit package. A recursive selector or additional package // can credit tests outside the certified source package. sourceDirectory := filepath.Dir(sourcePath) allFields, _ := shellcmd.FieldSpans(command) // Go also consumes selectors from GOFLAGS. Recorded overrides are opaque // to this bounded rewrite, so they cannot certify an unfiltered replay. for _, field := range allFields { if field.Start >= fields[0].Start { break } if strings.HasPrefix(field.Value, "GOFLAGS=") { return "", false } } if len(allFields) >= 3 && allFields[0].Value == "cd" { relative, err := filepath.Rel(allFields[1].Value, sourceDirectory) if err != nil || relative == ".." || strings.HasPrefix(relative, "../") { return "", false } sourceDirectory = relative } packagePath := "./" + filepath.ToSlash(sourceDirectory) if sourceDirectory == "." { packagePath = "." } if strings.TrimSuffix(fields[2].Value, "/") != packagePath { return "", false } start, end := -1, -1 for i := 3; i < len(fields); i++ { value := fields[i].Value if value == "-run" || strings.HasPrefix(value, "-run=") { if start >= 0 { return "", false } start, end = fields[i].Start, fields[i].End if value == "-run" { if i+1 >= len(fields) || strings.HasPrefix(fields[i+1].Value, "-") { return "", false } i++ end = fields[i].End } continue } // Only flags with self-contained values may remain. Positional words, // passthrough args, and further selectors cannot be proven safe. name := strings.SplitN(value, "=", 2)[0] if name == "-count" { countText, hasValue := strings.CutPrefix(value, "-count=") count, err := strconv.Atoi(countText) if !hasValue || err != nil || count <= 0 { return "", false } } switch name { case "-v", "-race", "-short", "-count", "-timeout", "-parallel", "-shuffle", "-tags", "-mod": if !strings.Contains(value, "=") && name != "-v" && name != "-race" && name != "-short" { return "", false } default: return "", false } } if start < 0 { return "", false } return replay, true return strings.TrimSpace(strings.TrimRight(command[:start], " \t") + command[end:]), true}func normalizeReplayRelativePath(path string) string {func TestValidateAgentTestReplayPlanRejectsUnprovenCommand(t *testing.T) { t.Fatalf("validation error = %v", err) }}func TestCertifiedGoReplayPreservesOnlyProvenInvocation(t *testing.T) { command := "cd module && env MODE='test value' timeout 30s go test ./pkg -run 'TestHidden|TestOther' -count=1" got, ok := certifiedGoReplayCommand(command, "module/pkg/hidden_test.go") if !ok || got != "cd module && env MODE='test value' timeout 30s go test ./pkg -count=1" { t.Fatalf("replay = %q, %v", got, ok) } for _, unsafe := range []string{ "echo go test ./pkg -run TestHidden", "go test ./pkg -run TestHidden; true", "go test ./pkg -run TestHidden && go test ./other", "go test ./... -run TestHidden", "go test ./pkg ./other -run TestHidden", "go test ./pkg -run TestHidden -skip TestOther", "go test ./pkg -run TestHidden -args payload", "go test ./pkg -run TestHidden -run TestOther", "go test ./pkg -run TestHidden -count=0", "go test ./pkg -run TestHidden -count=-1", "go test ./pkg -run TestHidden -count=invalid", "go test ./pkg -run TestHidden -count 0", "go test ./pkg -run TestHidden -count -1", "GOFLAGS=-count=0 go test ./pkg -run TestHidden", "GOFLAGS='-run=Nothing' go test ./pkg -run TestHidden", "env GOFLAGS=-count=0 go test ./pkg -run TestHidden", "cd module && env GOFLAGS='-run=Nothing' go test ./pkg -run TestHidden", } { if replay, ok := certifiedGoReplayCommand(unsafe, "pkg/hidden_test.go"); ok { t.Errorf("accepted %q as %q", unsafe, replay) } }}func TestLegacyReplayRequiresAnActualTestRunner(t *testing.T) { commands := legacyCommandsThatNameAgentTests([]string{ "echo tests/agent_test.sh", "cat tests/agent_test.sh", "rm tests/agent_test.sh", "sh -c tests/agent_test.sh", "'CI=1' sh tests/agent_test.sh", "sh tests/agent_test.sh", }, []string{"tests/agent_test.sh"}) if len(commands) != 1 || commands[0] != "sh 'tests/agent_test.sh'" { t.Fatalf("legacy replay commands = %q", commands) }}func buildEquivalenceRetryPrompt(originalPrompt, rawOutput string, parseErr erro )}func RunEquivalence(ctx context.Context, ai AIClient, promptCtx PromptContext) EquivalenceResult {func RunEquivalence(ctx context.Context, ai AIClient, promptCtx PromptContext) (result EquivalenceResult) { mode := EquivalencePromptModeStandard if goldBlindEquivalenceEnabled() { mode = EquivalencePromptModeGoldBlind } history := newGradeAttemptClient(ai) ai = history defer func() { result.PromptMode = mode; history.annotateEquivalence(&result) }() if goldBlindEquivalenceEnabled() { // No gold reaches the model, so gold truncation cannot have mutilated // the graded evidence: clear it before the truncation annotation runs.package validateimport ( "fmt" "os" "strconv" "strings"notes: <short explanation tied to the task obligations>// mode. In gold-blind mode the gold patch is dropped from the template data as// well as from the template, so no gold content can reach the model.func renderEquivalencePrompt(promptCtx PromptContext) (prompt string, goldBlind bool, err error) { if !goldBlindEquivalenceEnabled() { rendered, renderErr := renderPrompt(equivalencePromptTemplate, promptCtx.asTemplateData()) return rendered, false, renderErr mode := EquivalencePromptModeStandard if goldBlindEquivalenceEnabled() { mode = EquivalencePromptModeGoldBlind } rendered, err := RenderEquivalencePromptForMode(promptCtx, mode) return rendered, mode == EquivalencePromptModeGoldBlind, err}// RenderEquivalencePromptForMode uses recorded measurement authority, never the process environment.func RenderEquivalencePromptForMode(promptCtx PromptContext, mode EquivalencePromptMode) (string, error) { switch mode { case EquivalencePromptModeStandard: return renderPrompt(equivalencePromptTemplate, promptCtx.asTemplateData()) case EquivalencePromptModeGoldBlind: data := promptCtx.asTemplateData() delete(data, "GoldPatch") return renderPrompt(equivalenceGoldBlindPromptTemplate, data) default: return "", fmt.Errorf("unknown equivalence prompt mode %q", mode) } data := promptCtx.asTemplateData() delete(data, "GoldPatch") rendered, renderErr := renderPrompt(equivalenceGoldBlindPromptTemplate, data) return rendered, true, renderErr}func runPerCommandTests( cmdCfg.Commands = []string{cmd} goldRun, err := RunGoldBaselineTests(infraCtx, inputs, cmdCfg) gr.EnvCache = goldRun.EnvCache gr.Result = TestCommandResult{Command: cmd} gr.Result = TestCommandResult{Command: cmd, AttemptCount: 1} if err != nil { gr.Err = err if mode := inferInfraFailureModeFromError(err); mode != "" { if mode := retryableVerifierFailureMode(goldRun, err); mode != "" { gr.Result.GoldOutcome = TestOutcomeFail gr.Result.GoldFailureMode = mode gr.IsInfra = truefunc runPerCommandTests( gr.Result.GoldOutcome = TestOutcomeUnknown gr.Notes = append(gr.Notes, fmt.Sprintf("gold baseline failed for %q: %v", cmd, err)) } return if !isRetryableGoldInfrastructureFailure(gr.Result.GoldFailureMode) { return } } gr.EnvCache = goldRun.EnvCache applyGoldRunResult(gr, goldRun) if gr.Result.GoldOutcome == TestOutcomeFail && isRetryableGoldInfrastructureFailure(gr.Result.GoldFailureMode) && budgetCtx.Err() == nil { if isUnsetFailureMode(gr.Result.GoldFailureMode) { gr.Result.GoldFailureMode = retryableVerifierFailureMode(goldRun, err) } if gr.Result.GoldOutcome != TestOutcomePass && isRetryableGoldInfrastructureFailure(gr.Result.GoldFailureMode) && budgetCtx.Err() == nil { beginGoldRetry(&gr.Result, goldRun) recordTestRetry(&gr.Result, gr.Result.GoldFailureMode) retryCfg := goldRetryAttemptConfig(overrideCfg, gr.Index, 2) retryCfg.Commands = []string{cmd} retryRun, retryErr := RunGoldBaselineTests(infraCtx, inputs, retryCfg)func runPerCommandTests( gr.Result.GoldRetried = true finishGoldRetry(&gr.Result, retryRun) if gr.Result.GoldOutcome == TestOutcomePass { gr.Result.RecoveredAfterRetry = true gr.Err = nil gr.IsInfra = false gr.Notes = append(gr.Notes, fmt.Sprintf("gold baseline for %q recovered on retry after transient dependency fetch", cmd)) } else { gr.Notes = append(gr.Notes, fmt.Sprintf("gold baseline retry for %q did not recover", cmd))func runPerCommandTests( cmdCfg := overrideCfg cmdCfg.Commands = []string{entry.cmd} or.Attempted = true or.Result.AttemptCount++ overrideRun, err := RunOverrideTests(budgetCtx, inputs, cmdCfg) or.EnvCache = overrideRun.EnvCache if err != nil { if mode := inferInfraFailureModeFromError(err); mode != "" { if mode := retryableVerifierFailureMode(overrideRun, err); mode != "" { or.Result.AgentFailureMode = mode if mode == "timeout" { or.Notes = append(or.Notes, fmt.Sprintf("agent retest timeout for %q", entry.cmd))func runPerCommandTests( or.Notes = append(or.Notes, fmt.Sprintf("agent retest failed for %q: %v", entry.cmd, err)) or.Result.AgentOutcome = TestOutcomeUnknown or.Err = err return if !isRetryableGoldInfrastructureFailure(or.Result.AgentFailureMode) { return } } or.Result.AgentOutcome = testOutcomeFromTrial(overrideRun.Trial) or.Result.AgentTrialName = overrideRun.Trial.TrialName or.Result.AgentFailureMode = overrideRun.Trial.FailureMode or.Result.AgentFailureMode = retryableVerifierFailureMode(overrideRun, err) // Retry once if agent failed but gold passed. if or.Result.AgentOutcome == TestOutcomeFail && or.Result.GoldOutcome == TestOutcomePass && budgetCtx.Err() == nil { // Retry only a typed transient infrastructure failure; assertions are terminal. if or.Result.AgentOutcome != TestOutcomePass && isRetryableGoldInfrastructureFailure(or.Result.AgentFailureMode) && or.Result.GoldOutcome == TestOutcomePass && budgetCtx.Err() == nil { retryCfg := overrideCfg retryCfg.Commands = []string{entry.cmd} recordTestRetry(&or.Result, or.Result.AgentFailureMode) or.Result.AgentRetried = true retryRun, retryErr := RunOverrideTests(budgetCtx, inputs, retryCfg) or.RetryEnvCache = &retryRun.EnvCache or.Result.AgentOutcome = testOutcomeFromTrial(retryRun.Trial) or.Result.AgentTrialName = retryRun.Trial.TrialName or.Result.AgentFailureMode = retryableVerifierFailureMode(retryRun, retryErr) or.Err = retryErr if retryErr == nil { retryOutcome := testOutcomeFromTrial(retryRun.Trial) if retryOutcome == TestOutcomePass {func runPerCommandTests( or.Result.AgentTrialName = retryRun.Trial.TrialName or.Result.AgentFailureMode = retryRun.Trial.FailureMode or.Result.AgentRetried = true or.Result.RecoveredAfterRetry = true or.Err = nil or.Notes = append(or.Notes, fmt.Sprintf("agent retest for %q succeeded on retry", entry.cmd)) } }func runGoldBatchSlice( cleanups := []func(){} for _, idx := range indexes { gr := &goldResults[idx] priorResult := gr.Result priorRetried, priorEvidence := gr.Result.GoldRetried, gr.Result.GoldRetryEvidence gr.IsInfra = false gr.IsGlobalInfra = false gr.Err = nil if ctx.Err() != nil { gr.Result = TestCommandResult{ Command: gr.Command, GoldOutcome: TestOutcomeUnknown, GoldRetried: priorRetried, GoldRetryEvidence: priorEvidence, Command: gr.Command, GoldOutcome: TestOutcomeUnknown, GoldRetried: priorRetried, GoldRetryEvidence: priorEvidence, AttemptCount: priorResult.AttemptCount, RetryCount: priorResult.RetryCount, RetryReasons: priorResult.RetryReasons, RecoveredAfterRetry: priorResult.RecoveredAfterRetry, } gr.Err = ctx.Err() continuefunc runGoldBatchSlice( stageRoot, cacheResult, cleanup, err := stageGoldBaselineTask(ctx, inputs, []string{commands[idx]}, false, overrideCfg.OutputDir) gr.EnvCache = cacheResult gr.Result = TestCommandResult{ Command: gr.Command, GoldRetried: priorRetried, GoldRetryEvidence: priorEvidence, Command: gr.Command, GoldRetried: priorRetried, GoldRetryEvidence: priorEvidence, AttemptCount: priorResult.AttemptCount, RetryCount: priorResult.RetryCount, RetryReasons: priorResult.RetryReasons, RecoveredAfterRetry: priorResult.RecoveredAfterRetry, } if err != nil { gr.Err = errfunc runGoldBatchSlice( gr.Result.GoldRetried = true gr.Result.GoldRetryEvidence = &TestRetryEvidence{First: *gr.FirstRetryEvidence} } recordTestRetry(&gr.Result, FailureModeInfraDependencyFetch) gr.RetryDispatched = true } } for _, item := range items { var idx int fmt.Sscanf(item.ProjectionKey, "gold-%d", &idx) if attempt == 1 { goldResults[idx].Result.AttemptCount++ } } results, err := batchRunner.RunBatch(ctx, harness.BatchRunConfig{ OutputDir: filepath.Join(filepath.Dir(items[0].SourceTaskDir), ".tb-runs"), RunID: fmt.Sprintf("validate-gold-batch-%d", time.Now().UnixNano()),func runGoldBatchSlice( evidence := retainBatchGoldRetryAttemptEvidence(projected, gr.Result.GoldFailureMode, overrideCfg, gr.Index, attempt) gr.FirstRetryEvidence = &evidence } if attempt > 1 && gr.Result.GoldOutcome == TestOutcomePass { gr.Result.RecoveredAfterRetry = true } if attempt > 1 && gr.Result.GoldRetryEvidence != nil { evidence := retainBatchGoldRetryAttemptEvidence(projected, gr.Result.GoldFailureMode, overrideCfg, gr.Index, attempt) gr.Result.GoldRetryEvidence.Retry = &evidencefunc runOverrideBatchSlice( return } for _, item := range items { var idx int fmt.Sscanf(item.ProjectionKey, "override-%d", &idx) overrideResults[idx-offset].Result.AttemptCount++ } results, err := batchRunner.RunBatch(ctx, harness.BatchRunConfig{ OutputDir: filepath.Join(filepath.Dir(items[0].SourceTaskDir), ".tb-runs"), RunID: fmt.Sprintf("validate-override-batch-%d", time.Now().UnixNano()),func runOverrideBatchSlice( projected := results[fmt.Sprintf("override-%d", offset+i)] or.Result.AgentOutcome = testOutcomeFromTrial(projected.Trial) or.Result.AgentTrialName = projected.Trial.TrialName or.Result.AgentFailureMode = projected.Trial.FailureMode if or.Result.AgentOutcome == TestOutcomeFail && or.Result.GoldOutcome == TestOutcomePass && ctx.Err() == nil { or.Result.AgentFailureMode = classifyBatchGoldFailureMode(projected) if or.Result.AgentOutcome != TestOutcomePass && isRetryableGoldInfrastructureFailure(or.Result.AgentFailureMode) && or.Result.GoldOutcome == TestOutcomePass && ctx.Err() == nil { stageRoot, cacheResult, cleanup, err := stageOverrideTask(ctx, inputs, []string{or.Command}, false, overrideCfg.OutputDir) if err == nil { or.RetryEnvCache = &cacheResultfunc runOverrideBatchSlice( if len(retryItems) == 0 { return } for _, idx := range retryIndexes { or := &overrideResults[idx] recordTestRetry(&or.Result, or.Result.AgentFailureMode) or.Result.AgentRetried = true } retryResults, err := batchRunner.RunBatch(ctx, harness.BatchRunConfig{ OutputDir: filepath.Join(filepath.Dir(retryItems[0].SourceTaskDir), ".tb-runs"), RunID: fmt.Sprintf("validate-override-retry-batch-%d", time.Now().UnixNano()),func runOverrideBatchSlice( HarnessCLICacheMode: overrideCfg.HarnessCLICacheMode, Items: retryItems, }) if err != nil { return } for _, idx := range retryIndexes { or := &overrideResults[idx] projected := retryResults[fmt.Sprintf("retry-%d", offset+idx)] if testOutcomeFromTrial(projected.Trial) == TestOutcomePass { or.Result.AgentOutcome = TestOutcomePass or.Result.AgentTrialName = projected.Trial.TrialName or.Result.AgentFailureMode = projected.Trial.FailureMode or.Result.AgentRetried = true or.Result.AgentOutcome = testOutcomeFromTrial(projected.Trial) or.Result.AgentTrialName = projected.Trial.TrialName or.Result.AgentFailureMode = classifyBatchGoldFailureMode(projected) or.Err = err if err != nil { if isUnsetFailureMode(or.Result.AgentFailureMode) { or.Result.AgentFailureMode = inferInfraFailureModeFromError(err) } or.Notes = append(or.Notes, fmt.Sprintf("agent retest retry for %q failed: %v", or.Command, err)) } if err == nil && or.Result.AgentOutcome == TestOutcomePass { or.Result.RecoveredAfterRetry = true or.Notes = append(or.Notes, fmt.Sprintf("agent retest for %q succeeded on retry", or.Command)) } }go: golang.org/x/sys@v0.42.0: Get "https://proxy.golang.org/golang.org/x/sys/@v/ t.Fatalf("command results = %d, want 1", len(summary.CommandResults)) } result := summary.CommandResults[0] if result.AttemptCount != 3 || result.RetryCount != 1 || !result.RecoveredAfterRetry || len(result.RetryReasons) != 1 || result.RetryReasons[0] != FailureModeInfraDependencyFetch { t.Fatalf("retry metadata = %+v", result) } if !result.GoldRetried || result.GoldOutcome != TestOutcomePass || result.GoldTrialName != "gold-retry" { t.Fatalf("gold retry result = %+v", result) }go: golang.org/x/sys@v0.42.0: Get "https://proxy.golang.org/golang.org/x/sys/@v/ t.Fatalf("command results = %d, want 1", len(summary.CommandResults)) } result := summary.CommandResults[0] if result.AttemptCount != 3 || result.RetryCount != 1 || !result.RecoveredAfterRetry || len(result.RetryReasons) != 1 || result.RetryReasons[0] != FailureModeInfraDependencyFetch { t.Fatalf("retry metadata = %+v", result) } if !result.GoldRetried || result.GoldOutcome != TestOutcomePass || result.GoldTrialName != "gold-retry" { t.Fatalf("gold retry result = %+v", result) }func TestRunPerCommandTestsBatchedGoldTimeoutClassifiedAsTimeBudgetExhausted(t * }}func TestRunPerCommandTestsBatchedRetriesFailedOverrideAndMarksRetried(t *testing.T) {func TestRunPerCommandTestsBatchedRetriesDependencyFetchOverrideAndMarksRetried(t *testing.T) { t.Parallel() repo, base, head := createRepoWithCommits(t) dataset := t.TempDir()func TestRunPerCommandTestsBatchedRetriesFailedOverrideAndMarksRetried(t *testin runner := &batchValidateRunner{ results: map[string]TBTrialResult{ "gold-0": {TaskID: taskID, IsResolved: &pass, TrialName: "gold-a"}, "override-0": {TaskID: taskID, IsResolved: &fail, TrialName: "override-a"}, "override-0": {TaskID: taskID, IsResolved: &fail, TrialName: "override-a", FailureMode: FailureModeInfraDependencyFetch}, "retry-0": {TaskID: taskID, IsResolved: &pass, TrialName: "retry-a"}, }, }func TestRunPerCommandTestsBatchedRetriesFailedOverrideAndMarksRetried(t *testin t.Fatalf("expected 1 command result, got %d", len(result.Tests.CommandResults)) } cmd := result.Tests.CommandResults[0] if cmd.AttemptCount != 3 || cmd.RetryCount != 1 || !cmd.RecoveredAfterRetry || len(cmd.RetryReasons) != 1 || cmd.RetryReasons[0] != FailureModeInfraDependencyFetch { t.Fatalf("retry metadata = %+v", cmd) } if !cmd.AgentRetried { t.Fatal("expected AgentRetried=true") }package validateimport "fmt"import ( "fmt" "path/filepath" "strings")// OfflinePromptInputs describes everything needed to reassemble the grader// PromptContext for a single already-evaluated cell without re-running thetype OfflinePromptInputs struct { // TBResultsRaw is the raw TB results JSON for this cell, or "" when // unavailable (e.g. no-test-signal corpora). TBResultsRaw string // EffectiveTestCommands overrides dataset commands when non-nil. An empty // non-nil slice preserves a persisted grade with no verifier commands. EffectiveTestCommands []string // PromptPatchMaxBytes caps the gold/agent patch bytes embedded in the // prompt. Values <= 0 fall back to DefaultPromptPatchMaxBytes, matching the // orchestrator/config default.type OfflinePromptInputs struct { // RepoContextOptions controls repo tree/excerpt extraction. The zero value // inherits BuildRepoContext defaults, matching the live default path. RepoContextOptions RepoContextOptions // RequireRepoContext makes reconstruction fail when the source repository // cannot be extracted, instead of grading an unavailable-context marker. RequireRepoContext bool // ExpectedArtifacts binds reconstruction to the original graded files. // When supplied, every source path and digest must be present and match. ExpectedArtifacts *ArtifactManifest}// BuildOfflinePromptContext reassembles the grader PromptContext for one celltype OfflinePromptInputs struct {// that removes the extracted repo temp dir; callers should defer it.//// The assembly intentionally mirrors internal/validate/orchestrator.go so the// resulting context is byte-for-byte identical to a live grade except for the// template version: it reuses ReadTaskInputs, truncatePatch, and// BuildRepoContext, and applies the same graceful repo-context fallback.// assembly reuses ReadTaskInputs, truncatePatch, and BuildRepoContext. Callers// can supply persisted effective commands and require usable repository context;// otherwise it applies the live path's graceful repo-context fallback.func BuildOfflinePromptContext(in OfflinePromptInputs) (PromptContext, func(), error) { inputs, err := ReadTaskInputs(in.DatasetPath, in.TaskID, in.AgentPatchPath) if err != nil {func BuildOfflinePromptContext(in OfflinePromptInputs) (PromptContext, func(), e if err := verifyRepoSourceForConsumption(inputs); err != nil { return PromptContext{}, nil, err } if in.ExpectedArtifacts != nil { current := BuildArtifactManifest(inputs) for _, pair := range []struct { name string want, got ArtifactFileManifest }{ {"agent patch", in.ExpectedArtifacts.AgentPatch, current.AgentPatch}, {"gold patch", in.ExpectedArtifacts.GoldPatch, current.GoldPatch}, {"repository", in.ExpectedArtifacts.RepoTarball, current.RepoTarball}, } { if pair.want.Path == "" || pair.want.SHA256 == "" { return PromptContext{}, nil, fmt.Errorf("missing original %s path or digest", pair.name) } if filepath.Clean(pair.want.Path) != filepath.Clean(pair.got.Path) || !strings.EqualFold(strings.TrimPrefix(pair.want.SHA256, "sha256:"), pair.got.SHA256) { return PromptContext{}, nil, fmt.Errorf("original %s provenance mismatch", pair.name) } } } maxBytes := in.PromptPatchMaxBytes if maxBytes <= 0 {func BuildOfflinePromptContext(in OfflinePromptInputs) (PromptContext, func(), e } goldPatchPrompt, goldPatchTruncation := truncatePatch(inputs.GoldPatch, maxBytes) agentPatchPrompt, agentPatchTruncation := truncatePatch(inputs.AgentPatch, maxBytes) if in.ExpectedArtifacts != nil && (goldPatchTruncation.Truncated || agentPatchTruncation.Truncated) { return PromptContext{}, nil, fmt.Errorf("reconstructed prompt patches would be truncated; original context budgets are unavailable") } testCommands := inputs.TestCommands if in.EffectiveTestCommands != nil { testCommands = append([]string{}, in.EffectiveTestCommands...) } // Mirror orchestrator.go: on repo-context failure, degrade RepoTree to an // "unavailable: <err>" marker and continue rather than failing the build.func BuildOfflinePromptContext(in OfflinePromptInputs) (PromptContext, func(), e repoCtx := RepoContext{} builtRepoCtx, repoCleanup, repoErr := BuildRepoContext(inputs.RepoTarballPath, in.RepoContextOptions) if repoErr != nil { if in.RequireRepoContext { return PromptContext{}, nil, fmt.Errorf("build required repo context: %w", repoErr) } builtRepoCtx = RepoContext{ RepoTree: fmt.Sprintf("unavailable: %v", repoErr), } } else { cleanup = repoCleanup if in.ExpectedArtifacts != nil && (builtRepoCtx.RepoTreeTruncation.Truncated || builtRepoCtx.RepoExcerptsTruncation.Truncated) { if cleanup != nil { cleanup() } return PromptContext{}, nil, fmt.Errorf("reconstructed repository context would be truncated; original context budgets are unavailable") } } repoCtx = builtRepoCtxfunc BuildOfflinePromptContext(in OfflinePromptInputs) (PromptContext, func(), e TaskYAML: inputs.TaskYAML, GoldPatch: goldPatchPrompt, AgentPatch: agentPatchPrompt, TestCommands: inputs.TestCommands, TestCommands: testCommands, TBResults: in.TBResultsRaw, RepoPath: repoCtx.RepoPath, RepoTree: repoCtx.RepoTree,func BuildOfflinePromptContext(in OfflinePromptInputs) (PromptContext, func(), e GoldPatchTruncated: goldPatchTruncation.Truncated, }, cleanup, nil}// RenderReviewPrompt renders the built-in review template from supplied evidence.func RenderReviewPrompt(promptCtx PromptContext) (string, error) { return renderPrompt(reviewPromptTemplate, promptCtx.asTemplateData())}func TestBuildOfflinePromptContextDegradesWhenTarballUnextractable(t *testing.T) t.Fatalf("expected agent patch to be populated, got %q", promptCtx.AgentPatch) }}func TestBuildOfflinePromptContextRequiresUsableRepositoryWhenRequested(t *testing.T) { datasetPath, taskID, agentPatchPath := writeOfflineTaskDir(t, false) _, cleanup, err := BuildOfflinePromptContext(OfflinePromptInputs{ DatasetPath: datasetPath, TaskID: taskID, AgentPatchPath: agentPatchPath, RequireRepoContext: true, }) if cleanup != nil { defer cleanup() } if err == nil || !strings.Contains(err.Error(), "build required repo context") { t.Fatalf("expected required repository extraction failure, got %v", err) }}func TestBuildOfflinePromptContextUsesEffectiveVerifierCommands(t *testing.T) { datasetPath, taskID, agentPatchPath := writeOfflineTaskDir(t, true) for _, commands := range [][]string{nil, {}, {"effective verifier"}} { ctx, cleanup, err := BuildOfflinePromptContext(OfflinePromptInputs{ DatasetPath: datasetPath, TaskID: taskID, AgentPatchPath: agentPatchPath, EffectiveTestCommands: commands, }) if cleanup != nil { defer cleanup() } if err != nil { t.Fatal(err) } want := commands if commands == nil { want = []string{"pytest -q"} } if !reflect.DeepEqual(ctx.TestCommands, want) { t.Fatalf("effective commands %v: got %v, want %v", commands, ctx.TestCommands, want) } }}func TestBuildOfflinePromptContextRejectsMutatedOriginalArtifacts(t *testing.T) { for _, artifact := range []string{"agent patch", "gold patch", "repository"} { t.Run(artifact, func(t *testing.T) { dataset, taskID, patch := writeOfflineTaskDir(t, true) inputs, err := ReadTaskInputs(dataset, taskID, patch) if err != nil { t.Fatal(err) } original := BuildArtifactManifest(inputs) path := patch if artifact == "gold patch" { path = inputs.GoldPatchPath } if artifact == "repository" { path = inputs.RepoTarballPath } if err := os.WriteFile(path, []byte("mutated evidence"), 0o644); err != nil { t.Fatal(err) } _, cleanup, err := BuildOfflinePromptContext(OfflinePromptInputs{ DatasetPath: dataset, TaskID: taskID, AgentPatchPath: patch, ExpectedArtifacts: &original, RequireRepoContext: true, }) if cleanup != nil { defer cleanup() } if err == nil || !strings.Contains(err.Error(), artifact+" provenance mismatch") { t.Fatalf("expected original %s mismatch, got %v", artifact, err) } }) }}func TestBuildOfflinePromptContextRejectsAbsentOriginalArtifactDigest(t *testing.T) { dataset, taskID, patch := writeOfflineTaskDir(t, true) inputs, err := ReadTaskInputs(dataset, taskID, patch) if err != nil { t.Fatal(err) } original := BuildArtifactManifest(inputs) original.AgentPatch.SHA256 = "" _, cleanup, err := BuildOfflinePromptContext(OfflinePromptInputs{ DatasetPath: dataset, TaskID: taskID, AgentPatchPath: patch, ExpectedArtifacts: &original, }) if cleanup != nil { defer cleanup() } if err == nil || !strings.Contains(err.Error(), "missing original agent patch") { t.Fatalf("expected absent original provenance failure, got %v", err) }}func TestBuildOfflinePromptContextRejectsNewTruncationWithOriginalProvenance(t *testing.T) { dataset, taskID, patch := writeOfflineTaskDir(t, true) if err := os.WriteFile(patch, []byte(largePatch(4_000)), 0o644); err != nil { t.Fatal(err) } inputs, err := ReadTaskInputs(dataset, taskID, patch) if err != nil { t.Fatal(err) } original := BuildArtifactManifest(inputs) _, cleanup, err := BuildOfflinePromptContext(OfflinePromptInputs{ DatasetPath: dataset, TaskID: taskID, AgentPatchPath: patch, ExpectedArtifacts: &original, PromptPatchMaxBytes: 600, }) if cleanup != nil { defer cleanup() } if err == nil || !strings.Contains(err.Error(), "would be truncated") { t.Fatalf("expected new truncation refusal, got %v", err) }}const (var coverageRepairRetryBackoffs = []time.Duration{time.Second, 2 * time.Second}type CoverageRepairConfig struct { EquivalenceAI AIClient EquivalencePrompt string EquivalencePromptContext *PromptContext EquivalencePromptMode EquivalencePromptMode ReviewAI AIClient ReviewPrompt string ReviewPromptContext *PromptContext Existing ValidationResult AI AIClient AIModelID stringtype CoverageRepairConfig struct {}type CoverageRepairIssue struct { AttemptCount int `json:"attempt_count,omitempty"` RetryCount int `json:"retry_count,omitempty"` RetryReasons []string `json:"retry_reasons,omitempty"` Dimension string `json:"dimension"` Reason string `json:"reason"` Category string `json:"category,omitempty"`func RepairCoverage(ctx context.Context, cfg CoverageRepairConfig) (CoverageRepa updated := false if cfg.RepairEquivalence { equivalence, repaired, issue := repairEquivalenceFromPrompt(ctx, ai, cfg.Existing.Equivalence, cfg.AIModelID, cfg.ReviewParseRetries) source := cfg.Existing.Equivalence if cfg.EquivalencePrompt != "" { source.Prompt = cfg.EquivalencePrompt } mode := source.PromptMode if cfg.EquivalencePromptMode != "" { if mode != "" && mode != cfg.EquivalencePromptMode { return result, errors.New("equivalence repair prompt mode differs from original measurement") } mode = cfg.EquivalencePromptMode } if cfg.EquivalencePromptContext != nil { rendered, err := RenderEquivalencePromptForMode(*cfg.EquivalencePromptContext, mode) if err != nil { return result, err } if cfg.EquivalencePrompt != "" && cfg.EquivalencePrompt != rendered { return result, errors.New("equivalence repair prompt differs from supplied context") } source.Prompt = rendered } source.PromptMode = mode dimensionAI := cfg.EquivalenceAI if dimensionAI == nil { dimensionAI = ai } history := newGradeAttemptClient(dimensionAI) equivalence, repaired, issue := repairEquivalenceFromPrompt(ctx, history, source, cfg.AIModelID, cfg.ReviewParseRetries) if repaired { equivalence.PromptMode = mode if cfg.EquivalencePromptContext != nil { pc := *cfg.EquivalencePromptContext if mode == EquivalencePromptModeGoldBlind { pc.GoldPatchTruncated = false } equivalence = annotateEquivalenceTruncation(equivalence, pc) } history.annotateEquivalence(&equivalence) mergeEquivalenceRepairHistory(&equivalence, source) } if issue != nil { issue.AttemptCount = history.attempts issue.RetryCount = max(0, history.attempts-1) issue.RetryReasons = append([]string(nil), history.reasons...) result.Unresolved = append(result.Unresolved, *issue) } else { result.Validation.Equivalence = equivalencefunc RepairCoverage(ctx context.Context, cfg CoverageRepairConfig) (CoverageRepa if strings.TrimSpace(source.Prompt) == "" && cfg.Existing.Review != nil { source = *cfg.Existing.Review } review, repaired, issue := repairReviewFromPrompt(ctx, ai, source, cfg.AIModelID, cfg.ReviewParseRetries) if cfg.ReviewPrompt != "" { source.Prompt = cfg.ReviewPrompt } if cfg.ReviewPromptContext != nil { rendered, err := renderPrompt(reviewPromptTemplate, cfg.ReviewPromptContext.asTemplateData()) if err != nil { return result, err } if cfg.ReviewPrompt != "" && cfg.ReviewPrompt != rendered { return result, errors.New("review repair prompt differs from supplied context") } source.Prompt = rendered } if source.Prompt != resolvedRepairReview(cfg.Existing).Prompt { source.Output = "" } dimensionAI := cfg.ReviewAI if dimensionAI == nil { dimensionAI = ai } history := newGradeAttemptClient(dimensionAI) review, repaired, issue := repairReviewFromPromptContext(ctx, history, source, cfg.AIModelID, cfg.ReviewParseRetries, cfg.ReviewPromptContext) if repaired && history.attempts > 0 { history.annotateReview(&review) mergeReviewRepairHistory(&review, source) } if repaired && cfg.ReviewPromptContext != nil { review = annotateReviewTruncation(review, *cfg.ReviewPromptContext) } if issue != nil { issue.AttemptCount = history.attempts issue.RetryCount = max(0, history.attempts-1) issue.RetryReasons = append([]string(nil), history.reasons...) result.Unresolved = append(result.Unresolved, *issue) } else { result.Validation.CodeReview = reviewfunc RepairCoverage(ctx context.Context, cfg CoverageRepairConfig) (CoverageRepa}func repairEquivalenceFromPrompt(ctx context.Context, ai AIClient, existing EquivalenceResult, overrideModelID string, parseRetries int) (EquivalenceResult, bool, *CoverageRepairIssue) { prompt := strings.TrimSpace(existing.Prompt) if prompt == "" { prompt := existing.Prompt if strings.TrimSpace(prompt) == "" { return existing, false, &CoverageRepairIssue{ Dimension: coverageRepairDimensionEquivalence, Reason: "missing_prompt",func repairEquivalenceFromPrompt(ctx context.Context, ai AIClient, existing Equi parsed.Status = AIStatusUsed parsed.EvaluatorModel = resolveRepairEvaluatorModel(existing.EvaluatorModel, overrideModelID) parsed.PromptMode = existing.PromptMode parsed.Truncated = existing.Truncated parsed.TruncationReason = existing.TruncationReason parsed.Prompt = prompt parsed.Output = output return parsed, true, nilfunc reviewVerdictIsGuardSuppressible(result ReviewResult) bool {}func repairReviewFromPrompt(ctx context.Context, ai AIClient, existing ReviewResult, overrideModelID string, parseRetries int) (ReviewResult, bool, *CoverageRepairIssue) { prompt := strings.TrimSpace(existing.Prompt) if prompt == "" { return repairReviewFromPromptContext(ctx, ai, existing, overrideModelID, parseRetries, nil)}func repairReviewFromPromptContext(ctx context.Context, ai AIClient, existing ReviewResult, overrideModelID string, parseRetries int, promptCtx *PromptContext) (ReviewResult, bool, *CoverageRepairIssue) { prompt := existing.Prompt if strings.TrimSpace(prompt) == "" { return existing, false, &CoverageRepairIssue{ Dimension: coverageRepairDimensionCodeReview, Reason: "missing_prompt",func repairReviewFromPrompt(ctx context.Context, ai AIClient, existing ReviewRes // re-apply that guard, so such verdicts must be resampled, never recovered. if existing.Status == AIStatusUnavailable && strings.TrimSpace(existing.Output) != "" { if reparsed, reparseErr := parseReviewOutput(existing.Output); reparseErr == nil && !reviewVerdictIsGuardSuppressible(reparsed) { ((promptCtx == nil && !reviewVerdictIsGuardSuppressible(reparsed)) || (promptCtx != nil && validateReviewAgainstPromptContext(reparsed, *promptCtx) == nil)) { reparsed.Status = AIStatusUsed reparsed.Prompt = prompt reparsed.Output = existing.Outputfunc repairReviewFromPrompt(ctx context.Context, ai AIClient, existing ReviewRes if reparsed.EvaluatorModel == "" { reparsed.EvaluatorModel = strings.TrimSpace(overrideModelID) } reparsed.AttemptCount = existing.AttemptCount reparsed.RetryCount = existing.RetryCount reparsed.RetryReasons = append([]string(nil), existing.RetryReasons...) reparsed.RecoveredAfterRetry = existing.RecoveredAfterRetry reparsed.Truncated = existing.Truncated reparsed.TruncationReason = existing.TruncationReason return reparsed, true, nilfunc repairReviewFromPrompt(ctx context.Context, ai AIClient, existing ReviewRes } parsed, parseErr := parseReviewOutput(output) if parseErr == nil && promptCtx != nil { parseErr = validateReviewAgainstPromptContext(parsed, *promptCtx) } for attempt := 0; parseErr != nil && attempt < normalizedReviewParseRetries(parseRetries); attempt++ { retryPrompt := buildReviewRetryPrompt(prompt, output, parseErr) retryOutput, retryErr := runAIWithRetries(ctx, ai, retryPrompt)func repairReviewFromPrompt(ctx context.Context, ai AIClient, existing ReviewRes return existing, false, newReviewRuntimeFailureIssue(retryErr) } parsed, parseErr = parseReviewOutput(retryOutput) if parseErr == nil && promptCtx != nil { parseErr = validateReviewAgainstPromptContext(parsed, *promptCtx) } output = retryOutput } if parseErr != nil { return existing, false, classifyReviewParseIssue(parseErr) } if promptCtx == nil && reviewVerdictIsGuardSuppressible(parsed) { return existing, false, classifyReviewParseIssue(errors.New("review repair requires original verifier context for speculative blocker verdict")) } parsed.Truncated = existing.Truncated parsed.TruncationReason = existing.TruncationReason parsed.Status = AIStatusUsed parsed.Prompt = prompt parsed.Output = outputfunc repairReviewFromPrompt(ctx context.Context, ai AIClient, existing ReviewRes}func runAIWithRetries(ctx context.Context, ai AIClient, prompt string) (string, error) { var lastErr error for attempt := 0; attempt <= len(coverageRepairRetryBackoffs); attempt++ { output, err := ai.Run(ctx, prompt) if err == nil { return output, nil } lastErr = err if errors.Is(err, ErrAIDisabled) || errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { break } if attempt >= len(coverageRepairRetryBackoffs) { break } select { case <-ctx.Done(): return "", ctx.Err() case <-time.After(coverageRepairRetryBackoffs[attempt]): } if history, ok := ai.(*gradeAttemptClient); ok { return history.Run(ctx, prompt) } return "", lastErr return newGradeAttemptClient(ai).Run(ctx, prompt)}func normalizedReviewParseRetries(parseRetries int) int {func appendReviewNote(existing, extra string) string { }}func RunReview(ctx context.Context, ai AIClient, promptCtx PromptContext) ReviewResult {func RunReview(ctx context.Context, ai AIClient, promptCtx PromptContext) (result ReviewResult) { history := newGradeAttemptClient(ai) defer func() { history.annotateReview(&result) }() ai = history return annotateReviewTruncation(runReview(ctx, ai, promptCtx), promptCtx)}type TestVerifierEvidence struct {}type TestCommandResult struct { Command string `json:"command"` GoldOutcome TestOutcome `json:"gold_outcome,omitempty"` GoldTrialName string `json:"gold_tb_trial_name,omitempty"` GoldFailureMode string `json:"gold_failure_mode,omitempty"` GoldRetried bool `json:"gold_retried,omitempty"` GoldRetryEvidence *TestRetryEvidence `json:"gold_retry_evidence,omitempty"` AgentOutcome TestOutcome `json:"agent_outcome,omitempty"` AgentTrialName string `json:"agent_tb_trial_name,omitempty"` AgentFailureMode string `json:"agent_failure_mode,omitempty"` AgentRetried bool `json:"agent_retried,omitempty"` // Counts cover dispatched gold and candidate verifier calls for this command. AttemptCount int `json:"attempt_count,omitempty"` RetryCount int `json:"retry_count,omitempty"` RetryReasons []string `json:"retry_reasons,omitempty"` RecoveredAfterRetry bool `json:"recovered_after_retry,omitempty"` Command string `json:"command"` GoldOutcome TestOutcome `json:"gold_outcome,omitempty"` GoldTrialName string `json:"gold_tb_trial_name,omitempty"` GoldFailureMode string `json:"gold_failure_mode,omitempty"` GoldRetried bool `json:"gold_retried,omitempty"` GoldRetryEvidence *TestRetryEvidence `json:"gold_retry_evidence,omitempty"` AgentOutcome TestOutcome `json:"agent_outcome,omitempty"` AgentTrialName string `json:"agent_tb_trial_name,omitempty"` AgentFailureMode string `json:"agent_failure_mode,omitempty"` AgentRetried bool `json:"agent_retried,omitempty"`}// TestRetryEvidence records the two verifier attempts that authorized andtype TestRetryAttemptEvidence struct {}type EquivalenceResult struct { AttemptCount int `json:"attempt_count,omitempty"` RetryCount int `json:"retry_count,omitempty"` RetryReasons []string `json:"retry_reasons,omitempty"` RecoveredAfterRetry bool `json:"recovered_after_retry,omitempty"` Outcome EquivalenceOutcome `json:"outcome"` Status AIStatus `json:"status"` // PromptMode records the exact built-in equivalence template variant thattype EquivalenceObligation struct {}type ReviewResult struct { AttemptCount int `json:"attempt_count,omitempty"` RetryCount int `json:"retry_count,omitempty"` RetryReasons []string `json:"retry_reasons,omitempty"` RecoveredAfterRetry bool `json:"recovered_after_retry,omitempty"` Status AIStatus `json:"status"` SchemaVersion string `json:"schema_version,omitempty"` ProfileID string `json:"profile_id,omitempty"`Recovery rules: Those repair steps preserve compare-critical metadata and existing custom grader surfaces so the arm stays compare-compatible while recovering coverage. Add `--parse-retries N` when saved grader prompts failed JSON/schema parsing. Keep the original custom rubric file path on the regrade command. JSON/schema parsing. Repair preserves recorded prompt mode, truncation, and attempt history. Missing prompts require matching original task and artifact provenance plus complete repository context; ambiguous reconstruction remains unresolved. Runtime retries cover recognized transient failures only. Keep the original custom rubric file path on the regrade command.- If `stet runs repair-ai-coverage --cr-only` still leaves `code_review` unresolved, use the summary's stable `unresolved[].reason` and optional `category`/`detail` fields to separate `model_output_shape`,package commandlistimport ( "path" "regexp" "strings" "stet/internal/shellcmd")var assignment = regexp.MustCompile(`^[A-Za-z_][A-Za-z0-9_]*=`)var duration = regexp.MustCompile(`^[0-9]+(?:\.[0-9]+)?[smhd]?$`)// TestInvocation identifies exactly one known test command. The original text// is retained, including literal environment assignments and a relative cwd.// Opaque scripts and shell evaluation are deliberately not interpreted.func TestInvocation(command string) (string, []shellcmd.FieldSpan, bool) { command = strings.TrimSpace(command) if command == "" || strings.ContainsAny(command, "\n\r`$") { return "", nil, false } spans, ok := shellcmd.FieldSpans(command) if !ok || len(spans) == 0 { return "", nil, false } i := 0 if spans[0].Value == "cd" { if len(spans) < 4 || spans[2].Value != "&&" || !relativeDirectory(spans[1].Value) { return "", nil, false } if unsafeShellControl(command[:spans[2].Start]) { return "", nil, false } i = 3 } if i >= len(spans) || unsafeShellControl(command[spans[i].Start:]) { return "", nil, false } // The sole supported control operator belongs to the proven cd prefix. for _, span := range spans[i:] { if span.Value == "&&" || span.Value == "&" { return "", nil, false } } for i < len(spans) && assignment.MatchString(spans[i].Value) { if !assignment.MatchString(command[spans[i].Start:spans[i].End]) { return "", nil, false } i++ } if i < len(spans) && spans[i].Value == "env" { i++ for i < len(spans) && assignment.MatchString(spans[i].Value) { i++ } } if i < len(spans) && spans[i].Value == "timeout" { i++ if i >= len(spans) || !duration.MatchString(spans[i].Value) { return "", nil, false } i++ } if i >= len(spans) { return "", nil, false } fields := spans[i:] value := func(n int) string { if n >= len(fields) { return "" } return fields[n].Value } switch value(0) { case "go", "cargo": ok = value(1) == "test" case "sh", "bash": ok = len(fields) == 2 && strings.HasSuffix(value(1), ".sh") && relativeDirectory(value(1)) case "pytest", "pytest-3", "vitest", "jest", "phpunit": ok = true case "python", "python3": ok = value(1) == "-m" && value(2) == "pytest" case "npm", "pnpm", "yarn": ok = value(1) == "test" || (value(1) == "run" && value(2) == "test") case "npx": ok = value(1) == "vitest" || value(1) == "jest" default: ok = false } if !ok { return "", nil, false } return command, fields, true}func relativeDirectory(directory string) bool { if directory == "" || strings.HasPrefix(directory, "-") || strings.Contains(directory, "\\") || path.IsAbs(directory) { return false } clean := path.Clean(directory) return clean != ".." && !strings.HasPrefix(clean, "../")}func unsafeShellControl(command string) bool { var quote rune escaped := false for _, r := range command { if escaped { escaped = false continue } if quote == '\'' { if r == '\'' { quote = 0 } continue } if r == '\\' { escaped = true continue } if quote == '"' { if r == '"' { quote = 0 } continue } if r == '\'' || r == '"' { quote = r continue } if strings.ContainsRune(";|&<>#()", r) { return true } } return false}package commandlistimport "testing"func TestTestInvocationPreservesProvenExecutionContext(t *testing.T) { for _, command := range []string{ "go test ./pkg -run 'TestOne|TestTwo' -count=1", "cd packages/api && FOO='a b' env BAR=2 timeout 30s python3 -m pytest tests/test_api.py -q", "npm run test -- --runInBand", "env CI=1 cargo test --locked", "pytest 'tests/test space.py'", } { got, fields, ok := TestInvocation(command) if !ok || got != command || len(fields) == 0 { t.Errorf("TestInvocation(%q) = %q, %v", command, got, ok) } }}func TestTestInvocationRejectsAmbiguousAndUnsafeWrappers(t *testing.T) { for _, command := range []string{ "echo go test ./pkg", "sh -c 'go test ./pkg'", "go test ./pkg && pytest tests", "go test ./pkg; true", "go test ./pkg || true", "cd ../outside && go test ./pkg", "env -i go test ./pkg", "timeout --signal=KILL 30 go test ./pkg", "FOO=$(touch sentinel) go test ./pkg", "go test ./pkg > result", "cd pkg&&go test ./pkg", "go test ./pkg &", "make test", "\"CI=1\" go test ./pkg", "F\"OO\"=x go test ./pkg", "cd pkg;touch && go test ./pkg", "echo tests/agent.sh", "cat tests/agent.sh", "rm tests/agent.sh", "sh -c tests/agent.sh", } { if _, _, ok := TestInvocation(command); ok { t.Errorf("accepted %q", command) } }}package h2himport ( "fmt" "path/filepath" "strings" "stet/internal/validate")// prepareCoverageRepairPrompts reconstructs only absent prompts. Stored prompts// retain their original evidence; reconstructed prompts use the sealed task// source and keep its extracted repository alive through grading.func prepareCoverageRepairPrompts(cfg *validate.CoverageRepairConfig, manifest *Manifest, artifacts TaskArtifacts) (func(), []validate.CoverageRepairIssue) { missingEq := cfg.RepairEquivalence && strings.TrimSpace(cfg.Existing.Equivalence.Prompt) == "" review := cfg.Existing.CodeReview if strings.TrimSpace(review.Prompt) == "" && cfg.Existing.Review != nil { review = *cfg.Existing.Review } missingReview := cfg.RepairCodeReview && strings.TrimSpace(review.Prompt) == "" if !missingEq && !missingReview { return nil, nil } var issues []validate.CoverageRepairIssue fail := func(dimension string, err error) { detail := "prompt reconstruction failed: " + err.Error() if len(detail) > 240 { detail = detail[:240] } issues = append(issues, validate.CoverageRepairIssue{Dimension: dimension, Reason: "missing_prompt", Detail: detail, Cause: err}) if dimension == TaskGraderEquivalence { cfg.RepairEquivalence = false } else { cfg.RepairCodeReview = false } } mode := cfg.Existing.Equivalence.PromptMode if missingEq && mode != validate.EquivalencePromptModeStandard && mode != validate.EquivalencePromptModeGoldBlind { fail(TaskGraderEquivalence, fmt.Errorf("missing or unsupported equivalence prompt mode %q", mode)) missingEq = false } if !missingEq && !missingReview { return nil, issues } truncation := cfg.Existing.PromptTruncation if truncation.AgentPatch.Truncated || truncation.GoldPatch.Truncated || truncation.RepoTree.Truncated || truncation.RepoExcerpts.Truncated || cfg.Existing.Equivalence.Truncated || review.Truncated { err := fmt.Errorf("original prompt was truncated; original context budgets are unavailable") if missingEq { fail(TaskGraderEquivalence, err) } if missingReview { fail(TaskGraderCodeReview, err) } return nil, issues } dataset := manifest.Dataset goldPath := strings.TrimSpace(cfg.Existing.ArtifactsManifest.GoldPatch.Path) if goldPath != "" { taskDir := filepath.Dir(goldPath) if filepath.Base(taskDir) != artifacts.TaskID { err := fmt.Errorf("gold patch directory does not match task %q", artifacts.TaskID) if missingEq { fail(TaskGraderEquivalence, err) } if missingReview { fail(TaskGraderCodeReview, err) } return nil, issues } dataset = filepath.Dir(taskDir) } if err := verifyCoverageRepairTaskAuthority(manifest, artifacts, dataset); err != nil { if missingEq { fail(TaskGraderEquivalence, err) } if missingReview { fail(TaskGraderCodeReview, err) } return nil, issues } resolved, _, _, err := resolveTaskArtifactsFromResults(artifacts) if err == nil { artifacts = resolved } patchPath := strings.TrimSpace(cfg.Existing.ArtifactsManifest.AgentPatch.Path) if patchPath == "" { patchPath = artifacts.ResolveAgentPatchPath() } promptCtx, cleanup, err := validate.BuildOfflinePromptContext(validate.OfflinePromptInputs{ DatasetPath: dataset, TaskID: artifacts.TaskID, AgentPatchPath: patchPath, TBResultsRaw: validate.ReadTBResultsRaw(artifacts.ResultsPath(), artifacts.TaskID), RequireRepoContext: true, EffectiveTestCommands: append([]string{}, cfg.Existing.Tests.Commands...), ExpectedArtifacts: &cfg.Existing.ArtifactsManifest, RepoContextOptions: validate.RepoContextOptions{ExcludePrefixes: cfg.Existing.ContextExcludePaths}, }) if err != nil { if missingEq { fail(TaskGraderEquivalence, err) } if missingReview { fail(TaskGraderCodeReview, err) } return nil, issues } if strings.TrimSpace(promptCtx.AgentPatch) == "" || strings.TrimSpace(promptCtx.TaskYAML) == "" { err := fmt.Errorf("task YAML and agent patch are required for prompt reconstruction") if missingEq { fail(TaskGraderEquivalence, err) } if missingReview { fail(TaskGraderCodeReview, err) } return cleanup, issues } client := cfg.AI if shell, ok := client.(validate.ShellAIClient); ok { shell.Dir = promptCtx.RepoPath client = shell } if missingEq { prompt, err := validate.RenderEquivalencePromptForMode(promptCtx, mode) if err != nil { fail(TaskGraderEquivalence, err) } else { cfg.EquivalencePrompt, cfg.EquivalencePromptMode = prompt, mode cfg.EquivalencePromptContext, cfg.EquivalenceAI = &promptCtx, client } } if missingReview { prompt, err := validate.RenderReviewPrompt(promptCtx) if err != nil { fail(TaskGraderCodeReview, err) } else { cfg.ReviewPrompt, cfg.ReviewPromptContext, cfg.ReviewAI = prompt, &promptCtx, client } } return cleanup, issues}func verifyCoverageRepairTaskAuthority(manifest *Manifest, artifacts TaskArtifacts, dataset string) error { if manifest.TaskSelection == nil || manifest.TaskSelection.PromptProjectionReceipt == "" { return fmt.Errorf("missing original task prompt projection authority") } receipt, err := LoadTaskPromptProjectionReceipt(artifacts.OutputRoot) if err != nil { return err } if err := validateTaskSelectionProjection(manifest.TaskSelection, receipt); err != nil { return err } digest, err := digestTaskContentTree(filepath.Join(dataset, artifacts.TaskID)) if err != nil { return err } for _, row := range receipt.Tasks { if row.TaskID == artifacts.TaskID { if row.TaskContentSHA256 != digest { return fmt.Errorf("original task content provenance mismatch for %q", artifacts.TaskID) } return nil } } return fmt.Errorf("missing original task content authority for %q", artifacts.TaskID)}package h2himport ( "bytes" "context" "fmt" "os" "path/filepath" "strings" "testing" "time" "stet/internal/validate")func TestPrepareCoverageRepairPromptsPreservesStoredPrompts(t *testing.T) { cfg := validate.CoverageRepairConfig{ Existing: validate.ValidationResult{ Equivalence: validate.EquivalenceResult{Prompt: "stored equivalence"}, Review: &validate.ReviewResult{Prompt: "legacy stored review"}, }, RepairEquivalence: true, RepairCodeReview: true, } cleanup, issues := prepareCoverageRepairPrompts(&cfg, &Manifest{Dataset: "missing"}, TaskArtifacts{TaskID: "task-a"}) if cleanup != nil || len(issues) != 0 || cfg.EquivalencePromptContext != nil || cfg.ReviewPromptContext != nil { t.Fatalf("stored prompts should require no reconstruction: %+v", cfg) }}func TestPrepareCoverageRepairPromptsRejectsUnknownModeWithoutBlockingStoredReview(t *testing.T) { cfg := validate.CoverageRepairConfig{ Existing: validate.ValidationResult{CodeReview: validate.ReviewResult{Prompt: "stored review"}}, RepairEquivalence: true, RepairCodeReview: true, } _, issues := prepareCoverageRepairPrompts(&cfg, &Manifest{Dataset: "missing"}, TaskArtifacts{TaskID: "task-a"}) if len(issues) != 1 || issues[0].Dimension != TaskGraderEquivalence || cfg.RepairEquivalence || !cfg.RepairCodeReview { t.Fatalf("unexpected dimension selection: %+v, issues %+v", cfg, issues) }}func TestPrepareCoverageRepairPromptsRejectsUnknownOriginalTruncationBudget(t *testing.T) { cfg := validate.CoverageRepairConfig{RepairCodeReview: true} cfg.Existing.PromptTruncation.AgentPatch.Truncated = true _, issues := prepareCoverageRepairPrompts(&cfg, &Manifest{Dataset: "missing"}, TaskArtifacts{TaskID: "task-a"}) if len(issues) != 1 || cfg.RepairCodeReview || !strings.Contains(issues[0].Detail, "original context budgets") { t.Fatalf("unknown original truncation must prevent reconstruction: %+v", issues) }}func TestPrepareCoverageRepairPromptsReconstructsPersistedModeAndVerifierContext(t *testing.T) { t.Parallel() root := t.TempDir() taskDir := filepath.Join(root, "dataset", "task-a") mustWriteFile(t, filepath.Join(taskDir, "task.yaml"), "id: task-a\ninstruction: fix greeting\n") mustWriteFile(t, filepath.Join(taskDir, "gold.patch"), "gold reference secret\n") mustWriteFile(t, filepath.Join(taskDir, "tests", "test_outputs.py"), "COMMANDS = [\"dataset test\"]\n") patch := filepath.Join(root, "agent.patch") mustWriteFile(t, patch, "diff --git a/hello.txt b/hello.txt\n+hello\n") writeAnswerSimilarityTar(t, filepath.Join(taskDir, "repo.tar.gz"), map[string]string{"hello.txt": "old\n"}, nil) existing := validate.ValidationResult{ Equivalence: validate.EquivalenceResult{PromptMode: validate.EquivalencePromptModeGoldBlind}, Tests: validate.TestResult{Commands: []string{"effective verifier"}}, } inputs, err := validate.ReadTaskInputs(filepath.Dir(taskDir), "task-a", patch) if err != nil { t.Fatal(err) } existing.ArtifactsManifest = validate.BuildArtifactManifest(inputs) manifest := sealCoverageRepairTestTask(t, root, filepath.Dir(taskDir)) cfg := validate.CoverageRepairConfig{Existing: existing, AI: validate.ShellAIClient{}, RepairEquivalence: true, RepairCodeReview: true} cleanup, issues := prepareCoverageRepairPrompts(&cfg, manifest, NewTaskArtifacts(root, VariantSpec{RunID: "run-a", ModelKey: "model-a"}, "task-a", "")) if cleanup != nil { defer cleanup() } if len(issues) != 0 { t.Fatalf("reconstruction failed: %+v", issues) } if cfg.EquivalencePromptMode != validate.EquivalencePromptModeGoldBlind || strings.Contains(cfg.EquivalencePrompt, "gold reference secret") { t.Fatalf("gold-blind provenance was lost: %s", cfg.EquivalencePrompt) } if !strings.Contains(cfg.ReviewPrompt, "effective verifier") || strings.Contains(cfg.ReviewPrompt, "dataset test") { t.Fatalf("effective verifier context was lost: %s", cfg.ReviewPrompt) } for _, client := range []validate.AIClient{cfg.EquivalenceAI, cfg.ReviewAI} { shell := client.(validate.ShellAIClient) if shell.Dir == "" || shell.Dir != cfg.ReviewPromptContext.RepoPath { t.Fatalf("missing grading repository: %+v", shell) } if _, err := os.Stat(filepath.Join(shell.Dir, "hello.txt")); err != nil { t.Fatal(err) } }}func TestPrepareCoverageRepairPromptsRejectsUnavailableRepository(t *testing.T) { root := t.TempDir() taskDir := filepath.Join(root, "dataset", "task-a") mustWriteFile(t, filepath.Join(taskDir, "task.yaml"), "id: task-a\n") mustWriteFile(t, filepath.Join(taskDir, "gold.patch"), "gold\n") mustWriteFile(t, filepath.Join(taskDir, "repo.tar.gz"), "invalid gzip") patch := filepath.Join(root, "agent.patch") mustWriteFile(t, patch, "agent\n") manifest := sealCoverageRepairTestTask(t, root, filepath.Dir(taskDir)) cfg := validate.CoverageRepairConfig{RepairCodeReview: true} inputs, err := validate.ReadTaskInputs(filepath.Dir(taskDir), "task-a", patch) if err != nil { t.Fatal(err) } cfg.Existing.ArtifactsManifest = validate.BuildArtifactManifest(inputs) cleanup, issues := prepareCoverageRepairPrompts(&cfg, manifest, NewTaskArtifacts(root, VariantSpec{RunID: "run-a"}, "task-a", "")) if cleanup != nil { defer cleanup() } if len(issues) != 1 || cfg.RepairCodeReview || cfg.ReviewPrompt != "" || !strings.Contains(issues[0].Detail, "required repo context") { t.Fatalf("repository failure should prevent reconstructed grade: %+v, issues %+v", cfg, issues) }}func sealCoverageRepairTestTask(t *testing.T, root, dataset string) *Manifest { t.Helper() selection := &TaskSelectionRecord{RealizedTaskIDs: []string{"task-a"}} receipt, err := BuildTaskPromptProjectionReceipt(dataset, root, selection, nil, "dataset", map[string]string{"task-a": "fix greeting"}, time.Time{}) if err != nil { t.Fatal(err) } if _, err := WriteTaskPromptProjectionReceipt(root, receipt); err != nil { t.Fatal(err) } return &Manifest{Dataset: dataset, TaskSelection: ApplyTaskPromptProjectionReceipt(selection, receipt)}}func TestPrepareCoverageRepairPromptsRejectsMutatedTaskYAML(t *testing.T) { root := t.TempDir() dataset := filepath.Join(root, "dataset") mustWriteFile(t, filepath.Join(dataset, "task-a", "task.yaml"), "id: task-a\ninstruction: original\n") manifest := sealCoverageRepairTestTask(t, root, dataset) mustWriteFile(t, filepath.Join(dataset, "task-a", "task.yaml"), "id: task-a\ninstruction: mutated\n") cfg := validate.CoverageRepairConfig{RepairCodeReview: true} _, issues := prepareCoverageRepairPrompts(&cfg, manifest, NewTaskArtifacts(root, VariantSpec{RunID: "run-a"}, "task-a", "")) if len(issues) != 1 || cfg.RepairCodeReview || !strings.Contains(issues[0].Detail, "task content provenance mismatch") { t.Fatalf("changed task must not reconstruct: %+v", issues) }}func TestRunRepairAICoverageReconstructsBoundSourceAtSubprocessBoundary(t *testing.T) { for _, mutate := range []bool{false, true} { t.Run(fmt.Sprintf("mutate_%t", mutate), func(t *testing.T) { root := t.TempDir() dataset := filepath.Join(root, "dataset") taskDir := filepath.Join(dataset, "task-a") mustWriteFile(t, filepath.Join(taskDir, "task.yaml"), "id: task-a\ninstruction: fix greeting\n") mustWriteFile(t, filepath.Join(taskDir, "gold.patch"), "gold reference secret\n") writeAnswerSimilarityTar(t, filepath.Join(taskDir, "repo.tar.gz"), map[string]string{"hello.txt": "old\n"}, nil) patch := filepath.Join(root, "agent.patch") mustWriteFile(t, patch, "diff --git a/hello.txt b/hello.txt\n--- a/hello.txt\n+++ b/hello.txt\n@@ -1 +1 @@\n-old\n+hello\n") manifest := sealCoverageRepairTestTask(t, root, dataset) manifest.Version, manifest.OutputRoot = ManifestVersion, root manifest.Models = []string{"model/a"} manifest.ModelKeys, manifest.RunIDs = map[string]string{"model/a": "model-a"}, map[string]string{"model/a": "run-a"} if err := SaveManifest(filepath.Join(root, "manifest.json"), manifest); err != nil { t.Fatal(err) } inputs, err := validate.ReadTaskInputs(dataset, "task-a", patch) if err != nil { t.Fatal(err) } original := validate.ValidationResult{ TaskID: "task-a", PrimarySignal: validate.PrimarySignalTests, Status: validate.StatusPass, MatrixStatus: validate.MatrixPass, Guardrails: validate.GuardrailResult{Status: validate.StatusPass}, Tests: validate.TestResult{Outcome: validate.TestOutcomePass, Strength: validate.TestStrengthStrong, Commands: []string{"effective verifier"}}, Equivalence: validate.EquivalenceResult{Status: validate.AIStatusUnavailable, Outcome: validate.EquivalenceUnknown, PromptMode: validate.EquivalencePromptModeGoldBlind}, CodeReview: validate.ReviewResult{Status: validate.AIStatusUnavailable, Signal: validate.ReviewSignalUnsure}, ArtifactsManifest: validate.BuildArtifactManifest(inputs), } validationRoot := filepath.Join(root, "validation", "model-a") mustWriteRepairValidation(t, validationRoot, "task-a", original) if mutate { mustWriteFile(t, patch, "mutated agent evidence\n") } log := filepath.Join(root, "calls") script := filepath.Join(root, "judge.py") mustWriteFile(t, script, `import json, pathlib, sysprompt = sys.stdin.read()assert pathlib.Path('hello.txt').read_text() == 'old\n'with open(sys.argv[1], 'a') as log: log.write('call\n')if 'You are reviewing' in prompt: assert 'effective verifier' in prompt scores = {name: {'score_0_4': 4, 'confidence_0_1': .95, 'rationale': 'ok', 'citations': [{'path':'hello.txt','side':'new','start_line':1,'end_line':1,'anchor_kind':'diff','head_sha':'abc1234'}]} for name in ['correctness','introduced_bug_risk','edge_case_handling','maintainability_idioms']} print(json.dumps({'schema_version':'stet.review.v1','dimension_scores':scores,'findings':[],'overall':{'confidence_overall':.95,'summary':'repair passed'}}))else: assert 'gold reference secret' not in prompt print('obligations:\n- fix greeting => MET\n\nequivalent: YES\nconfidence: 0.95\nissue_type: stylistic\nnotes: repaired')`) var stdout, stderr bytes.Buffer err = RunRepairAICoverage(context.Background(), []string{"--out", root, "--model-key", "model-a", "--ai-cmd", "python3 " + shellQuote(script) + " " + shellQuote(log), "--ai-model-id", "judge-a"}, &stdout, &stderr) if mutate { if err == nil { t.Fatal("mutated artifact repair must fail") } if _, err := os.Stat(log); !os.IsNotExist(err) { t.Fatalf("mutated source invoked grader: %v", err) } if !strings.Contains(stdout.String(), "agent patch provenance mismatch") { t.Fatalf("missing mutation reason: %s", stdout.String()) } return } if err != nil { t.Fatalf("repair failed: %v\nstdout %s\nstderr %s", err, stdout.String(), stderr.String()) } updated := mustReadRepairValidation(t, filepath.Join(validationRoot, "task-a", "validation.json")) if updated.Equivalence.PromptMode != validate.EquivalencePromptModeGoldBlind || updated.Equivalence.Status != validate.AIStatusUsed || updated.CodeReview.Status != validate.AIStatusUsed || updated.CodeReview.AttemptCount != 1 { t.Fatalf("repair lost mode or attempt metadata: %+v", updated) } if updated.ArtifactsManifest.AgentPatch.SHA256 != original.ArtifactsManifest.AgentPatch.SHA256 { t.Fatal("repair changed original source authority") } calls, err := os.ReadFile(log) if err != nil || strings.Count(string(calls), "call") != 2 { t.Fatalf("unexpected calls: %s, %v", calls, err) } }) }}package validateimport ( "context" "errors" "net" "strings" "time" "stet/internal/runtimefailure")// gradeAttemptClient retains every dispatch, including runtime and parse retries.// One instance belongs to one measurement dimension and must not be shared.type gradeAttemptClient struct { ai AIClient attempts int reasons []string previousSucceeded bool}func newGradeAttemptClient(ai AIClient) *gradeAttemptClient { if ai == nil { ai = NoopAIClient{} } return &gradeAttemptClient{ai: ai}}func (a *gradeAttemptClient) Run(ctx context.Context, prompt string) (string, error) { if a.previousSucceeded { a.reasons = append(a.reasons, "model_output_shape") } a.previousSucceeded = false for attempt := 0; ; attempt++ { if err := ctx.Err(); err != nil { return "", err } a.attempts++ output, err := a.ai.Run(ctx, prompt) if err == nil { a.previousSucceeded = true return output, nil } reason := recoverableGradeFailure(err) if reason == "" || attempt >= len(coverageRepairRetryBackoffs) { return "", err } select { case <-ctx.Done(): return "", ctx.Err() case <-time.After(coverageRepairRetryBackoffs[attempt]): } a.reasons = append(a.reasons, reason) }}func recoverableGradeFailure(err error) string { if errors.Is(err, ErrAIDisabled) || errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { return "" } c := runtimefailure.ClassifyError(err) if c.Kind != runtimefailure.KindUnknown { if c.Kind == runtimefailure.KindQuota && (c.Reason == "rate_limit" || c.Reason == "overloaded_error") { return c.Reason } return "" } var network net.Error if errors.As(err, &network) && (network.Timeout() || network.Temporary()) { return "transport_failure" } text := strings.ToLower(err.Error()) for _, marker := range []string{"connection reset", "transport reset", "connection refused", "tls handshake timeout", "temporary failure in name resolution"} { if strings.Contains(text, marker) { return "transport_failure" } } return ""}func (a *gradeAttemptClient) annotateEquivalence(r *EquivalenceResult) { r.AttemptCount = a.attempts r.RetryCount = max(0, a.attempts-1) r.RetryReasons = append([]string(nil), a.reasons...) r.RecoveredAfterRetry = r.Status == AIStatusUsed && r.RetryCount > 0}func (a *gradeAttemptClient) annotateReview(r *ReviewResult) { r.AttemptCount = a.attempts r.RetryCount = max(0, a.attempts-1) r.RetryReasons = append([]string(nil), a.reasons...) r.RecoveredAfterRetry = r.Status == AIStatusUsed && r.RetryCount > 0}// A later repair continues the original measurement history. Reparse-only// recovery never calls these helpers because it dispatches no evaluator.func mergeEquivalenceRepairHistory(result *EquivalenceResult, original EquivalenceResult) { if original.AttemptCount == 0 { return } result.AttemptCount += original.AttemptCount result.RetryCount = result.AttemptCount - 1 reasons := append([]string(nil), original.RetryReasons...) reasons = append(reasons, "coverage_repair") result.RetryReasons = append(reasons, result.RetryReasons...) result.RecoveredAfterRetry = result.Status == AIStatusUsed && result.RetryCount > 0}func mergeReviewRepairHistory(result *ReviewResult, original ReviewResult) { if original.AttemptCount == 0 { return } result.AttemptCount += original.AttemptCount result.RetryCount = result.AttemptCount - 1 reasons := append([]string(nil), original.RetryReasons...) reasons = append(reasons, "coverage_repair") result.RetryReasons = append(reasons, result.RetryReasons...) result.RecoveredAfterRetry = result.Status == AIStatusUsed && result.RetryCount > 0}package validateimport ( "context" "errors" "testing")func TestRepairEquivalenceKeepsMeasurementModeAndTruncation(t *testing.T) { t.Setenv(GoldBlindEquivalenceEnv, "false") ai := &scriptedCoverageAI{outputs: []string{"bad", "obligations:\n- preserve behavior => MET\nequivalent: YES\nconfidence: 0.9\nissue_type: stylistic\nnotes: ok"}} result, err := RepairCoverage(context.Background(), CoverageRepairConfig{ Existing: ValidationResult{Equivalence: EquivalenceResult{Prompt: "original", PromptMode: EquivalencePromptModeGoldBlind, Truncated: true}}, EquivalenceAI: ai, RepairEquivalence: true, }) if err != nil { t.Fatal(err) } got := result.Validation.Equivalence if !result.RepairedEquivalence || got.PromptMode != EquivalencePromptModeGoldBlind || !got.Truncated || got.AttemptCount != 2 || got.RetryCount != 1 || !got.RecoveredAfterRetry || len(got.RetryReasons) != 1 { t.Fatalf("measurement provenance lost: %+v", got) }}func TestRepairReviewReappliesVerifierGuard(t *testing.T) { pc := PromptContext{AgentPatch: "patch", TBResults: `{"is_resolved":true}`} ai := &scriptedCoverageAI{outputs: []string{guardSuppressedFailReviewOutput(), guardSuppressedFailReviewOutput()}} result, err := RepairCoverage(context.Background(), CoverageRepairConfig{ Existing: ValidationResult{CodeReview: ReviewResult{Status: AIStatusUnavailable}}, ReviewAI: ai, ReviewPromptContext: &pc, RepairCodeReview: true, }) if err != nil { t.Fatal(err) } if result.RepairedCodeReview || len(result.Unresolved) != 1 || len(ai.prompts) != 2 { t.Fatalf("guard bypass: %+v", result) }}func TestRenderEquivalenceModeDoesNotUseEnvironment(t *testing.T) { t.Setenv(GoldBlindEquivalenceEnv, "true") pc := PromptContext{GoldPatch: "UNIQUE_GOLD"} standard, err := RenderEquivalencePromptForMode(pc, EquivalencePromptModeStandard) if err != nil { t.Fatal(err) } blind, err := RenderEquivalencePromptForMode(pc, EquivalencePromptModeGoldBlind) if err != nil { t.Fatal(err) } if standard == blind { t.Fatal("explicit modes ignored") } if _, err := RenderEquivalencePromptForMode(pc, ""); err == nil { t.Fatal("ambiguous mode accepted") }}func TestUnrecoverableGradeFailureIsNotRetried(t *testing.T) { for _, failure := range []error{errors.New("invalid API key"), errors.New("unrecognized failure"), context.Canceled} { ai := &scriptedCoverageAI{outputs: []string{""}, errs: []error{failure}} history := newGradeAttemptClient(ai) _, err := history.Run(context.Background(), "prompt") if !errors.Is(err, failure) || history.attempts != 1 { t.Fatalf("unrecoverable retry: %v, %+v", err, history) } }}func TestRepairHistoryContinuesOriginalAttempts(t *testing.T) { ai := &scriptedCoverageAI{outputs: []string{"obligations:\n- preserve behavior => MET\nequivalent: YES\nconfidence: 0.9\nissue_type: stylistic\nnotes: ok"}} original := EquivalenceResult{Prompt: "original", AttemptCount: 2, RetryCount: 1, RetryReasons: []string{"model_output_shape"}} result, err := RepairCoverage(context.Background(), CoverageRepairConfig{Existing: ValidationResult{Equivalence: original}, EquivalenceAI: ai, RepairEquivalence: true}) if err != nil { t.Fatal(err) } got := result.Validation.Equivalence if got.AttemptCount != 3 || got.RetryCount != 2 || len(got.RetryReasons) != 2 || got.RetryReasons[0] != "model_output_shape" || !got.RecoveredAfterRetry { t.Fatalf("lost original history: %+v", got) }}func TestFailedRepairRetainsDispatchHistoryInIssue(t *testing.T) { failure := errors.New("provider authentication expired") ai := &scriptedCoverageAI{outputs: []string{""}, errs: []error{failure}} original := EquivalenceResult{Prompt: "original", AttemptCount: 2} result, err := RepairCoverage(context.Background(), CoverageRepairConfig{Existing: ValidationResult{Equivalence: original}, EquivalenceAI: ai, RepairEquivalence: true}) if err != nil { t.Fatal(err) } if result.Validation.Equivalence.AttemptCount != 2 || len(result.Unresolved) != 1 || result.Unresolved[0].AttemptCount != 1 || !errors.Is(result.Unresolved[0].Cause, failure) { t.Fatalf("lost failed repair history: %+v", result) }}package validate// recordTestRetry records a dispatched extra verifier call. Recovery is set// separately only after that call produces a pass; a failed retry remains// visible even when the original failure is kept as the decision evidence.func recordTestRetry(result *TestCommandResult, reason string) { result.AttemptCount++ result.RetryCount++ result.RetryReasons = append(result.RetryReasons, normalizeFailureMode(reason))}func retryableVerifierFailureMode(run OverrideRunResult, err error) string { if !isUnsetFailureMode(run.Trial.FailureMode) { return run.Trial.FailureMode } if mode := classifyVerifierEnvironmentFailureMode(run.VerifierStdout, run.VerifierStderr); mode != "" { return mode } if mode := inferInfraFailureModeFromError(err); mode != "" { return mode } return run.Trial.FailureMode}package validateimport ( "context" "errors" "os" "path/filepath" "testing" "time" "stet/internal/harness")func TestCandidateExecutionRetriesOnlyRecoverableFailures(t *testing.T) { for _, batched := range []bool{false, true} { for _, mode := range []string{"", "assertion_failure", FailureModeInfraToolchain, FailureModeInfraDependencyFetch} { t.Run(mode+map[bool]string{false: "/sequential", true: "/batch"}[batched], func(t *testing.T) { inputs := retryTestInputs(t) pass, fail := true, false cfg := Config{TBCmd: []string{"not-harbor"}, CommandWorkers: 1, TimeBudget: time.Minute} var summary perCommandRunSummary if batched { runner := &batchValidateRunner{results: map[string]TBTrialResult{ "gold-0": {IsResolved: &pass}, "override-0": {IsResolved: &fail, FailureMode: mode}, "retry-0": {IsResolved: &pass}, }} summary = runPerCommandTestsBatched(context.Background(), time.Now(), cfg, inputs, []string{"cmd-a"}, nil, runner) } else { runner := &verifierOutputSequenceTBRunner{goldResults: []TBTrialResult{{IsResolved: &pass}}, overrideResults: []TBTrialResult{{IsResolved: &fail, FailureMode: mode}, {IsResolved: &pass}}} cfg.TestGenRunner = runner summary = runPerCommandTests(context.Background(), time.Now(), cfg, inputs, []string{"cmd-a"}, nil) } if len(summary.CommandResults) != 1 { t.Fatalf("results = %+v", summary) } result := summary.CommandResults[0] if mode == FailureModeInfraDependencyFetch { if result.AttemptCount != 3 || result.RetryCount != 1 || !result.RecoveredAfterRetry || !result.AgentRetried || result.AgentOutcome != TestOutcomePass { t.Fatalf("recovery = %+v", result) } } else if result.AttemptCount != 2 || result.RetryCount != 0 || result.AgentRetried || result.RecoveredAfterRetry || result.AgentOutcome != TestOutcomeFail { t.Fatalf("unrecoverable failure retried: %+v", result) } }) } }}type failedRetryBatchRunner struct{ batchValidateRunner }func (runner *failedRetryBatchRunner) RunBatch(ctx context.Context, cfg harness.BatchRunConfig) (map[string]harness.BatchRunResult, error) { if cfg.Items[0].PhaseTag == "validate-override-retry" { return nil, errors.New("terminal transport error") } return runner.batchValidateRunner.RunBatch(ctx, cfg)}func TestCandidateBatchRetryRecordsTransportFailure(t *testing.T) { fail := false runner := &failedRetryBatchRunner{batchValidateRunner: batchValidateRunner{results: map[string]TBTrialResult{ "override-0": {IsResolved: &fail, FailureMode: FailureModeInfraDependencyFetch, TrialName: "first"}, }}} results := []commandOverrideResult{{Command: "cmd-a", Result: TestCommandResult{GoldOutcome: TestOutcomePass, AttemptCount: 1}}} runOverrideBatchSlice(context.Background(), retryTestInputs(t), OverrideConfig{}, runner, results, 0) result := results[0] if result.Err == nil || result.Err.Error() != "terminal transport error" || result.Result.AttemptCount != 3 || result.Result.RetryCount != 1 || result.Result.RecoveredAfterRetry || result.Result.AgentOutcome != TestOutcomeUnknown || result.Result.AgentTrialName != "" || result.Result.AgentFailureMode == FailureModeInfraDependencyFetch { t.Fatalf("batch terminal error = %+v", result) }}func retryTestInputs(t *testing.T) TaskInputs { t.Helper() repo, base, head := createRepoWithCommits(t) dataset := t.TempDir() taskID := "retry-task" taskDir := filepath.Join(dataset, taskID) if err := os.MkdirAll(filepath.Join(taskDir, "tests"), 0o755); err != nil { t.Fatal(err) } if err := os.WriteFile(filepath.Join(taskDir, "task.yaml"), []byte("instruction: test"), 0o644); err != nil { t.Fatal(err) } writeGoldAndTarball(t, repo, base, head, taskDir) patch, err := os.ReadFile(filepath.Join(taskDir, "gold.patch")) if err != nil { t.Fatal(err) } agentPatch := filepath.Join(t.TempDir(), "agent.patch") if err := os.WriteFile(agentPatch, patch, 0o644); err != nil { t.Fatal(err) } inputs, err := ReadTaskInputs(dataset, taskID, agentPatch) if err != nil { t.Fatal(err) } return inputs}func TestCandidateExecutionStopsAfterOneFailedRecovery(t *testing.T) { for _, batched := range []bool{false, true} { t.Run(map[bool]string{false: "sequential", true: "batch"}[batched], func(t *testing.T) { inputs := retryTestInputs(t) pass, fail := true, false cfg := Config{TBCmd: []string{"not-harbor"}, CommandWorkers: 1, TimeBudget: time.Minute} var summary perCommandRunSummary var calls int if batched { runner := &batchValidateRunner{results: map[string]TBTrialResult{ "gold-0": {IsResolved: &pass}, "override-0": {IsResolved: &fail, FailureMode: FailureModeInfraDependencyFetch}, "retry-0": {IsResolved: &fail, FailureMode: "assertion_failure", TrialName: "terminal"}, }} summary = runPerCommandTestsBatched(context.Background(), time.Now(), cfg, inputs, []string{"cmd-a"}, nil, runner) calls = len(runner.batchCalls) } else { runner := &verifierOutputSequenceTBRunner{goldResults: []TBTrialResult{{IsResolved: &pass}}, overrideResults: []TBTrialResult{ {IsResolved: &fail, FailureMode: FailureModeInfraDependencyFetch}, {IsResolved: &fail, FailureMode: "assertion_failure", TrialName: "terminal"}, {IsResolved: &pass}, }} cfg.TestGenRunner = runner summary = runPerCommandTests(context.Background(), time.Now(), cfg, inputs, []string{"cmd-a"}, nil) calls = len(runner.calls) } result := summary.CommandResults[0] if calls != 3 || result.AttemptCount != 3 || result.RetryCount != 1 || !result.AgentRetried || result.RecoveredAfterRetry || result.AgentFailureMode != "assertion_failure" || result.AgentTrialName != "terminal" || result.AgentOutcome != TestOutcomeFail { t.Fatalf("failed recovery receipt = %+v, calls = %d", result, calls) } }) }}Production ship score 0.548 · correctness rung 0.25 · checklist 0.814 · review 0.952
Scope
Behavior
Integrity
Tests
pitfall · Retry prompt replays bad output · avoided (−2 pts if triggered)
pitfall · Unknown mode falls back silently · avoided (−2 pts if triggered)
pitfall · Two competing review grades · avoided (−2 pts if triggered)
- Reuse over reinventionrated 4
- Abstraction fitrated 4
- Naming and contractsrated 3.7
- Scope restraintrated 4
- Preserves existing guardsrated 3.3
- Documented surfacerated 3.7
- Test style fitrated 4
reviewer · The retry and replay work is thoughtfully structured and well tested, but repair still has an authority bypass: arbitrary configured prompt strings can replace persisted measurement prompts. Require a matching context-rendered prompt (or reject overrides when a stored prompt exists) before merging.
- blocking Do not allow caller-provided repair prompts to replace a persisted prompt without proving they render from the original context. `RepairCoverage` unconditionally assigns `EquivalencePrompt`/`ReviewPrompt` when non-empty, and only compares them when a context is also supplied. This creates a public bypass around the stored measurement evidence, permitting an unrelated prompt to regrade an existing result.
- praise The change consistently treats provenance and unsafe replay as fail-closed concerns, with targeted coverage for retries, command parsing, and offline prompt reconstruction.
Where GPT 6.1 Sol lands on the leaderboard
GPT 6.1 Sol sits with the best models I've measured so far at a fraction of their cost (SWE-2 Max's cost wasn't recorded).
- The two Sol runs take ranks 2 (GPT 6.1 Sol) and 7 (GPT 6 Sol). Opus 5 ranks first, Grok 4.7 High third and SWE-2 Max fourth.
- The leaderboard scores each run against the whole field, so two runs that tie head to head can still land at different ranks.
- Head to head:
- Against Opus 5: won 7, tied 9, lost 8.
- Against Grok 4.7 High: won 10, tied 5, lost 9.
- The largest gaps are against Opus 4.8 (won 15, tied 6, lost 3), DeepSeek V4.1 Flash (won 12, tied 8, lost 4), Muse Spark 1.3 (won 17, tied 5, lost 2) and GLM 5.3 Flash (won 16, tied 6, lost 2).
Rank 2 of 14 at $1.10 per task
- Rank 1, Opus 5 (Claude Code · medium): composite board score 67.0, 95% interval 56.7 to 76.6, correctness mean 0.54, $6.78 per task, median 25.0 minutes per task. Against GPT 6.1 Sol: GPT 6.1 Sol won 7, tied 9, lost 8.
- Rank 2, GPT 6.1 Sol (Codex · medium): composite board score 64.0, 95% interval 53.9 to 73.8, correctness mean 0.61, $1.10 per task, median 11.0 minutes per task.
- Rank 3, Grok 4.7 High (Cursor · high): composite board score 62.6, 95% interval 51.4 to 73.1, correctness mean 0.61, $5.76 per task, median 18.5 minutes per task. Against GPT 6.1 Sol: GPT 6.1 Sol won 10, tied 5, lost 9.
- Rank 4, SWE-2 Max (Devin · high): composite board score 62.0, 95% interval 52.7 to 71.1, correctness mean 0.58, no recorded cost, median 50.9 minutes per task. Against GPT 6.1 Sol: GPT 6.1 Sol won 7, tied 8, lost 9.
- Rank 5, Pareto 26.9 (Claude Code · medium): composite board score 59.3, 95% interval 48.8 to 69.4, correctness mean 0.62, $12.47 per task, median 38.2 minutes per task. Against GPT 6.1 Sol: GPT 6.1 Sol won 13, tied 4, lost 7.
- Rank 6, GPT 6 Luna (Codex · max): composite board score 58.8, 95% interval 49.2 to 67.5, correctness mean 0.49, $0.37 per task, median 54.6 minutes per task. Against GPT 6.1 Sol: GPT 6.1 Sol won 10, tied 7, lost 7.
- Rank 7, GPT 6 Sol (Codex · medium): composite board score 55.9, 95% interval 48.4 to 63.5, correctness mean 0.64, $3.01 per task, median 12.7 minutes per task. Against GPT 6.1 Sol: GPT 6.1 Sol won 9, tied 10, lost 5.
- Rank 8, Haiku 5.5 (Claude Code · max): composite board score 52.4, 95% interval 41.0 to 63.6, correctness mean 0.46, $3.85 per task, median 46.7 minutes per task. Against GPT 6.1 Sol: GPT 6.1 Sol won 10, tied 9, lost 5.
- Rank 9, Haiku 5.5 (Claude Code · low): composite board score 46.8, 95% interval 38.3 to 55.3, correctness mean 0.42, $0.25 per task, median 4.7 minutes per task. Against GPT 6.1 Sol: GPT 6.1 Sol won 13, tied 7, lost 4; the matchup separates.
- Rank 10, DeepSeek V4.1 Flash (dsh · max): composite board score 46.5, 95% interval 36.7 to 56.1, correctness mean 0.46, $0.49 per task over the 23 of 24 tasks with recorded spend, median 46.6 minutes per task. Against GPT 6.1 Sol: GPT 6.1 Sol won 12, tied 8, lost 4; the matchup separates.
- Rank 11, Opus 4.8 (Claude Code · medium): composite board score 41.0, 95% interval 30.7 to 51.5, correctness mean 0.47, $7.05 per task, median 17.3 minutes per task. Against GPT 6.1 Sol: GPT 6.1 Sol won 15, tied 6, lost 3; the matchup separates.
- Rank 12, Muse Spark 1.3 (Muse Code · high): composite board score 33.9, 95% interval 25.2 to 42.8, correctness mean 0.41, $0.10 per task, median 10.6 minutes per task. Against GPT 6.1 Sol: GPT 6.1 Sol won 17, tied 5, lost 2; the matchup separates.
- Rank 13, GLM 5.3 Flash (Codex · high): composite board score 28.4, 95% interval 19.8 to 38.4, correctness mean 0.38, $0.41 per task, median 17.7 minutes per task. Against GPT 6.1 Sol: GPT 6.1 Sol won 16, tied 6, lost 2; the matchup separates.
- Rank 14, GPT 6 Luna (Codex · low): composite board score 21.4, 95% interval 12.7 to 31.2, correctness mean 0.28, $0.05 per task, median 2.2 minutes per task. Against GPT 6.1 Sol: GPT 6.1 Sol won 17, tied 5, lost 2; the matchup separates.
Correctness is the average 0–1 rung, not a test pass rate. Costs cover coding attempts, excluding judging; Haiku max includes one estimate and DeepSeek has 23 recorded costs.
On the typical task GPT 6.1 Sol costs about half as much as GPT 6 Sol. The averages show a bigger gap because GPT 6 Sol had a few very expensive runs.
On these tasks, GPT 6.1 Sol is competitive with the best, at roughly a sixth of Opus 5's average cost.
Diving deeper into signals
The headline result hides some real behavioral differences in how the models work. These mostly favor GPT 6.1 Sol, the exception being that its patches are bigger.
- Correctness is close. GPT 6.1 Sol scores lower on 2 tasks and the same on 22, averaging 0.606 against 0.638. Each model is equivalent to the merged change on 10.
- Checklist goes to GPT 6.1 Sol.
- Its checklist score averages 0.579 against 0.537.
- Across the 24 task checklists, GPT 6.1 Sol missed 202 of 470 scored items against 232 of 470 for GPT 6 Sol.
- Code review goes to GPT 6.1 Sol. Its review score averages 0.965 against 0.917.
Correctness matched on 22 tasks; checklist and review means favored GPT 6.1 Sol
Mean correctness rung: 0.606 for GPT 6.1 Sol vs 0.638 for GPT 6 Sol.
Mean checklist score: 0.579 for GPT 6.1 Sol vs 0.537 for GPT 6 Sol. Scored checklist items across the 24 tasks: GPT 6.1 Sol missed 202/470; GPT 6 Sol missed 232/470.
Mean code-review score: 0.965 for GPT 6.1 Sol vs 0.917 for GPT 6 Sol.
- Patches are bigger.
- Bigger on 20 of 24, with a median of 303 changed lines against 197.
- More test lines on 20 of 24. Tests are 36% of changed lines against 29% for GPT 6 Sol; the merged changes sit at 42%.
Bigger on 20 of 24 tasks, with more of it in tests
- 3169aefa
- 15439c21
- 43493c52
- 2450ca2d
- 89dfbc27
- 232b50ba
- 6f84e978
- b28f4fe7
- 5276aa3f
- f0caded9
- 66762b4c
- 5d766dde
- e928166f
- 5e075641
- a8716b88
- 30506f8e
- 60a0e6c2
- 342d0ac0
- bbbbae09
- 87814583
- f8ae1177
- 2826765e
- d2ab0c25
- e41c2e2d
_test.go, .test. and .spec. files, test_*.py) or under testdata, __tests__ and fixtures directories. Everything else, docs included, counts as implementation. Footprint counts implementation lines only and stays out of the board score.The two correctness differences favor GPT 6 Sol. Checklist and review give GPT 6.1 Sol nine wins against three losses on the remaining tasks, with ten ties.
With GPT 6.1 Sol, there's more to review, but most of it is worth having, since the bigger patches also scored better on checklist and review.
Cost and speed
The main case for using GPT 6.1 Sol rests on cost, driven by higher token efficiency along with cheaper cached input.
Average tokens and coding cost per task, using the standard API rates recorded for these runs. These costs exclude judging:
- GPT 6.1 Sol is cheaper on 22 of 24 tasks and costs about half as much on the typical one.
- Why:
- Fewer tokens on 19 of 24, about a third fewer on the typical task.
- At those rates, cached input costs $0.10 per million for GPT 6.1 Sol against $0.20 for GPT 6 Sol. Input and output prices are the same for both.
- Billed at GPT 6 Sol's rates, GPT 6.1 Sol's tokens would cost $1.60 per task, so most of the $1.91 gap comes from using fewer tokens.
- Speed: GPT 6.1 Sol took a median 11.0 minutes against 12.7 and finished first on only 11 of 24, so it isn't meaningfully faster.
Average cost per task · OpenAI standard API rates
Fewer tokens save $1.41 a task, then the cheaper cache saves $0.50
- GPT 6 Sol11.13M tokens$3.01
- Fewer tokenssame rates, GPT 6.1 Sol's usage−$1.41
- GPT 6.1 Sol at GPT 6 Sol's rates5.24M tokens$1.60
- Cheaper cached input$0.10 per million against $0.20−$0.50
- GPT 6.1 Sol5.24M tokens$1.10
Conclusion
The bottom line is that GPT 6.1 Sol maintains GPT 6 Sol's quality while cutting costs roughly in half by using fewer tokens and charging less for the cached input tokens it does use.
In my codebase, this leads to bigger diffs that may take longer (or more tokens!) to review, though the extra code seems worth it.
Whether a model swap is safe for your team is something you can measure on your own merged changes before you roll it out.