Merge: no UI-review auto-skip without complete change capture; capture lists over-budget changes
# Conflicts: # internal/protocol/runs.go
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 {
|
||||
@@ -1595,7 +1601,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
|
||||
@@ -1687,13 +1693,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,
|
||||
@@ -1702,6 +1710,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