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:
@@ -201,7 +201,17 @@ func TestScheduleDeletionDoesNotCancelAdmittedRun(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// seamScheduleBusyRetry sets how a scheduled admission waits for a busy
|
||||
// workspace (limit 0: it is skipped at once, as before delays existed).
|
||||
func seamScheduleBusyRetry(t *testing.T, every, limit time.Duration) {
|
||||
t.Helper()
|
||||
previous := scheduleBusyRetry
|
||||
scheduleBusyRetry = func() (time.Duration, time.Duration) { return every, limit }
|
||||
t.Cleanup(func() { scheduleBusyRetry = previous })
|
||||
}
|
||||
|
||||
func TestSavedScheduleRecoveryAndOverlap(t *testing.T) {
|
||||
seamScheduleBusyRetry(t, time.Minute, 0)
|
||||
ctx, s, r, pid := scheduleFixture(t)
|
||||
item := saveTestSchedule(t, ctx, s, pid, "task", t.TempDir(), "1m", time.Now())
|
||||
due := dueOf(t, item)
|
||||
|
||||
Reference in New Issue
Block a user