Curator runtime mutation: Registry.Unregister + Runtime.Add/Remove #484

Closed
opened 2026-10-27 13:36:30 +00:00 by sam · 1 comment
Owner

A definition change must take effect without restarting the daemon. Today it cannot: Registry exposes Register but no Unregister, and Runtime exposes Start/Nudge/Stop but no Add/Remove, and Start() snapshots the registry's curator set into one goroutine per curator. Membership is therefore fixed for the process lifetime.

Scope

  • Registry.Unregister(name), valid while the registry is running, with the same failure isolation the registry already applies (a rejected removal affects only that curator).
  • Runtime.Add(engine) / Runtime.Remove(name): Remove cancels the removed curator's in-flight pass context and stops its goroutine within a bounded wait; Add registers and starts one.
  • An app-layer apply path that a definition mutation calls: stop the old engine, then register and start the new one, with the registry remaining the membership authority and the runtime the scheduler.
  • Tests proving: a definition added at runtime starts a loop and its pass runs without a restart; a removed definition's in-flight pass is cancelled and its goroutine exits; an update replaces the engine without leaving the previous loop alive or a pass running under the old definition.

Non-goals

  • No persistence and no HTTP surface; this is the mutation mechanism only.
  • No change to Start()'s startup ordering or shutdown sequencing for the curators already registered.

Acceptance criteria

  1. Registry.Unregister and Runtime.Add/Runtime.Remove exist with tests covering add-then-pass, remove-cancels-in-flight, and update-replaces.
  2. Removal is bounded: a pass that ignores cancellation cannot block removal forever, and shutdown order for existing curators is unchanged.
  3. Removal while a pass is in flight leaves no goroutine and no event attributed to a curator that no longer exists.

Security and failure paths

  • Removal must not be a way to orphan a loop: a failed stop is reported, not swallowed.
  • Concurrent register/unregister must not race with the runtime's pass dispatch (the registry mutex stays the authority; the runtime must not hold it across a pass).

Dependencies

  • Depends on the generic definition-driven engine child, whose engine is the thing being added and removed.

Implementation status (audit-verified 2026-09-12)

  • Registry exposes Register (registry.go:89) and no Unregister. Runtime exposes Start/Nudge/Stop (runtime.go:79/116/135) and no Add/Remove; Start() snapshots the registry's membership into one goroutine per curator, so membership cannot change while running.
  • RuntimeConfig is passed empty (bootstrap.go:1033), so PassTimeout and MaxConcurrentPasses are code defaults with no config surface — a live-path constant, contrary to the epic's no-hard-coded-configuration rule.
  • runtime.go:202-211 returns silently when Check reports not-due; a not-due curator emits no log line at all. This is why the skill curator's total absence from logs is indistinguishable from health.

Merged from the other tracker

Phase 2. Registry.Unregister(name) while running; Runtime.Add/Runtime.Remove(name) where Remove cancels the in-flight pass context and stops the goroutine within a bounded wait; app-layer apply sequence (stop old, register new, start).

Acceptance: add-then-pass works without restart; remove cancels an in-flight pass and leaves no goroutine; update replaces without a stale loop; removal bounded even when a pass ignores cancellation; startup ordering/shutdown for existing curators unchanged.

Security/failure: removal must not orphan a loop; a failed stop is reported, not swallowed; never hold the registry mutex across a pass.

Deps: phase 1 engine. GitHub: #791. Design: docs/prds/dynamic-curators.md.

Notes

CORRECTION (2026-09-12): the 'forge issue tools are a blocker' finding was wrong. No dedicated issue tool exists and no MCP server was ever configured, BUT the chat agent's is unconfined (chat.unrestricted_filesystem=true), so already works. Dedicated tools (#161) are convenience, not a prerequisite. VERIFIED STATE: (1) ToolBuilder has NO implementation anywhere - only the interface decl at domain/curator/registrar.go:86 and the fail-closed guard at registry.go:123; bootstrap.go builds the Registrar with no Tools field. (2) curatorLLMRunner at app/archied/main.go:551 drops ChatRequest.Tools - a SECOND independent blocker; fixing ToolBuilder alone still yields tool-less passes. (3) No definition persistence, no Unregister, no Runtime.Add/Remove. (4) runtime.go:202-211 logs nothing on not-due, so the skill curator's absence from logs is indistinguishable from health. EVIDENCE: standalone prototype at ~/projects/issue-orchestrator drove a real tool loop against live GitHub issues with local model defiant-fable-q6: 3 issues, 2 model steps, ~60s. Proof the loop works on local HW.

Close reason

49444e17: Runtime.Add/Remove with per-loop cancel and bounded wait, lifecycle StartOne/Unregister, ReplaceDefinitions diffs instead of stop-the-world. A loop that outlives a bounded stop blocks re-add and restart instead of running twice.


Imported from beads archie-core-trnd.2 · GitHub #806 · body merged from the fuller GitHub #791 · type task · priority P2 · created 2026-09-12 · closed 2026-10-25

