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:
@@ -1,6 +1,9 @@
|
||||
package protocol
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
RunPipeline = "run_pipeline"
|
||||
@@ -363,6 +366,32 @@ type RunUsage struct {
|
||||
CacheKnownStages int `json:"cache_known_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.
|
||||
@@ -432,11 +461,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"`
|
||||
}
|
||||
@@ -465,6 +498,10 @@ type RunDetail struct {
|
||||
Input map[string]any `json:"input"`
|
||||
Output map[string]any `json:"output"`
|
||||
Steps []RunStep `json:"steps"`
|
||||
// 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
|
||||
|
||||
Reference in New Issue
Block a user