fix: persist and retry run alerts and honor notification modes

This commit is contained in:
2026-10-20 15:42:21 +01:00
parent e4f48ecbb1
commit 016fcb552a
20 changed files with 697 additions and 41 deletions
+1 -1
View File
@@ -153,7 +153,7 @@ type Message struct {
// them; the same fields are echoed on the run record.
Model string `json:"model,omitempty"`
StageModels map[string]string `json:"stage_models,omitempty"`
// NotifyMode is auto (definition), on (ensure run-level attention) or off
// NotifyMode is auto (definition), on (terminal success/failure and attention) or off
// (silence this run). It is optional so older clients keep auto.
NotifyMode string `json:"notify_mode,omitempty"`
// Empty (or "resume") retries the failed visit; "restart" starts at the
+3 -2
View File
@@ -24,8 +24,9 @@ const (
// from the frame instead of re-reading the whole list. They repeat on every
// frame (pipeline identity never changes mid-run).
type RunEventFrame struct {
RunID int64 `json:"run_id"`
Workspace string `json:"workspace,omitempty"`
NotifyMode string `json:"notify_mode,omitempty"`
RunID int64 `json:"run_id"`
Workspace string `json:"workspace,omitempty"`
// PipelineID, Name, Title and Version identify the run's pipeline and its
// operator-facing title, so a new run's row can be built without a fetch.
PipelineID int64 `json:"pipeline_id,omitempty"`
+25 -12
View File
@@ -119,6 +119,7 @@ type SessionExport struct {
}
type RunSummary struct {
NotifyMode string `json:"notify_mode,omitempty"`
ID int64 `json:"id"`
PipelineID int64 `json:"pipeline_id"`
Name string `json:"name"`
@@ -349,18 +350,19 @@ type NotificationReceipt struct {
type RunDetail struct {
RunSummary
Graph Graph `json:"graph"`
RetryOf int64 `json:"retry_of,omitempty"`
RetryMode string `json:"retry_mode,omitempty"`
RetrySource int64 `json:"retry_source,omitempty"`
RetrySourceVersion int `json:"retry_source_version,omitempty"`
RetrySourceHash string `json:"retry_source_hash,omitempty"`
Workspace string `json:"workspace"`
AllowTools bool `json:"allow_tools"`
WritePaths []string `json:"write_paths"`
Input map[string]any `json:"input"`
Output map[string]any `json:"output"`
Steps []RunStep `json:"steps"`
Notifications []RunNotificationReceipt `json:"notifications,omitempty"`
Graph Graph `json:"graph"`
RetryOf int64 `json:"retry_of,omitempty"`
RetryMode string `json:"retry_mode,omitempty"`
RetrySource int64 `json:"retry_source,omitempty"`
RetrySourceVersion int `json:"retry_source_version,omitempty"`
RetrySourceHash string `json:"retry_source_hash,omitempty"`
Workspace string `json:"workspace"`
AllowTools bool `json:"allow_tools"`
WritePaths []string `json:"write_paths"`
Input map[string]any `json:"input"`
Output map[string]any `json:"output"`
Steps []RunStep `json:"steps"`
// Usage is the totalled reported usage of the run's model stages, summed in
// one pass over Steps. It is absent for a run with no model usage recorded
// (including historical runs).
@@ -372,3 +374,14 @@ type RunDetail struct {
TitleSource string `json:"title_source,omitempty"`
TitleModel string `json:"title_model,omitempty"`
}
// RunNotificationReceipt records publisher attempts, not device reception.
type RunNotificationReceipt struct {
Sequence int `json:"sequence"`
Event string `json:"event"`
Channel string `json:"channel"`
Status string `json:"status"`
Attempts int `json:"attempts"`
Diagnostic string `json:"diagnostic,omitempty"`
MessageID string `json:"message_id,omitempty"`
}