Runs: one uninterruptible stage session no longer disables the runner

Start-up recovery used to fail the whole runner when any previously active
stage session could not be confirmed stopped. That run alone is now marked
interrupted with a diagnostic naming the session and error. A Pi owner whose
process and process group are gone counts as stopped without its quiescence
receipt (it crashed), as the Claude stage path already did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 00:23:39 +00:00
parent 3e267d4863
commit e649eced10
4 changed files with 83 additions and 3 deletions
+9 -1
View File
@@ -152,7 +152,15 @@ func newRunnerReattaching(ctx context.Context, s *pipeline.Store, artifactsRoot
cancel()
}
if err != nil {
return nil, fmt.Errorf("cannot interrupt previously active agent %s: %w", owner.ID, err)
// One session that cannot be confirmed stopped must not disable
// every run: interrupt only its run, saying why, and go on.
reason := fmt.Sprintf("its previous %s stage agent (session %s) could not be confirmed stopped (%v); check for a leftover agent process before reusing the workspace", owner.Backend, owner.ID, err)
if prior := reasons[owner.RunID]; prior != "" {
reason = prior + "; " + reason
}
reasons[owner.RunID] = reason
log.Printf("run %d: cannot interrupt previously active agent %s: %v; the run is marked interrupted", owner.RunID, owner.ID, err)
continue
}
if err := s.ConfirmRecoveredSession(ctx, owner); err != nil {
return nil, err