Allow launching runs with whole-run and per-stage model overrides
Add `pipelines run --model PROVIDER/MODEL` and repeatable `--stage-model STAGE=PROVIDER/MODEL`, resolved with precedence per-stage > whole-run > the model pinned in the pipeline version. - A shared pure resolver (`pipeline.ParseModelOverride` / `pipeline.EffectiveModels`) owns the precedence and validation: every value must be a `provider/model` pair (`stage.ValidModel`), every stage key must exist in the pinned graph, an unknown key fails naming the valid keys, and a per-stage key that names a non-model stage is refused. - The server validates against the pinned version before admission (no run row is ever inserted for an invalid request), persists `model`/`stage_models` on the run and `provider`/`model` on each step, applies the effective pair to a clone of the stage definition so the stage and its repair/formatter path share it, overlays the returned run graph with the effective pair (presentation only), and reuses the recorded overrides on retry. - The run record echoes the overrides it was launched with and each step records the provider/model it actually ran with; the TUI Evidence pane renders that effective pair. The pinned pipeline version and `show --version N` are never modified. - CLI help, `docs/cli.md` and the packaged authoring skill references document the flags and the precedence. A TUI override picker remains a documented follow-up; the CLI is the deliverable. Tests: pure precedence/validation table tests, store round-trip and request-key-mismatch plus migration, server admission/application/overlay/retry with a controlled executor, CLI flag/help/malformed-value tests, and a TUI evidence test.
This commit is contained in:
@@ -147,7 +147,13 @@ type Message struct {
|
||||
WritePaths []string `json:"write_paths,omitempty"`
|
||||
RequestKey string `json:"request_key,omitempty"`
|
||||
Workspace string `json:"workspace,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
// Model and StageModels are the launch-time model overrides: Model applies to
|
||||
// every model stage of the run and StageModels overrides individual stages by
|
||||
// key (per-stage wins over whole-run). Both are optional so older peers ignore
|
||||
// them; the same fields are echoed on the run record.
|
||||
Model string `json:"model,omitempty"`
|
||||
StageModels map[string]string `json:"stage_models,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
// Chat is the brokered OpenCode chat traffic (route B). See chat.go for the
|
||||
// per-type payload structs and the wire shapes they mirror.
|
||||
ChatSessions []ChatSession `json:"chat_sessions,omitempty"`
|
||||
|
||||
@@ -118,6 +118,12 @@ type RunSummary struct {
|
||||
Diagnostic string `json:"diagnostic"`
|
||||
ResultPreview string `json:"result_preview,omitempty"`
|
||||
CompletedSteps int `json:"completed_steps"`
|
||||
// Model and StageModels are the launch-time overrides this run records so it
|
||||
// stays reproducible: Model covers every model stage and StageModels overrides
|
||||
// individual stages by key. They are empty for a run that used the pinned
|
||||
// models and for historical rows.
|
||||
Model string `json:"model,omitempty"`
|
||||
StageModels map[string]string `json:"stage_models,omitempty"`
|
||||
}
|
||||
|
||||
// Label is the operator-facing name of a run: the generated Title when the
|
||||
@@ -147,6 +153,11 @@ type RunStep struct {
|
||||
SessionID string `json:"session_id"`
|
||||
AgentActive bool `json:"agent_active"`
|
||||
Transcript string `json:"transcript"`
|
||||
// Provider and Model are the effective provider/model this visit actually ran
|
||||
// with, recorded for every model stage (including failures). They are empty
|
||||
// for non-model stages and historical steps.
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Model string `json:"model,omitempty"`
|
||||
// ArtifactsSkipped and ArtifactsTruncated count files excluded from the
|
||||
// bounded per-step scan (over the file/size cap) and by the total budget.
|
||||
ArtifactsSkipped int `json:"artifacts_skipped,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user