M26-4 Lifecycle config: schema, defaults, dashboard CRUD surface #591

Closed
opened 2026-04-30 19:31:41 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As a service operator, I want lifecycle and idle_stop_seconds to be first-class agent config exposed through the dashboard, so that I can flip a role between lazy and hot, or tune its idle window, without editing JSON files or restarting the service.

Acceptance criteria

Schema

  • config/agents.json AgentTypeConfig (and the SQLite agents row) gain:
    • container.lifecycle: "hot" | "lazy" (default: lazy)
    • container.idle_stop_seconds: number (default: 300)
  • @claude-hooks/shared types updated; both fields propagate through webhook-config.tslistResolvedAgents.
  • Existing rows on first boot get backfilled: lifecycle = "lazy", idle_stop_seconds = 300 for every role except foreman (host-mode, fields ignored).

Dashboard

  • Agents page (A6 CRUD surface) exposes both fields per instance: lifecycle as a select (lazy / hot), idle_stop_seconds as a number input (min 60, max 3600).
  • PATCH /agents/:name handler validates and persists changes; reconcile picks up the drift (lifecycle change recreates container, idle change is hot-applied to the lifecycle module).
  • Agents list shows the current lifecycle + state badge (Running / Stopped / Starting / Stopping) using data from the lifecycle module.

Migration

  • One-shot SQLite migration adds the columns with defaults. just dev boot is non-destructive on existing DB.

Tests

  • Schema validation rejects invalid lifecycle values and out-of-range idle_stop_seconds.
  • CRUD round-trip: PATCH lifecycle → reconcile recreates container with new --restart flag.
  • Backfill migration test against a fixture DB.

Out of scope

  • Lifecycle module + state machine (M26-1).
  • Reconcile + watchdog wiring (M26-2).
  • Pool selection (M26-3).
  • SSE / metrics (M26-5).

References

  • specs/container-lazy-lifecycle.md §Role classification / §Idle threshold.
  • apps/web/ Agents page (A6).
  • apps/server/src/shared/config/webhook-config.ts.
  • apps/server/src/infrastructure/database/.
## User story As a service operator, I want `lifecycle` and `idle_stop_seconds` to be first-class agent config exposed through the dashboard, so that I can flip a role between lazy and hot, or tune its idle window, without editing JSON files or restarting the service. ## Acceptance criteria ### Schema - [ ] `config/agents.json` AgentTypeConfig (and the SQLite `agents` row) gain: - `container.lifecycle: "hot" | "lazy"` (default: `lazy`) - `container.idle_stop_seconds: number` (default: `300`) - [ ] `@claude-hooks/shared` types updated; both fields propagate through `webhook-config.ts` → `listResolvedAgents`. - [ ] Existing rows on first boot get backfilled: `lifecycle = "lazy"`, `idle_stop_seconds = 300` for every role except `foreman` (host-mode, fields ignored). ### Dashboard - [ ] Agents page (A6 CRUD surface) exposes both fields per instance: `lifecycle` as a select (`lazy` / `hot`), `idle_stop_seconds` as a number input (min 60, max 3600). - [ ] PATCH /agents/:name handler validates and persists changes; reconcile picks up the drift (lifecycle change recreates container, idle change is hot-applied to the lifecycle module). - [ ] Agents list shows the current lifecycle + state badge (Running / Stopped / Starting / Stopping) using data from the lifecycle module. ### Migration - [ ] One-shot SQLite migration adds the columns with defaults. `just dev` boot is non-destructive on existing DB. ### Tests - [ ] Schema validation rejects invalid `lifecycle` values and out-of-range `idle_stop_seconds`. - [ ] CRUD round-trip: PATCH `lifecycle` → reconcile recreates container with new `--restart` flag. - [ ] Backfill migration test against a fixture DB. ## Out of scope - Lifecycle module + state machine (M26-1). - Reconcile + watchdog wiring (M26-2). - Pool selection (M26-3). - SSE / metrics (M26-5). ## References - `specs/container-lazy-lifecycle.md` §Role classification / §Idle threshold. - `apps/web/` Agents page (A6). - `apps/server/src/shared/config/webhook-config.ts`. - `apps/server/src/infrastructure/database/`.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#591
No description provided.