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:
+23
-14
@@ -951,11 +951,14 @@ type runState struct {
|
||||
input stage.Values
|
||||
// changedPaths retains a bounded sample of the run's recorded changed paths
|
||||
// and changedCount the full total, so the skip guard reads only in-memory
|
||||
// evidence. uiSurface is latched once any recorded change touched a UI
|
||||
// surface. Both are folded in by recordChanges (ui_surface.go).
|
||||
changedPaths []string
|
||||
changedCount int
|
||||
uiSurface bool
|
||||
// evidence. uiSurface is latched once any visit captured a rendered (image)
|
||||
// artifact. captureIncomplete counts visits whose file-change capture was
|
||||
// missing, partial or unavailable; any such visit forbids the server skip
|
||||
// fallback. All are folded in by recordChanges (ui_surface.go).
|
||||
changedPaths []string
|
||||
changedCount int
|
||||
uiSurface bool
|
||||
captureIncomplete int
|
||||
// capturedPaths is the full, deduplicated, first-seen-ordered set of the
|
||||
// run's server-captured changed paths, distinct from the bounded
|
||||
// changedPaths sample used only by the skip reason. capturedSeen is the
|
||||
@@ -1020,7 +1023,7 @@ func rebuildRunState(detail *protocol.RunDetail, decided protocol.RunStep) *runS
|
||||
}
|
||||
// Seed the UI-surface accumulator from the persisted evidence so a
|
||||
// resumed run reaches the same skip decision with no extra query.
|
||||
state.recordChanges(step.FileChanges, step.Artifacts)
|
||||
state.recordPersistedStep(step)
|
||||
// Only completed, recorded visits are eligible for a later stage's
|
||||
// review capability. The path is reconstructed by the runner below.
|
||||
if step.Status == "completed" {
|
||||
@@ -1062,7 +1065,7 @@ func rebuildRetryState(detail *protocol.RunDetail, failed protocol.RunStep, hand
|
||||
state.turns = append(state.turns, turn.MemoryEntry{Stage: step.Stage, Visit: state.visits[step.Stage], Output: turnOutput(step.Output), PublicFiles: added})
|
||||
state.lastOutput = turnOutput(step.Output)
|
||||
}
|
||||
state.recordChanges(step.FileChanges, step.Artifacts)
|
||||
state.recordPersistedStep(step)
|
||||
if step.Status == "completed" {
|
||||
state.artifactDirs = append(state.artifactDirs, filepath.Join("", strconv.Itoa(step.Sequence)))
|
||||
}
|
||||
@@ -1073,6 +1076,9 @@ func rebuildRetryState(detail *protocol.RunDetail, failed protocol.RunStep, hand
|
||||
// retry source's immediate steps (which is what made retry-of-retry fail
|
||||
// closed with "memory source ... has not completed").
|
||||
if prefix, ok := handoff["prefix"].(map[string]any); ok {
|
||||
// The checkpoint carries outputs, not file-change captures, so an inherited
|
||||
// prefix is unobserved evidence: the server skip fallback must not apply.
|
||||
state.captureIncomplete++
|
||||
for _, record := range retryPrefixRecords(handoff["prefix_provenance"]) {
|
||||
output, exists := prefix[record.stage].(map[string]any)
|
||||
if !exists {
|
||||
@@ -1591,7 +1597,7 @@ func (r *runner) runLoop(ctx context.Context, id int64, graph protocol.Graph, na
|
||||
}
|
||||
}
|
||||
_, declaresSkip := def.Edges["skipped"]
|
||||
skip := !isHuman && declaresSkip && !state.uiSurface
|
||||
skip := !isHuman && declaresSkip && autoSkipEligible(def.Configs, state)
|
||||
state.nextSequence = sequence + 1
|
||||
state.visits[key]++
|
||||
// Publish the run's server-captured changed paths into the input memory
|
||||
@@ -1683,13 +1689,15 @@ func (r *runner) runLoop(ctx context.Context, id int64, graph protocol.Graph, na
|
||||
r.deliverRunNotificationBatch(time.Now(), 1)
|
||||
return
|
||||
}
|
||||
// A stage that declares a `skipped` route is short-circuited when the run
|
||||
// has recorded no UI surface: the stage would answer exactly that, so skip
|
||||
// the model call and its capture work, record the step as completed and
|
||||
// route along the declared edge. Only a declared route is honoured, and no
|
||||
// other stage or outcome routing changes.
|
||||
// Server skip fallback: a stage that declares a `skipped` route is
|
||||
// short-circuited only when the run's evidence is complete and empty
|
||||
// (autoSkipEligible, ui_surface.go): every visit recorded a complete
|
||||
// capture with no file changes and no rendered artifact. Then skip the
|
||||
// model call and its capture work, record the step as completed with a
|
||||
// verdict that names the server fallback, and route along the declared
|
||||
// edge. Partial, unavailable or missing evidence always runs the model.
|
||||
if skip {
|
||||
reason := skipReasonLine(state)
|
||||
reason := skipReasonLine()
|
||||
step := protocol.RunStep{
|
||||
Sequence: sequence,
|
||||
Stage: key,
|
||||
@@ -1698,6 +1706,7 @@ func (r *runner) runLoop(ctx context.Context, id int64, graph protocol.Graph, na
|
||||
Output: stage.Values{"summary": reason},
|
||||
Target: def.Edges["skipped"],
|
||||
Control: &protocol.ControlEvidence{Visit: state.visits[key], MaxVisits: maxVisits, Memory: reads},
|
||||
Verdict: &protocol.StageVerdict{Reason: reason, ReasonSource: protocol.VerdictReasonFallback},
|
||||
}
|
||||
status, outcome, diagnostic, terminal, finishErr := r.finishStage(id, name, workspace, selected, state, step)
|
||||
if finishErr != nil {
|
||||
|
||||
Reference in New Issue
Block a user