Commit Graph

283 Commits

Author SHA1 Message Date
Dave
6170a7d984 story-kit: merge 133_story_clean_up_agent_state_on_story_archive_and_add_ttl_for_completed_entries 2026-02-24 13:20:59 +00:00
Dave
560c731869 story-kit: merge 134_story_add_process_health_monitoring_and_timeout_to_agent_pty_sessions 2026-02-24 13:13:16 +00:00
Dave
5226438b16 story-kit: merge 138_bug_no_heartbeat_to_detect_stale_websocket_connections 2026-02-24 13:05:30 +00:00
Dave
c5ddd15273 story-kit: merge 132_story_fix_toctou_race_in_agent_check_and_insert 2026-02-24 12:49:29 +00:00
Dave
2ac9e119e3 Fix master compilation after bad story 86 squash merge revert
The revert of story 86's merge left broken code from stories 131/135
that depended on it. Removed dead inline event dispatch (referencing
undefined event_type, pty_writer, PermissionReqMsg), added activity_tx
to process_json_event, and removed unused permission_tx parameter from
chat_stream/chat (permissions go through MCP, not PTY).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 12:44:22 +00:00
Dave
4611a187f1 fix: remove duplicate code block from merge conflict resolution in claude_code.rs
Old process_json_event call and new handle_stream_event match block were
both kept during auto-resolution; remove the old code to fix unclosed delimiter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 12:34:20 +00:00
Dave
557b6e9267 fix: resolve merge conflict artifacts from story-86 merge
- Add missing closing brace and #[test] attr between test functions in claude_code.rs
- Remove premature semicolon in TypeScript union type in client.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 12:33:31 +00:00
Dave
4e4802314f story-kit: merge 86_story_show_live_activity_status_instead_of_static_thinking_indicator_in_chat 2026-02-24 12:32:14 +00:00
Dave
2e2f70df72 Revert "story-kit: merge 86_story_show_live_activity_status_instead_of_static_thinking_indicator_in_chat"
This reverts commit ef162d91ff.
2026-02-24 12:16:45 +00:00
Dave
ef162d91ff story-kit: merge 86_story_show_live_activity_status_instead_of_static_thinking_indicator_in_chat 2026-02-24 12:08:59 +00:00
Dave
d6f394d28d story-kit: merge 130_bug_permission_approval_returns_wrong_format_tools_fail_after_user_approves 2026-02-24 11:51:00 +00:00
Dave
5481f65e8b story-kit: merge 129_story_test_coverage_http_mcp_rs 2026-02-24 00:30:54 +00:00
Dave
9b2969fdba story-kit: merge 128_story_test_coverage_worktree_rs 2026-02-24 00:26:49 +00:00
Dave
9528ef808c story-kit: merge 127_story_test_coverage_http_mod_rs 2026-02-24 00:24:08 +00:00
Dave
0c9588d32c story-kit: merge 124_story_test_coverage_llm_providers_claude_code_rs 2026-02-24 00:19:32 +00:00
Dave
ca9293216f story-kit: merge 123_story_test_coverage_llm_providers_anthropic_rs 2026-02-24 00:15:19 +00:00
Dave
7133ba1276 story-kit: merge 126_story_test_coverage_http_anthropic_rs 2026-02-24 00:11:55 +00:00
Dave
ca2097d8e4 story-kit: merge 122_story_test_coverage_http_ws_rs 2026-02-24 00:07:20 +00:00
Dave
26e2164833 story-kit: merge 125_story_test_coverage_http_io_rs 2026-02-24 00:03:47 +00:00
Dave
3825cbb8fd story-kit: merge 120_story_test_coverage_llm_chat_rs 2026-02-24 00:00:35 +00:00
Dave
e15ae3027f story-kit: merge 121_story_test_coverage_io_watcher_rs 2026-02-23 23:55:09 +00:00
Dave
4c137dee0d story-kit: merge 99_story_test_coverage_http_health_rs_to_100 2026-02-23 23:24:25 +00:00
Dave
b928eace9c story-kit: merge 119_story_mergemaster_should_resolve_merge_conflicts_instead_of_leaving_conflict_markers_on_master 2026-02-23 23:22:24 +00:00
Dave
e6339979de 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>
2026-02-23 22:58:51 +00:00
Dave
908fcef353 story-kit: merge 118_bug_agent_pool_retains_stale_running_state_after_completion_blocking_auto_assign 2026-02-23 22:53:23 +00:00
Dave
85fddcb71a story-kit: merge 117_story_show_startup_reconciliation_progress_in_ui 2026-02-23 22:50:57 +00:00
Dave
649b422338 story-kit: merge 108_story_test_coverage_http_agents_rs_to_70 2026-02-23 22:26:46 +00:00
Dave
c395edca42 story-kit: merge 107_story_test_coverage_http_assets_rs_to_85 2026-02-23 22:24:29 +00:00
Dave
5acf3b73c3 story-kit: merge 106_story_test_coverage_http_settings_rs_to_80 2026-02-23 22:21:37 +00:00
Dave
c139e03bfd story-kit: merge 105_story_test_coverage_io_shell_rs_to_95 2026-02-23 22:16:33 +00:00
Dave
9a97d33bfa story-kit: merge 104_story_test_coverage_io_search_rs_to_95 2026-02-23 22:13:03 +00:00
Dave
04bce52959 story-kit: merge 103_story_test_coverage_http_project_rs_to_80 2026-02-23 22:07:58 +00:00
Dave
28146fc259 story-kit: merge 101_story_test_coverage_http_chat_rs_to_80 2026-02-23 22:02:55 +00:00
Dave
a759a59a46 story-kit: queue 101_story_test_coverage_http_chat_rs_to_80 for merge 2026-02-23 22:00:33 +00:00
Dave
d3a29aac1a story-kit: merge 100_story_test_coverage_http_context_rs_to_100 2026-02-23 21:41:25 +00:00
Dave
3087297b88 story-kit: merge 91_bug_permissions_dialog_never_triggers_in_web_ui 2026-02-23 21:38:45 +00:00
Dave
e21c982d8b story-kit: merge 102_story_test_coverage_http_model_rs_to_80 2026-02-23 21:37:20 +00:00
Dave
6d87355577 Merge branch 'feature/story-97_bug_agent_pool_allows_multiple_instances_of_the_same_agent_to_run_concurrently' 2026-02-23 20:53:54 +00:00
Dave
a0f317292c story-kit: merge 93_story_expose_server_logs_to_agents_via_mcp
Adds log_buffer ring buffer and slog! macro for in-memory server log
capture, plus get_server_logs MCP tool for agents to read recent logs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 20:53:37 +00:00
Dave
bed46fea1b story-kit: accept 96_story_reset_agent_lozenge_to_idle_state_when_returning_to_roster 2026-02-23 20:52:06 +00:00
Dave
b09b6ce4f1 fix(agents): enforce single-instance concurrency per agent name
The agent pool allowed the same agent (e.g. "qa") to run concurrently
on multiple stories because start_agent() only checked whether that
story+agent combo was already active. It did not check whether the
agent was busy on a different story.

