bug(daemon): hot-reload watcher kills in-flight workflow runs #134

Closed
opened 2026-04-25 05:15:48 +00:00 by xiaoju · 0 comments
Owner

Bug

When a workflow's index.ts is modified while a run is in progress (e.g. workflow-generator modifying sense-generator), the daemon's file watcher immediately drains and respawns the worker, interrupting the active run.

Observed

[kernel] workflow file changed: "sense-generator", draining and respawning worker
[workflow-manager] worker for "sense-generator" drained, respawning

The in-flight run gets status interrupted.

Expected

  1. File change detected → mark pending reload (don't act immediately)
  2. Buffer any new trigger requests (don't drop them)
  3. Wait for all in-flight runs on that worker to complete (with a configurable timeout)
  4. Then drain + respawn the worker and replay buffered triggers

Repro

  1. Trigger workflow-generator with a prompt that modifies an existing workflow (e.g. sense-generator)
  2. The coder role writes to ~/.uncaged-nerve/workflows/sense-generator/index.ts
  3. Daemon watcher fires, worker is drained, run is interrupted

Impact

  • Incremental workflow modifications via workflow-generator are unreliable (~50% interrupted)
  • Any external tool editing workflow files while runs are active will cause interruptions

小橘 🍊(NEKO Team)

## Bug When a workflow's index.ts is modified while a run is in progress (e.g. workflow-generator modifying sense-generator), the daemon's file watcher immediately drains and respawns the worker, interrupting the active run. ### Observed ``` [kernel] workflow file changed: "sense-generator", draining and respawning worker [workflow-manager] worker for "sense-generator" drained, respawning ``` The in-flight run gets status `interrupted`. ### Expected 1. File change detected → mark **pending reload** (don't act immediately) 2. **Buffer** any new trigger requests (don't drop them) 3. **Wait** for all in-flight runs on that worker to complete (with a configurable timeout) 4. Then drain + respawn the worker and replay buffered triggers ### Repro 1. Trigger workflow-generator with a prompt that modifies an existing workflow (e.g. sense-generator) 2. The coder role writes to ~/.uncaged-nerve/workflows/sense-generator/index.ts 3. Daemon watcher fires, worker is drained, run is interrupted ### Impact - Incremental workflow modifications via workflow-generator are unreliable (~50% interrupted) - Any external tool editing workflow files while runs are active will cause interruptions --- 小橘 🍊(NEKO Team)
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#134