MCPcopy Create free account
hub / github.com/compozy/agh / FailRun

Method FailRun

internal/task/manager.go:2154–2177  ·  view source on GitHub ↗

FailRun marks one starting or running task run as failed and reconciles task state.

(
	ctx context.Context,
	runID string,
	failure RunFailure,
	actor ActorContext,
)

Source from the content-addressed store, hash-verified

2152
2153// FailRun marks one starting or running task run as failed and reconciles task state.
2154func (m *Service) FailRun(
2155 ctx context.Context,
2156 runID string,
2157 failure RunFailure,
2158 actor ActorContext,
2159) (*Run, error) {
2160 if err := requireWriteAuthority(actor); err != nil {
2161 return nil, err
2162 }
2163
2164 normalizedFailure, err := normalizeRunFailure(failure)
2165 if err != nil {
2166 return nil, err
2167 }
2168
2169 run, taskRecord, err := m.loadRunWithTask(ctx, runID)
2170 if err != nil {
2171 return nil, err
2172 }
2173 if strings.TrimSpace(run.ClaimTokenHash) != "" {
2174 return nil, fmt.Errorf("%w: task run %q requires token-fenced failure", ErrInvalidClaimToken, run.ID)
2175 }
2176 return m.failRunRecord(ctx, taskRecord, run, normalizedFailure, actor)
2177}
2178
2179// CancelRun cancels one non-terminal task run under manager authority.
2180func (m *Service) CancelRun(

Callers

nothing calls this directly

Calls 4

loadRunWithTaskMethod · 0.95
failRunRecordMethod · 0.95
requireWriteAuthorityFunction · 0.85
normalizeRunFailureFunction · 0.85

Tested by

no test coverage detected