A definition change must take effect without restarting the daemon. Today it cannot: `Registry` exposes `Register` but no `Unregister`, and `Runtime` exposes `Start`/`Nudge`/`Stop` but no `Add`/`Remove`, and `Start()` snapshots the registry's curator set into one goroutine per curator. Membership is therefore fixed for the process lifetime. ### Scope - `Registry.Unregister(name)`, valid while the registry is running, with the same failure isolation the registry already applies (a rejected removal affects only that curator). - `Runtime.Add(engine)` / `Runtime.Remove(name)`: `Remove` cancels the removed curator's in-flight pass context and stops its goroutine within a bounded wait; `Add` registers and starts one. - An app-layer apply path that a definition mutation calls: stop the old engine, then register and start the new one, with the registry remaining the membership authority and the runtime the scheduler. - Tests proving: a definition added at runtime starts a loop and its pass runs without a restart; a removed definition's in-flight pass is cancelled and its goroutine exits; an update replaces the engine without leaving the previous loop alive or a pass running under the old definition. ### Non-goals - No persistence and no HTTP surface; this is the mutation mechanism only. - No change to `Start()`'s startup ordering or shutdown sequencing for the curators already registered. ### Acceptance criteria 1. `Registry.Unregister` and `Runtime.Add`/`Runtime.Remove` exist with tests covering add-then-pass, remove-cancels-in-flight, and update-replaces. 2. Removal is bounded: a pass that ignores cancellation cannot block removal forever, and shutdown order for existing curators is unchanged. 3. Removal while a pass is in flight leaves no goroutine and no event attributed to a curator that no longer exists. ### Security and failure paths - Removal must not be a way to orphan a loop: a failed stop is reported, not swallowed. - Concurrent register/unregister must not race with the runtime's pass dispatch (the registry mutex stays the authority; the runtime must not hold it across a pass). ### Dependencies - Depends on the generic definition-driven engine child, whose engine is the thing being added and removed. ### Implementation status (audit-verified 2026-09-12) - `Registry` exposes `Register` (`registry.go:89`) and no `Unregister`. `Runtime` exposes `Start`/`Nudge`/`Stop` (`runtime.go:79/116/135`) and no `Add`/`Remove`; `Start()` snapshots the registry's membership into one goroutine per curator, so membership cannot change while running. - `RuntimeConfig` is passed empty (`bootstrap.go:1033`), so `PassTimeout` and `MaxConcurrentPasses` are code defaults with no config surface — a live-path constant, contrary to the epic's no-hard-coded-configuration rule. - `runtime.go:202-211` returns silently when `Check` reports not-due; a not-due curator emits no log line at all. This is why the skill curator's total absence from logs is indistinguishable from health. ### Merged from the other tracker Phase 2. Registry.Unregister(name) while running; Runtime.Add/Runtime.Remove(name) where Remove cancels the in-flight pass context and stops the goroutine within a bounded wait; app-layer apply sequence (stop old, register new, start). Acceptance: add-then-pass works without restart; remove cancels an in-flight pass and leaves no goroutine; update replaces without a stale loop; removal bounded even when a pass ignores cancellation; startup ordering/shutdown for existing curators unchanged. Security/failure: removal must not orphan a loop; a failed stop is reported, not swallowed; never hold the registry mutex across a pass. Deps: phase 1 engine. GitHub: #791. Design: docs/prds/dynamic-curators.md. ### Notes CORRECTION (2026-09-12): the 'forge issue tools are a blocker' finding was wrong. No dedicated issue tool exists and no MCP server was ever configured, BUT the chat agent's is unconfined (chat.unrestricted_filesystem=true), so already works. Dedicated tools (#161) are convenience, not a prerequisite. VERIFIED STATE: (1) ToolBuilder has NO implementation anywhere - only the interface decl at domain/curator/registrar.go:86 and the fail-closed guard at registry.go:123; bootstrap.go builds the Registrar with no Tools field. (2) curatorLLMRunner at app/archied/main.go:551 drops ChatRequest.Tools - a SECOND independent blocker; fixing ToolBuilder alone still yields tool-less passes. (3) No definition persistence, no Unregister, no Runtime.Add/Remove. (4) runtime.go:202-211 logs nothing on not-due, so the skill curator's absence from logs is indistinguishable from health. EVIDENCE: standalone prototype at ~/projects/issue-orchestrator drove a real tool loop against live GitHub issues with local model defiant-fable-q6: 3 issues, 2 model steps, ~60s. Proof the loop works on local HW. ### Close reason 49444e17: Runtime.Add/Remove with per-loop cancel and bounded wait, lifecycle StartOne/Unregister, ReplaceDefinitions diffs instead of stop-the-world. A loop that outlives a bounded stop blocks re-add and restart instead of running twice. --- _Imported from beads `archie-core-trnd.2` · GitHub #806 · body merged from the fuller GitHub #791 · type task · priority P2 · created 2026-09-12 · closed 2026-10-25_
sam added the mediumtask labels 2026-10-27 13:36:30 +00:00
sam self-assigned this 2026-10-27 13:36:30 +00:00
sam closed this issue 2026-10-27 13:36:30 +00:00
Author
Owner

sam wrote (originally 2026-10-08):

4q28.18 adds live replacement and validates before draining passes, with add/remove PostgreSQL/gRPC acceptance. This older ticket stays open: bounded cancellation of an ignoring pass and add-then-model-pass acceptance have not been demonstrated.

_sam wrote (originally 2026-10-08):_ 4q28.18 adds live replacement and validates before draining passes, with add/remove PostgreSQL/gRPC acceptance. This older ticket stays open: bounded cancellation of an ignoring pass and add-then-model-pass acceptance have not been demonstrated.
sam added a new dependency 2026-11-14 14:45:07 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#484