feat(coder): v2.6 Phase 3 — lifecycle hardening (idle evict, crash recovery, worktree reaper)
Idle TTL eviction per (chat,agent) + LRU cap (never a busy backend); pure lifecycle-decisions.ts (TDD). Crash recovery lifts openchamber's health-monitor + busy-aware-restart + stale-grace state machine into opencode-server.ts (+ port reclaim) and warm-acp.ts; opencode crash -> fresh sessions, ACP -> re-session/new. F.1 turn-guard + U.6 usage preserved (their tests pass). Orphan worktree reaper (1h grace, superset-style dirty/unpushed preflight, Paseo soft-delete) + close hooks + diff re-baseline after apply_pending. 35 new tests + DB-opt-in reconnect test; 215 coder tests pass; tsc + build clean. Completes v2.6. Follow-ups out of scope: apps/server close-hook caller, 3.7 DiffPanel staging hint, live smokes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,21 @@ const ConfigSchema = z.object({
|
||||
// SSH access to the host for external agent dispatch (Phase 5)
|
||||
BOOCODER_SSH_HOST: z.string().default('100.114.205.53'),
|
||||
BOOCODER_SSH_USER: z.string().default('samkintop'),
|
||||
// v2.6 Phase 3 (lifecycle hardening). Idle TTL: evict a non-busy warm backend
|
||||
// (opencode server / warm-ACP child) after this long with no turn — its worktree
|
||||
// + agent_sessions row persist, so the next turn re-spawns + reattaches. 30 min
|
||||
// default (design §6).
|
||||
AGENT_POOL_IDLE_TTL_MS: z.coerce.number().int().positive().default(1_800_000),
|
||||
// LRU cap: max live warm backends before the least-recently-used (non-busy) ones
|
||||
// are evicted. Bounds the long-lived-daemon's per-(chat,agent) Map growth.
|
||||
AGENT_POOL_MAX_LIVE: z.coerce.number().int().positive().default(10),
|
||||
// Periodic sweep cadence (idle/LRU pool eviction + orphan-worktree reap). 60s
|
||||
// mirrors the apps/server truncation/stale-streaming sweeper.
|
||||
LIFECYCLE_SWEEP_INTERVAL_MS: z.coerce.number().int().positive().default(60_000),
|
||||
// Orphan-worktree grace: an on-disk worktree dir with no live `worktrees` row is
|
||||
// only reaped after it's been untouched this long (avoids sweeping a dir mid
|
||||
// ensureSessionWorktree create). 1h default.
|
||||
ORPHAN_WORKTREE_GRACE_MS: z.coerce.number().int().positive().default(3_600_000),
|
||||
});
|
||||
|
||||
export type Config = z.infer<typeof ConfigSchema>;
|
||||
|
||||
Reference in New Issue
Block a user