feat(story-115): hot-reload project.toml agent config without server restart

- Extend `WatcherEvent` to an enum with `WorkItem` and `ConfigChanged` variants
  so the watcher can distinguish between pipeline-file changes and config changes
- Watch `.story_kit/project.toml` at the project root (ignoring worktree copies)
  and broadcast `WatcherEvent::ConfigChanged` on modification
- Forward `agent_config_changed` WebSocket message to connected clients; skip
  pipeline state refresh for config-only events
- Add `is_config_file()` helper with unit tests covering root vs. worktree paths
- Accept `configVersion` prop in `AgentPanel` and re-fetch the agent roster
  whenever it increments
- Increment `agentConfigVersion` in `Chat` on receipt of `agent_config_changed`
  WS event via new `onAgentConfigChanged` handler in `ChatWebSocket`

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-23 22:58:51 +00:00
parent 662df66c13
commit e6339979de
6 changed files with 176 additions and 33 deletions

View File

@@ -0,0 +1,23 @@
---
name: "Hot-reload project.toml agent config without server restart"
---
# Story 115: Hot-reload project.toml agent config without server restart
## User Story
As a developer, I want changes to `.story_kit/project.toml` to be picked up automatically by the running server, so that I can update the agent roster without restarting the server.
## Acceptance Criteria
- [ ] When `.story_kit/project.toml` is saved on disk, the server detects the change within the debounce window (300 ms) and broadcasts an `agent_config_changed` WebSocket event to all connected clients
- [ ] The frontend `AgentPanel` automatically re-fetches and displays the updated agent roster upon receiving `agent_config_changed`, without any manual action
- [ ] `project.toml` changes inside worktree directories (paths containing `worktrees/`) are NOT broadcast
- [ ] Config file changes do NOT trigger a pipeline state refresh (only work-item events do)
- [ ] A helper `is_config_file(path, git_root)` correctly identifies the root-level `.story_kit/project.toml` (returns false for worktree copies)
## Out of Scope
- Watching for newly created `project.toml` (only file modification events)
- Validating the new config before broadcasting (parse errors are surfaced on next `get_agent_config` call)
- Reloading config into in-memory agent state (agents already read config from disk on each start)