Skip fallback needs complete, empty evidence; capture lists over-budget changes

The server skip fallback for stages with a skipped edge now applies only
when every earlier visit recorded a complete file-change capture with no
changed files and no image artifact. Any change (no repo-specific UI path
or extension list), any partial/unavailable/missing capture, a human
decision or a checkpoint-retry prefix runs the model. auto_skip=false opts
a stage out. The fallback verdict names the server fallback.

Capture compares over-budget text by hash and, in Git, lists paths it
could not compare when their git status changes, marked no_patch, so a
large workspace no longer records files: [] for a real edit. Run detail
gains a warnings list for partial/unavailable captures, also printed by
inspect on stderr.
This commit is contained in:
2026-11-04 12:56:40 +00:00
parent fa6c0864db
commit f16d61cdfa
14 changed files with 660 additions and 188 deletions
+43 -6
View File
@@ -1,6 +1,9 @@
package protocol
import "strings"
import (
"fmt"
"strings"
)
const (
RunPipeline = "run_pipeline"
@@ -338,6 +341,32 @@ type RunUsage struct {
CostUnknownStages int `json:"cost_unknown_stages,omitempty"`
}
// RunWarnings derives the run-level warnings from its steps: every visit whose
// retained file-change capture was partial or unavailable is named, because
// such evidence is not a complete workspace diff and must never be read as "no
// edits". Steps with no capture (historical, human or server-skip visits) are
// not flagged here; their File changes section already says "not recorded".
func RunWarnings(steps []RunStep) []string {
var visits []string
for _, step := range steps {
if step.FileChanges == nil || step.FileChanges.Status == "complete" {
continue
}
visits = append(visits, fmt.Sprintf("%s #%d (%s)", step.Stage, step.Sequence, step.FileChanges.Status))
}
if len(visits) == 0 {
return nil
}
const shown = 8
list := visits
extra := ""
if len(list) > shown {
extra = fmt.Sprintf(" and %d more", len(list)-shown)
list = list[:shown]
}
return []string{fmt.Sprintf("File-change capture was incomplete for %d visit(s): %s%s. Recorded file changes are not a complete workspace diff, and no stage is auto-skipped after such a visit.", len(visits), strings.Join(list, ", "), extra)}
}
// TotalUsage sums the per-stage usage of a run's steps into one run total. It is
// the one definition of the run total, so per-run inspection cannot drift from
// the history-wide aggregate over the same rows.
@@ -400,11 +429,15 @@ type StageFileChanges struct {
}
type FileChange struct {
Path string `json:"path"`
Kind string `json:"kind"` // added, modified, deleted
Patch string `json:"patch,omitempty"`
Binary bool `json:"binary,omitempty"`
Truncated bool `json:"truncated,omitempty"`
Path string `json:"path"`
Kind string `json:"kind"` // added, modified, deleted
Patch string `json:"patch,omitempty"`
Binary bool `json:"binary,omitempty"`
Truncated bool `json:"truncated,omitempty"`
// NoPatch marks a change listed without any patch: the content exceeded the
// capture budget (compared by hash) or the change was seen only in Git
// status. Truncated is also set so older readers show "patch omitted".
NoPatch bool `json:"no_patch,omitempty"`
BeforeMode string `json:"before_mode,omitempty"`
AfterMode string `json:"after_mode,omitempty"`
}
@@ -437,6 +470,10 @@ type RunDetail struct {
// one pass over Steps. It is absent for a run with no model usage recorded
// (including historical runs).
Usage *RunUsage `json:"usage,omitempty"`
// Warnings are run-level, read-time notes an operator should see before
// trusting the evidence, e.g. that a visit's file-change capture was partial.
// Derived from Steps by RunWarnings; absent when there is nothing to flag.
Warnings []string `json:"warnings,omitempty"`
// TitleSource is "model" when Title came from the shared summariser or
// "fallback" when it was derived from the prompt; TitleModel names the model
// that produced a model title. They are retained so a diagnosis can tell the