Claude stages survive server restarts; non-repo folders don't falsely overlap; busy scheduled runs wait

- Claude stage CLIs now run in their own session (setsid) with the prompt from
  a file and stream-json written straight to cli-<n>.out in the evidence
  directory; owner.json records pid/pgid, session, invocation and output. A
  server shutdown leaves the CLI running and owned (ErrDetached). Start-up
  recovery re-adopts it (stage.ClaudeStageReattachable): the next process
  re-reads the output, follows the live CLI until it exits, or reads the
  result it left while the server was down; one that ended without a result
  marks the run interrupted with a clear reason. The outcome repair follow-up
  is re-adopted too (or asked again if its CLI died without a reply).
- Workspace overlap: two folders outside any repository overlap only when
  they are the same folder or the inner one lies within the outer run's
  declared write paths; nested-repository rules are unchanged.
- Scheduled admissions refused for a busy workspace are recorded as
  "delayed" and retried every 5 min for up to 2 h (env-configurable), then
  started or skipped with the reason; the operator gets a low-priority app
  notice (and ntfy when enabled) when a scheduled run is delayed or skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 12:55:12 +00:00
parent c4de1de27b
commit f061675fc1
20 changed files with 1344 additions and 180 deletions
+5 -2
View File
@@ -194,8 +194,11 @@ Every submission, including agent-issued `submit`/`rpc`, still uses server valid
## Drafts in the TUI
The server runs one active run per resolved workspace, including overlapping
parent/descendant directories (and symlink aliases). Separate sibling worktrees
remain independent. A new request key in a
parent/descendant directories of one repository (and symlink aliases). Separate
sibling worktrees, and separate repositories nested in one another, remain
independent. Two folders outside any repository overlap only when they are the
same folder or one lies within the other run's declared write paths. A new
request key in a
different workspace is admitted immediately and executes concurrently; a second
run in a workspace an active run is already changing is refused, naming the
conflicting run and advising you to wait or use a different workspace (for
+7 -2
View File
@@ -309,8 +309,13 @@ directory that chooses its own account keeps it).
- **Failures.** Diagnostics are fixed text. A billing, quota or rate-limit
refusal stops the run without retries; a missing sign-in says so. The CLI's
redacted stream is kept as the session export and evidence.
- **Recovery.** A server restart during a Claude Code stage stops that process
and fails the visit; it is not reattached.
- **Recovery.** The CLI runs in its own session, writing its stream-json to a
file in the stage's evidence directory, so a restart of the installed server
does not stop it. The next server re-adopts the visit: it keeps reading the
CLI's output, waits for it to finish and continues the run. A CLI that
finished while the server was down is read back from that file; one that
ended without a result marks the run interrupted, saying so (its prompt is
never sent again). An interrupted outcome repair follow-up is asked again.
- **Overrides.** `--model` and `--stage-model` must give an
`anthropic/<model>` for these stages; the launch is refused otherwise.
+8 -3
View File
@@ -42,9 +42,14 @@ Edit that schedule explicitly when you want it to use a newer version.
never guesses from workflow Markdown or a current pipeline's schedule state.
Each dispatch is claimed once. Missed occurrences after downtime are skipped,
not replayed. Workspace conflicts are refused and journaled, not silently run
concurrently or retried as agent work. Use separate workspaces for truly
independent concurrent execution. **Refresh** in Schedules reloads its latest
not replayed. A scheduled run whose workspace another run holds is delayed,
never run concurrently: it is recorded as `delayed` in the schedule's history
and tried again every 5 minutes for up to 2 hours (set
`PIPELINES_SCHEDULE_BUSY_RETRY_EVERY` / `PIPELINES_SCHEDULE_BUSY_RETRY_FOR` on
the server, as Go durations; `0` for FOR skips at once), then recorded as
`started` or `skipped` with the reason. The operator gets a low-priority
notification when a scheduled run is delayed or skipped. Use separate
workspaces for truly independent concurrent execution. **Refresh** in Schedules reloads its latest
configuration and next due times.
## JSON API / CLI automation