Two concurrent QA runs each spawn cargo clippy + cargo test + vitest,
causing extreme CPU load (load average >33 on M1 Mac).

Fix: before registering a new agent as Pending, scan all active entries
for any Running or Pending entry with the same agent_name. If one is
found, return an error explaining that the story will be picked up when
the agent becomes available.

The existing auto_assign_available_work() mechanism already scans
pipeline directories (3_qa/, 4_merge/, etc.) for unassigned stories
and uses find_free_agent_for_stage() — which respects single-instance
limits — to assign work when an agent slot opens up. So the queuing
behaviour is naturally provided: the story stays in its directory,
and auto-assign picks it up when the previous run completes.

Adds two regression tests:
- start_agent_rejects_when_same_agent_already_running_on_another_story
- start_agent_allows_new_story_when_previous_run_is_completed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 20:46:51 +00:00
Dave
8c6bd4cf74 feat(story-93): expose server logs to agents via get_server_logs MCP tool
- Add log_buffer module: bounded 1000-line ring buffer with push/get_recent API
- Add slog! macro: drop-in for eprintln! that also captures to ring buffer
- Replace all eprintln! calls across agents, watcher, search, chat, worktree, claude_code with slog!
- Add get_server_logs MCP tool: accepts count (1-500) and optional filter params
- 5 unit tests for log_buffer covering push/retrieve, eviction, filtering, count limits, empty buffer
- 262 tests passing, clippy clean

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 20:38:19 +00:00
Dave
cd902ff219 story-kit: merge 94_bug_stale_agent_state_persists_after_server_restart 2026-02-23 20:38:17 +00:00
Dave
a25553f1bc story-kit: merge 78_story_create_spike_mcp_tool 2026-02-23 20:27:09 +00:00
Dave
04e7a1e854 Remove invalid --directory flag that broke agent spawning
The --directory flag does not exist in Claude Code CLI. It was added in
c169cfc but caused every agent spawn to exit immediately with "unknown
option", resulting in Session: None errors. The process cwd (set via
cmd.cwd()) already correctly pins agents to the worktree directory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 19:26:37 +00:00
Dave
31037f5bf5 Remove test_plan gate from the codebase
The test_plan field was a gate from the old interactive web UI workflow
where a human would approve a test plan before the LLM could write code.
With autonomous coder agents, this gate is dead weight — coders sometimes
obey the README's "wait for approval" instruction and produce no code.

Removes: TestPlanStatus enum, ensure_test_plan_approved checks in fs/shell,
set_test_plan MCP tool + handler, test_plan from story/bug front matter
creation, test_plan validation in validate_story_dirs, and all related tests.
Updates README to remove Step 2 (Test Planning) and renumber steps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 19:12:05 +00:00
Dave
1539e52b19 Inject story content into agent prompts so coders know what to build
The worktree doesn't have .story_kit/work/ so agents had no access to
the story requirements. Read the story file from the project root and
prepend it to the prompt. Without this, coders would start, read
CLAUDE.md, have nothing to implement, and exit with no code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 18:50:41 +00:00
Dave
c169cfc9fa Pass --directory flag to Claude Code agents to prevent worktree escape
Claude Code resolves its project root by walking up from cwd looking
for .git. In worktrees, .git is a file pointing back to the main
checkout, so Claude Code would resolve the main repo as its project
and write files there instead of in the worktree. Adding --directory
explicitly pins it to the worktree path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 18:43:23 +00:00
Dave
af1625a132 story-kit: merge 86_story_show_live_activity_status_instead_of_static_thinking_indicator_in_chat 2026-02-23 18:38:15 +00:00
Dave
225073649b story-kit: start 88_story_auto_assign_agents_to_available_work_on_server_startup 2026-02-23 18:20:24 +00:00