Functions
func ArrayTaskIDs(array *ArraySpec) []int
func CancelledError(previous string) string
CancelledError returns the error a cancelled job's result records:
"cancelled", keeping an earlier error in parentheses. An error that already
records a cancellation is kept as it is.
func ClassifyFingerprintJobs(current, source []FingerprintJob, mode string) (changed, newJobs map[string]bool)
ClassifyFingerprintJobs identifies current execution units that are new or
changed relative to a source queue using the selected matching mode.
func ClearIncompleteMatrixGroups(commands []QueuedCommand)
func ClearInconsistentMatrixGroups(commands []QueuedCommand, groupIDs []string)
ClearInconsistentMatrixGroups drops provenance from each listed group whose
members no longer match it, for example after an edit changed only some of
them. A group edited the same way throughout keeps its provenance.
func ClearMatrixGroup(commands []QueuedCommand, groupID string)
ClearMatrixGroup drops matrix provenance from every member of a group.
If no other group retains the same base name, dependencies on that name are
rewritten to the remaining members' own names.
func CountRunResults(results []JobResult) (successCount, failedCount int)
func DeclaredDependencies(commands []QueuedCommand, separator string) map[string]string
DeclaredDependencies maps each job of commands to its command's dependencies
as FormatDependencies prints them, as written: a stage, matrix, or array
name is not expanded to its members.
func DependenciesReady(job JobSpec, results map[string]JobResult, jobsByName map[string]JobSpec) (bool, string)
func ExpandMatrix(dimensions []MatrixDimension) [][]MatrixValue
func FailureCause(result JobResult) (kind, name string)
FailureCause returns the one cause a failed result is grouped under,
as its kind and name, and empty strings for a success. Causes rotari records
itself (blocked, cancelled, timeout) come first because they are certain;
then the latest saved rule diagnosis, named by its rule; then the result's
first remaining failure kind. Failure summaries group jobs by it and
--filter-failure-cause selects by it.
The cause timeout is only rotari's own, which records TimeoutExitCode and
a timed-out error. Any other result of kind timeout, such as a scheduler's
time limit, a scheduler command that timed out, or a job that exited 124 by
itself as GNU timeout does, was not stopped by rotari, so its suggestion to
raise rotari's timeout would not apply.
func FailureCauseID(name string) string
FailureCauseID returns the selector ID of a failure cause or diagnosis name:
lowercase letters and digits, with each other run of characters replaced by
one hyphen. A failure kind is its own ID.
func FailureKindValues() []string
FailureKindValues returns the failure kinds in the order the CLI lists them.
func FailureKinds(result JobResult) []string
FailureKinds returns the kinds a failed result falls into, in
FailureKindValues order: those its recorded error and exit code show,
and those its saved diagnoses' rules imply, such as oom for a memory rule
that matched only the log; error when no other applies; none for a success.
func Fingerprint(command QueuedCommand, arrayTask *int) (string, error)
Fingerprint returns the SHA-256 fingerprint of one expanded execution unit.
It uses only persisted job inputs that users explicitly put in the queue.
func FormatDependencies(dependsOn, dependsOnFinished []string, separator string) string
FormatDependencies joins dependsOn and dependsOnFinished for display,
marking each name that only needs to finish with a "finished:" prefix.
func FormatDisplayTimestamp(value string) string
FormatDisplayTimestamp formats a stored RFC3339 time for people in
time.Local, which Go sets from TZ, or from the system zone when TZ is unset.
Values that do not parse, including "" and "-", are returned unchanged.
func FormatDisplayTimestampIn(value string, zone *time.Location) string
FormatDisplayTimestampIn is FormatDisplayTimestamp in zone. Tests use it
instead of replacing time.Local, which other goroutines read.
func FormatRetry(retry *int) string
FormatRetry formats an optional per-job retry limit, or "" when unset.
func FormatRetryPolicy(job JobSpec) string
FormatRetryPolicy describes a job's own retry settings, such as "3 (delay
30s, backoff x2, max 10m)", or "" when it has none.
func FormatRunNote(note RunNote, jobLabel string) string
FormatRunNote describes a note for display: when it was written, the job it
is about (jobLabel, such as the job's name, for a job note), and its text,
with each further line indented to line up under the first.
func FormatSourceRevision(revision SourceRevision) string
FormatSourceRevision describes a revision for display, such as "git
89281f8c3a1b (clean)", "git 89281f8c3a1b (uncommitted changes)", or "jj
1a2b3c4d5e6f (change kxqzmwuotpls)". A git revision always says whether the
tree was clean, so its absence is never read as unrecorded; a jj commit ID
already covers the working copy.
func IsCancelledError(text string) bool
IsCancelledError reports whether a result's error text records a
cancellation.
func MatrixEnvironment(base []string, values []MatrixValue) []string
func MatrixJobName(baseName string, values []MatrixValue) string
func NormalizeActor(label string) (string, error)
NormalizeActor trims an actor label and rejects one that is too long or
holds a control character.
func NoteText(text string) (string, error)
NoteText trims a note and checks that it is neither empty nor longer than
MaxNoteLength.
func ParseTimeout(value string) (time.Duration, error)
ParseTimeout parses a job timeout, a Go duration such as "90m" or "2h".
It must be at least one second; the wrapper enforces whole seconds.
func QueueMarkedStatusByJobID(queue Queue) map[string]string
QueueMarkedStatusByJobID maps each marked command and array task of queue to
its marked status; see QueuedCommand.MarkedStatusOf.
func QueueOriginsByJobID(queue Queue) map[string]*JobOrigin
QueueOriginsByJobID is OriginOf for every job of queue that has an origin:
each command ID, and each task of an array.
func QueuedStatusText(origin *JobOrigin, marked string) string
QueuedStatusText describes a queued job's status for display: its origin's
status, or its mark when that differs, as "success (accepted)" or "STATUS
(marked)". It is "-" for a job with neither.
func ResultSelection(failed, unfinished, success bool) string
func ResultSelectionMatches(selection string, finished bool, exitCode int) bool
func ResultStatus(result JobResult, finished bool) string
ResultStatus names a job's result: unfinished without one, success for exit
code zero, cancelled for a cancelled job, and failed otherwise.
func ResultsByID(results []JobResult) map[string]JobResult
func RunLabel(runID, runName string) string
RunLabel names a run for display: its name with the ID in parentheses,
or the ID alone when the run has no name.
func RunStatus(exitCode int) string
func SanitizeMatrixName(value string) string
func SelectCommands(commands []QueuedCommand, selector CommandSelector) ([]int, error)
SelectCommands returns the indexes of the selected commands in queue order.
It fails when nothing is selected, or when a requested job ID is missing.
func SourceLabel(revision SourceRevision) string
SourceLabel describes a revision with its repository root, as run views
print it: "git 89281f8c3a1b (uncommitted changes) in /home/me/project".
func TimeoutSeconds(value string) int
TimeoutSeconds returns a job's timeout rounded up to whole seconds, or 0
when it has none or it is invalid.
func UnexpandedVariables(command []string) []string
UnexpandedVariables returns the arguments of command, in order and each
once, that refer to a variable such as $LR or ${LR}. rotari starts a command
without a shell, so such an argument reaches the command as written.
A command a shell runs with -c expands its script itself and has none.
func ValidEnvironmentName(name string) bool
func ValidMarkedStatus(status string) bool
ValidMarkedStatus reports whether status can mark a queued job.
func ValidateArraySpec(array *ArraySpec) error
func ValidateArtifacts(artifacts []string) error
ValidateArtifacts checks declared artifact paths (add --artifact): each is
non-empty, has no NUL byte or newline, and appears once after cleaning.
func ValidateDependencies(jobs []JobSpec) error
func ValidateEnvironment(environment []string) error
func ValidateMatrixGroups(commands []QueuedCommand) error
func ValidateQueueDependencies(commands []QueuedCommand) error
ValidateQueueDependencies checks queue-level names before validating the
expanded job dependency graph used by the runner.
func ValidateReservedName(kind, name string) error
ValidateReservedName rejects a new name of kind, such as "project" or "run
name", that is reserved.
func ValidateReservedNames(commands []QueuedCommand) error
ValidateReservedNames rejects job, stage, and matrix names of commands that
are reserved.
func ValidateRetryBackoff(delay string, backoff float64, maxDelay string) error
ValidateRetryBackoff checks a job's retry spacing: delays are Go durations
of zero or more, and the backoff factor is at least 1 when set.
func ValidateStageNames(commands []QueuedCommand) error
Types
type ArraySpec struct {
First int `json:"first"`
Last int `json:"last"`
Tasks []int `json:"tasks,omitempty"`
}
func ParseArrayRange(value string) (ArraySpec, error)
type CancelRecord struct {
// At is when the request was handled, with nanoseconds.
At string `json:"at"`
// Source is who asked: cli, wait, disconnect, web, or mcp.
Source string `json:"source"`
PID int `json:"pid"`
Host string `json:"host,omitempty"`
PIDNamespace string `json:"pid_namespace,omitempty"`
// RunWide is a request to cancel the whole run; otherwise Requested
// lists the job or attempt IDs asked for.
RunWide bool `json:"run_wide"`
Requested []string `json:"requested,omitempty"`
// Targets are the jobs the request acted on, in the order it acted.
Targets []CancelTarget `json:"targets,omitempty"`
// Error is why the request failed, when it did.
Error string `json:"error,omitempty"`
}
CancelRecord is one line of a run's cancels.jsonl: one cancel request,
as the process that handled it saw it. It records no command lines or
environment.
type CancelTarget struct {
JobID string `json:"job_id"`
// Action is CancelByExecutor, CancelByMarker, or CancelByMarkerAndExecutor.
Action string `json:"action,omitempty"`
// Error is why acting on this job failed; the request stopped there.
Error string `json:"error,omitempty"`
}
CancelTarget is what one cancel request did to one job.
type CommandSelector struct {
IDs []string
Name string
Stage string
Matrix string
All bool
}
CommandSelector selects queue commands. Callers set one kind of selector:
job IDs, a job name, a stage, a matrix base name, or all. An array command
is selected as a whole; its task IDs and names do not select it.
func (selector CommandSelector) Group() bool
Group reports whether the selector names a group of jobs (a stage, a matrix,
or all) rather than individual jobs.
func (selector CommandSelector) Kinds() int
Kinds returns how many kinds of selector are set.
func (selector CommandSelector) Matches(command QueuedCommand) bool
Matches reports whether command is selected.
type ConfigSource struct {
Scope string `json:"scope"`
Path string `json:"path"`
}
ConfigSource records the provenance of a file-config snapshot.
type FileConfigSnapshot struct {
Content string `json:"content"`
Sources []ConfigSource `json:"sources,omitempty"`
}
FileConfigSnapshot is loaded by the client before starting a supervisor.
Content contains canonical merged file values, never runtime overrides.
type FingerprintJob struct {
ID string
Fingerprint string
}
func QueueFingerprintJobs(queue Queue) ([]FingerprintJob, error)
QueueFingerprintJobs expands queue commands into the execution units used
by fingerprint matching. Array tasks are separate units; matrix values are
already present on their expanded commands.
type FingerprintMatch struct {
CurrentID string
SourceID string
Method string
}
func MatchFingerprintJobs(current, source []FingerprintJob) []FingerprintMatch
MatchFingerprintJobs matches current queue units to source units. Job IDs
are consumed first. Remaining units are grouped by fingerprint; a group is
matched by occurrence only when both sides have the same count.
func MatchFingerprintJobsByMode(current, source []FingerprintJob, mode string) []FingerprintMatch
MatchFingerprintJobsByMode applies the selected identity sources.
In fingerprint mode, job IDs are ignored; in the combined mode they are
consumed before fingerprint candidates are counted.
type JobOrigin struct {
RunID string `json:"run_id"`
JobID string `json:"job_id"`
AttemptID string `json:"attempt_id,omitempty"`
Status string `json:"status,omitempty"`
CWD string `json:"cwd,omitempty"`
SubmittedAt string `json:"submitted_at,omitempty"`
FinishedAt string `json:"finished_at,omitempty"`
}
func TaskOrigin(command QueuedCommand, task int) *JobOrigin
TaskOrigin resolves a task's own origin or the corresponding task of its
array's origin. It never changes the command's stored origin.
type JobResult struct {
ID string `json:"id"`
// Name is the job's name, such as train[3], in a run summary; results
// written before it was recorded have none.
Name string `json:"name,omitempty"`
AttemptID string `json:"attempt_id,omitempty"`
ExitCode int `json:"exit_code"`
Accepted bool `json:"accepted,omitempty"`
Error string `json:"error,omitempty"`
Command []string `json:"command,omitempty"`
Hosts []string `json:"hosts,omitempty"`
Diagnoses []RuleDiagnosis `json:"diagnoses,omitempty"`
DiagnosisStatus string `json:"diagnosis_status,omitempty"`
DiagnosisNote string `json:"diagnosis_note,omitempty"`
DiagnosisRules string `json:"diagnosis_rules,omitempty"`
LastOutputLine string `json:"last_output_line,omitempty"`
}
JobResult is one job's outcome in a run summary. A failed result carries
its saved rule-based analysis: DiagnosisStatus is DiagnosisMatched,
DiagnosisNoMatch, or DiagnosisUnavailable (empty when never analyzed);
Diagnoses lists only recognized diagnoses; DiagnosisNote says why an
unavailable analysis could not run; DiagnosisRules identifies the rule set
that produced the analysis; and LastOutputLine is the last nonblank line of
the output the analysis read, which shows the cause when no rule matched.
func AggregatedJobResult(id string, array *ArraySpec, results map[string]JobResult) (JobResult, bool)
func MarkResult(id string, result JobResult, finished bool, status string) (JobResult, bool, error)
MarkResult returns the result a job has once marked with status, in place
of its recorded result. An empty status, or the one the result already has,
keeps it; unfinished drops it; success accepts it with exit code zero;
and failed or cancelled record that status with a non-zero exit code.
Marking a job without a result as anything but unfinished is an error,
since there is no attempt to link the result to.
func (result *JobResult) ClearDiagnosis()
ClearDiagnosis removes the saved rule-based analysis.
func (result *JobResult) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes a job result and converts an analysis saved before
DiagnosisStatus existed, whose outcome was stored as a Diagnoses entry.
type JobSpec struct {
ID string `json:"id"`
AttemptID string `json:"attempt_id,omitempty"`
EnvMode string `json:"env_mode,omitempty"`
Command []string `json:"command"`
WorkingDirectory string `json:"working_directory,omitempty"`
Executor string `json:"executor,omitempty"`
ExecutorOptions []string `json:"executor_options,omitempty"`
Name string `json:"name,omitempty"`
Stage string `json:"stage,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
// DependsOnFinished names prerequisites that must finish, whatever their
// result, before the job starts.
DependsOnFinished []string `json:"depends_on_finished,omitempty"`
// Timeout limits how long the job may run once it starts.
Timeout string `json:"timeout,omitempty"`
// Retry overrides the run's --retry limit for this job when set.
Retry *int `json:"retry,omitempty"`
// RetryDelay, RetryBackoff, and RetryMaxDelay space out the job's retries.
RetryDelay string `json:"retry_delay,omitempty"`
RetryBackoff float64 `json:"retry_backoff,omitempty"`
RetryMaxDelay string `json:"retry_max_delay,omitempty"`
ArrayGroup string `json:"array_group,omitempty"`
ArrayTaskID *int `json:"array_task_id,omitempty"`
ArrayFirst int `json:"array_first,omitempty"`
ArrayLast int `json:"array_last,omitempty"`
ArraySize int `json:"array_size,omitempty"`
Environment []string `json:"environment,omitempty"`
// InheritedEnvironment carries run-scoped caller values to executor adapters
// without persisting them in per-attempt command snapshots.
InheritedEnvironment []string `json:"-"`
Output []string `json:"output,omitempty"`
Error []string `json:"error,omitempty"`
Artifacts []string `json:"artifacts,omitempty"`
LogMode string `json:"log_mode,omitempty"`
OpenMode string `json:"open_mode,omitempty"`
}
func QueueToJobs(commands []QueuedCommand) []JobSpec
func (job JobSpec) AllDependencies() []string
AllDependencies returns the names in DependsOn followed by those in
DependsOnFinished.
func (job JobSpec) EffectiveLogMode() string
func (job JobSpec) RetryDelayFor(retryNumber int) time.Duration
RetryDelayFor returns how long to wait before the job's retryNumber-th retry
(1 for the first): RetryDelay multiplied by RetryBackoff for each earlier
retry, capped at RetryMaxDelay. Without RetryDelay the job is retried at
once.
func (job JobSpec) RetryLimit(runRetry int) int
RetryLimit returns how many times a failed job may be retried: its own Retry
when set, otherwise the run's limit, where -1 means no limit.
type LaunchOrigin struct {
Host string `json:"host"`
PIDNamespace string `json:"pid_namespace,omitempty"`
PID int `json:"pid"`
ProcessStart string `json:"process_start,omitempty"`
}
LaunchOrigin identifies a process on a host. ProcessStart, when known,
tells it from a later process reusing its PID.
type LoadAverage struct {
One float64 `json:"one"`
Five float64 `json:"five"`
Fifteen float64 `json:"fifteen"`
}
type LoadSample struct {
At string `json:"at"`
LoadAverage
}
type LockInfo struct {
PID int `json:"pid"`
RunID string `json:"run_id"`
RunName string `json:"run_name,omitempty"`
StartedAt string `json:"started_at"`
Host string `json:"host,omitempty"`
PIDNamespace string `json:"pid_namespace,omitempty"`
ClientAttached bool `json:"client_attached,omitempty"`
}
type MatrixDimension struct {
Name string `json:"name"`
Values []string `json:"values"`
}
func ParseMatrixDimension(value string) (MatrixDimension, error)
type MatrixExclusion struct {
Values []MatrixValue `json:"values"`
}
func CloneMatrixExclusions(exclusions []MatrixExclusion) []MatrixExclusion
func ExpandMatrixWithExclusions(dimensions []MatrixDimension, exclusions []MatrixExclusion) ([][]MatrixValue, []MatrixExclusion, error)
ExpandMatrixWithExclusions expands dimensions in their declared order and
removes combinations matching any partial exclusion. Exclusion assignments
are normalized to dimension order for stable provenance and export.
func ParseMatrixExclusion(value string) (MatrixExclusion, error)
ParseMatrixExclusion parses one partial matrix exclusion in KEY=VALUE form,
with comma-separated assignments for a multi-dimension rule.
type MatrixSpec struct {
GroupID string `json:"group_id"`
Dimensions []MatrixDimension `json:"dimensions"`
Values []MatrixValue `json:"values"`
Exclusions []MatrixExclusion `json:"exclusions,omitempty"`
BaseName string `json:"base_name,omitempty"`
BaseEnvironment []string `json:"base_environment,omitempty"`
}
type MatrixValue struct {
Name string `json:"name"`
Value string `json:"value"`
}
type Meta struct {
Phase string `json:"phase"`
LastRunID string `json:"last_run_id,omitempty"`
LastRunExitCode int `json:"last_run_exit_code,omitempty"`
UpdatedAt string `json:"updated_at"`
}
type ProgressEvent struct {
OK bool `json:"ok"`
RunID string `json:"run_id,omitempty"`
Notice string `json:"notice,omitempty"`
Message string `json:"message,omitempty"`
Progress bool `json:"progress,omitempty"`
JobID string `json:"job_id,omitempty"`
Completed int `json:"completed,omitempty"`
Total int `json:"total,omitempty"`
Succeeded int `json:"succeeded,omitempty"`
Failed int `json:"failed,omitempty"`
}
ProgressEvent is a run-start, job-start, or job-result event. Its fields
preserve the attached supervisor's progress stream, without transport-only
responses (handshakes, control messages, or run completion).
type Queue struct {
// StateVersion is set by the state package when the queue is written.
StateVersion int `json:"state_version,omitempty"`
DefaultExecutor string `json:"default_executor,omitempty"`
DefaultExecutorOptions []string `json:"default_executor_options,omitempty"`
Commands []QueuedCommand `json:"commands"`
}
func (queue Queue) OriginOf(jobID string) *JobOrigin
OriginOf returns where jobID's carried or marked result came from: the whole
command's Origin for a command ID, or for a task of an array its TaskOrigin.
It returns nil for a job that executes in this run.
type QueuedCommand struct {
ID string `json:"id"`
Command []string `json:"command"`
WorkingDirectory string `json:"working_directory,omitempty"`
Executor string `json:"executor,omitempty"`
ExecutorOptions []string `json:"executor_options,omitempty"`
Environment []string `json:"environment,omitempty"`
Output []string `json:"output,omitempty"`
Error []string `json:"error,omitempty"`
// Artifacts are files or directories the user declared with add
// --artifact, recorded as artifact candidates of each attempt. They are
// not part of the job's fingerprint.
Artifacts []string `json:"artifacts,omitempty"`
LogMode string `json:"log_mode,omitempty"`
OpenMode string `json:"open_mode,omitempty"`
Name string `json:"name,omitempty"`
Stage string `json:"stage,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
// DependsOnFinished names prerequisites that must finish, whatever their
// result, before the job starts (Slurm's afterany).
DependsOnFinished []string `json:"depends_on_finished,omitempty"`
// Timeout limits how long the job may run once it starts, as a Go
// duration such as "2h"; empty means no limit.
Timeout string `json:"timeout,omitempty"`
// Retry overrides the run's --retry limit for this job when set; 0
// disables retries.
Retry *int `json:"retry,omitempty"`
// RetryDelay, RetryBackoff, and RetryMaxDelay space out the job's retries;
// see JobSpec.RetryDelayFor.
RetryDelay string `json:"retry_delay,omitempty"`
RetryBackoff float64 `json:"retry_backoff,omitempty"`
RetryMaxDelay string `json:"retry_max_delay,omitempty"`
Origin *JobOrigin `json:"origin,omitempty"`
Array *ArraySpec `json:"array,omitempty"`
TaskOrigins map[string]*JobOrigin `json:"task_origins,omitempty"`
Matrix *MatrixSpec `json:"matrix,omitempty"`
// MarkedStatus and TaskMarkedStatus hold a status the user gave the
// command, or tasks of it, with change --status or a workflow manifest.
// A filtered run reads it in place of the recorded result's status; see
// MarkResult.
MarkedStatus string `json:"marked_status,omitempty"`
TaskMarkedStatus map[string]string `json:"task_marked_status,omitempty"`
}
func (command QueuedCommand) AllDependencies() []string
AllDependencies returns the names in DependsOn followed by those in
DependsOnFinished.
func (command QueuedCommand) MarkedStatusOf(jobID string) string
MarkedStatusOf returns the status jobID, the command or one of its array
tasks, is marked with: the task's own mark, else the command's, else "".
type RecoveryExecution struct {
RunID string `json:"run_id"`
JobID string `json:"job_id"`
AttemptID string `json:"attempt_id,omitempty"`
Backend string `json:"backend"`
State string `json:"state"`
Reason string `json:"reason"`
Source string `json:"source,omitempty"`
ObservedAt string `json:"observed_at,omitempty"`
NativeID string `json:"native_id,omitempty"`
Scope string `json:"scope,omitempty"`
PossiblyActive bool `json:"possibly_active,omitempty"`
Conflict bool `json:"conflict,omitempty"`
RecordedTerminal bool `json:"recorded_terminal,omitempty"`
}
type RuleDiagnosis struct {
Name string `json:"name"`
Evidence string `json:"evidence"`
Suggestion string `json:"suggestion"`
// Kinds are the failure kinds the diagnosing rule implies, such as
// FailureKindOOM for a memory rule; FailureKinds adds them. A diagnosis
// saved before rules declared kinds has none.
Kinds []string `json:"kinds,omitempty"`
}
type RunBinary struct {
Version string `json:"version,omitempty"`
Executable string `json:"executable"`
Size int64 `json:"size"`
Modified string `json:"modified"`
}
RunCoordinator identifies the supervisor independently of the removable run
lock. ManagementFinishedAt is informational, not evidence of process death.
RunBinary is the rotari binary a process runs: its version, and its
executable's path, size, and modification time. Two binaries differ when the
path, size, or time differs, which a stat tells without reading the file;
a copy with the same size and time passes for the same.
func (binary RunBinary) Differs(other RunBinary) bool
Differs says whether other is another binary than binary.
type RunClientStatus struct {
Mode string `json:"mode"`
State string `json:"state"`
Reason string `json:"reason,omitempty"`
UpdatedAt string `json:"updated_at"`
}
RunClientStatus records the initiating CLI client's mode and its last
connection transition. It describes the progress stream, not observers such
as wait, Web, or MCP clients.
type RunContext struct {
CWD string `json:"cwd"`
ConfigSources []ConfigSource `json:"config_sources,omitempty"`
ConfigPaths []string `json:"config_paths,omitempty"`
ConfigSnapshotFiles []string `json:"config_snapshot_files,omitempty"`
ConfigSnapshotPaths []string `json:"config_snapshot_paths,omitempty"`
Hostname string `json:"hostname,omitempty"`
Coordinator *RunCoordinator `json:"coordinator,omitempty"`
Recovery *RunRecovery `json:"recovery,omitempty"`
// LaunchOrigin is the process that ran the rotari command starting the
// run, such as a shell or script; wait without a selector follows the
// runs its own parent started. Runs started by the Web UI or MCP have
// none.
LaunchOrigin *LaunchOrigin `json:"launch_origin,omitempty"`
// StartedBy is how the run was started; runs from before it was
// recorded have none.
StartedBy *StartedBy `json:"started_by,omitempty"`
StartedLoad *LoadAverage `json:"started_load,omitempty"`
FinishedLoad *LoadAverage `json:"finished_load,omitempty"`
LoadSamples []LoadSample `json:"load_samples,omitempty"`
}
type RunCoordinator struct {
Host string `json:"host"`
PID int `json:"pid"`
PIDNamespace string `json:"pid_namespace,omitempty"`
ProcessStart string `json:"process_start,omitempty"`
RecordedAt string `json:"recorded_at"`
ManagementFinishedAt string `json:"management_finished_at,omitempty"`
// Binary is the rotari the coordinator runs; nil in runs an older rotari started,
// or when it could not be looked at.
Binary *RunBinary `json:"binary,omitempty"`
}
type RunNote struct {
At string `json:"at"`
JobID string `json:"job_id,omitempty"`
AttemptID string `json:"attempt_id,omitempty"`
Text string `json:"text"`
}
RunNote is free text that an agent or a person attached to a run, or to
one job attempt of it: why the run was made, or what its result showed.
Notes are only ever added, never edited, so a finished run keeps its results
unchanged.
func RunNotesFor(notes []RunNote, jobID string) []RunNote
RunNotesFor returns the notes on the run itself, with no job, when jobID is
empty, and otherwise the notes on that job's attempts.
type RunRecovery struct {
At string `json:"at"`
AssumeStopped bool `json:"assume_stopped"`
CoordinatorState string `json:"coordinator_state"`
CoordinatorReason string `json:"coordinator_reason"`
Coordinator *RunCoordinator `json:"coordinator,omitempty"`
Action string `json:"action,omitempty"`
Executions []RecoveryExecution `json:"executions,omitempty"`
}
type RunSources struct {
Sources []SourceRevision `json:"sources"`
}
RunSources lists the repositories a run's executed jobs ran from.
func (sources RunSources) SourceFor(dir string) (SourceRevision, bool)
SourceFor returns the recorded repository containing dir, the one with the
longest root when repositories nest.
type RunSummary struct {
// StateVersion is set by the state package when the summary is written.
StateVersion int `json:"state_version,omitempty"`
RunID string `json:"run_id"`
RunName string `json:"run_name,omitempty"`
Status string `json:"status"`
StartedAt string `json:"started_at"`
FinishedAt string `json:"finished_at"`
ExitCode int `json:"exit_code"`
Results []JobResult `json:"results"`
}
type SourceRevision struct {
// Root is the repository's top directory.
Root string `json:"root"`
// VCS is "git" or "jj".
VCS string `json:"vcs"`
// CommitID identifies the code. For jj it is the working-copy commit,
// taken after a snapshot, so it includes changes not yet described or
// committed; for git it is HEAD.
CommitID string `json:"commit_id,omitempty"`
// ChangeID is jj's change ID of the working-copy commit, which survives
// rewrites of the same change.
ChangeID string `json:"change_id,omitempty"`
// Dirty reports, for git, tracked changes not committed to HEAD; the
// code that ran then differs from CommitID.
Dirty bool `json:"dirty,omitempty"`
// Error says why the revision could not be read; the other fields beyond
// Root and VCS are then empty.
Error string `json:"error,omitempty"`
}
SourceRevision is the version-control state of a repository that a run's
jobs executed from, recorded when the run starts executing.
type StaleLockRemoval struct {
RemovedAt string `json:"removed_at"`
Lock LockInfo `json:"lock"`
ReaderPID int `json:"reader_pid"`
ReaderHost string `json:"reader_host"`
ReaderPIDNamespace string `json:"reader_pid_namespace,omitempty"`
ReaderCommand string `json:"reader_command,omitempty"`
}
StaleLockRemoval records which reader removed a run's stale lock, since the
lock itself is gone afterwards.
type StartedBy struct {
Interface string `json:"interface"`
Actor string `json:"actor,omitempty"`
}
StartedBy is how a run was started: the interface its request came through,
which is always recorded, and an actor label the starter gave with
ROTARI_ACTOR or --actor, such as an agent's name. rotari never guesses an
actor; a run without one is unlabelled, not a person's.
func (startedBy StartedBy) Label() string
Label is how a run's start is shown: "cli", or "cli ยท claude-code" with an
actor.