Keep dismissed shell commands and restore them without a time limit

A dismissed run keeps its command, status, times and output within the
usual history bounds. chat_shell_runs lists dismissed runs apart
(chat_shell_dismissed_runs), chat_shell_run_output still reads them, and
the purge timer and startup purge are gone. Rows an older server purged
are listed with purged set and cannot be restored.
This commit is contained in:
2026-11-09 23:29:25 +00:00
parent 371d29224c
commit f2520a09b8
10 changed files with 204 additions and 186 deletions
+1 -6
View File
@@ -49,8 +49,6 @@ type chatShellRunner struct {
grace time.Duration
flush time.Duration
persist time.Duration
// undo is how long a dismissed run stays restorable before its purge.
undo time.Duration
mu sync.Mutex
active map[string]*chatShellProcess
@@ -77,7 +75,6 @@ func newChatShellRunner(base context.Context, store chatShellRunStore, publish f
return &chatShellRunner{
base: base, store: store, publish: publish, now: time.Now, shell: chatShellProgram,
grace: 3 * time.Second, flush: 100 * time.Millisecond, persist: 2 * time.Second,
undo: protocol.ChatShellRunUndoWindow * time.Millisecond,
active: map[string]*chatShellProcess{},
}
}
@@ -93,14 +90,12 @@ func chatShellProgram() string {
}
// recover marks runs a previous server process left running as interrupted:
// their processes died with it (or are no longer owned by anyone). It also
// purges dismissals whose undo window passed while no server was running.
// their processes died with it (or are no longer owned by anyone).
func (r *chatShellRunner) recover(ctx context.Context) {
if r.store == nil {
return
}
_, _ = r.store.InterruptChatShellRuns(ctx, r.now().UnixMilli(), chatShellInterruptedReason)
r.purgeDismissed(ctx)
}
// resolveChatShellDirectory requires the chat's recorded directory to still be