Commit Graph

202 Commits

Author SHA1 Message Date
mika kuns
a8b86e25e6 feat(ui): single approve action merges the whole unit
Approve & Merge is now the only review+merge entry. For a parent with
children it drives the unit merge via the worker (conflicts still surface
through the existing PlanningMergeConflict dialog); the separate Merge All
Subtasks button, MergeAllCommand, CanMergeAll plumbing, and the dead
MergeAllPlanningAsync client method are removed. Combined-diff preview and
conflict continue/abort are kept.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 11:43:04 +02:00
mika kuns
1abb429f12 feat(worker): approve drives the unit merge for parents with children
ApproveReview routes a parent that has children through
PlanningMergeOrchestrator (merge parent + each Done child, set parent Done,
conflict continue/abort) instead of the parent-only ApproveAndMergeAsync.
Childless tasks are unchanged. Removes the now-redundant MergeAllPlanning hub
method (UI rewiring follows separately).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 11:32:33 +02:00
mika kuns
12732d6dc9 feat(worker): planning finalize enters WaitingForChildren
A finalized planning parent now joins the unified parent lifecycle:
WaitingForChildren while its child chain runs (or WaitingForReview directly
if it has no children), advancing to review like an improvement parent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 11:19:29 +02:00
mika kuns
b3a2daf40d refactor(worker): single parent-advance path for planning + improvement
Collapse TryCompleteParentAsync (planning -> Done) and
TryAdvanceImprovementParentAsync (improvement -> WaitingForReview) into one
TryAdvanceParentAsync that surfaces any WaitingForChildren parent for review
once all children are terminal. Planning parents no longer auto-complete.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 11:14:43 +02:00
mika kuns
ca8326c4c5 fix(mcp): merge_task marks the task Done after a successful merge
merge_task only flipped the worktree to Merged; it never transitioned the task
status. With allowWaitingForReview this left a merged task stuck in
WaitingForReview. Approve it to Done on a successful merge (a Done task is
already terminal). Mirrors the ApproveAndMergeAsync review flow.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 10:36:26 +02:00
mika kuns
5723b81992 Merge task branch for: Worker hardening: CLI arg injection, stuck-Running, planning-chain wedge, Fail guard 2026-06-09 10:06:59 +02:00
mika kuns
33bdff8a6e fix(worker): harden CLI injection, stuck-Running, chain wedge, and Fail guard
1. ArgumentList (fix injection): ClaudeArgsBuilder.Build() now returns
   IReadOnlyList<string>; ClaudeProcess populates ProcessStartInfo.ArgumentList
   instead of Arguments, so values like system prompts are never shell-split.
   DailyPrepPrompt, RefinePrompt, and WeekReportService migrated similarly.
   All IClaudeProcess fakes updated.

2. ContinueAsync exception guard: wrap RunOnceAsync in try/catch matching
   the RunAsync pattern so an unexpected exception never leaves the task
   stuck in Running status.

3. Planning chain cascade: OnChildFinishedAsync now calls CancelAsync on
   the immediate blocked successor when a child fails or is cancelled,
   triggering a recursive cascade that clears the entire remaining chain
   instead of leaving it wedged.

4. FailAsync guard: restrict valid source states to Running and Queued;
   WaitingForReview -> Failed is now rejected, preventing an invalid
   transition that could corrupt the review workflow.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 10:05:40 +02:00
mika kuns
9f19a714f7 feat(mcp): add get_task_config, continue_task; fix status enum, branchDeleted, merge-from-review
- ConfigMcpTools: add get_task_config read-back (was write-only)
- ExternalMcpService: add WaitingForChildren to ListTasks filter and GetTaskStatusValues
- ExternalMcpService: add continue_task tool wrapping QueueService.ContinueTask
- ExternalMcpService: add allowWaitingForReview param to merge_task (default false)
- ExternalMcpService: fix CleanupTaskWorktree branchDeleted — now uses real branch-delete outcome
- WorktreeMaintenanceService: TryRemoveAsync returns (Removed, BranchDeleted) tuple; ForceRemoveResult gains BranchDeleted field
- Tests: 9 new cases covering all five changes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 09:57:47 +02:00
mika kuns
dcbf67c63b feat(merge): read conflict stages and write user resolutions 2026-06-05 10:49:07 +02:00
mika kuns
2dfc4559b1 feat(ui): add conflict-resolution worker contract (foundation for merge rework) 2026-06-05 10:20:42 +02:00
mika kuns
3202c76674 feat(ui): wire merge-aware approve and preview into the worker client
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 23:32:12 +02:00
mika kuns
98b0d58e03 fix(worker-tests): update TaskMergeService ctor calls after ITaskStateService injection 2026-06-04 23:25:03 +02:00
mika kuns
b817c87656 feat(worker): approve merges worktree before marking task done 2026-06-04 23:24:50 +02:00
mika kuns
4098f7f341 feat(git): add non-destructive merge-tree conflict probe 2026-06-04 23:18:54 +02:00
mika kuns
82390047d2 feat(ui): add RefineTask client call and refine events
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 23:16:58 +02:00
mika kuns
e523ed85eb feat(refine): wire RefineTask hub method, broadcaster events, and DI 2026-06-04 23:14:00 +02:00
mika kuns
0460d7bea5 feat(refine): add RefineRunner, prompt/args helper, and interfaces
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 23:09:30 +02:00
mika kuns
22830d3ea8 feat(mcp): add add_subtask tool to claudedo MCP 2026-06-04 23:03:07 +02:00
mika kuns
519bfbe6b3 feat(merge): fold parent branch into tree-merge for improvement parents
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 16:09:44 +02:00
mika kuns
06e3acd5ac feat(runner): mint per-run MCP token + emit run-scoped --mcp-config
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 16:03:51 +02:00
mika kuns
f3052dc5fc feat(mcp): resolve per-run tokens in MCP auth + register TaskRunMcpService
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 15:57:12 +02:00
mika kuns
9d133e227b feat(mcp): add SuggestImprovement tool (server-stamped, one layer deep) 2026-06-04 15:51:57 +02:00
mika kuns
ef86a8c29b feat(mcp): add per-run TaskRunTokenRegistry 2026-06-04 15:50:06 +02:00
mika kuns
da23b6cd3a feat(worktree): base improvement-child worktree on parent HEAD 2026-06-04 15:46:44 +02:00
mika kuns
c10f564265 feat(runner): route standalone success with children to WaitingForChildren + enqueue them 2026-06-04 15:46:38 +02:00
mika kuns
6f4b5d5544 feat(state): add SubmitForChildrenAsync (Running -> WaitingForChildren)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 15:38:15 +02:00
mika kuns
f25c7599bd fix(children): exempt improvement children from orphan-dequeue sweep 2026-06-04 15:35:06 +02:00
mika kuns
d8b86e33a3 feat(ui): host review actions in the details panel; show review state and diff meter
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 15:03:19 +02:00
mika kuns
49b9f1ffde feat(roadblock): persist roadblock count on the task 2026-06-04 14:58:59 +02:00
mika kuns
9a117a5429 fix(prompts): apply system default on every run; dedupe roadblocks
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 14:25:55 +02:00
mika kuns
1e547dea18 feat(roadblock): surface reported roadblocks in the review result
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 14:18:51 +02:00
mika kuns
cf7f0da400 feat(roadblock): collect and strip CLAUDEDO_BLOCKED markers in StreamAnalyzer 2026-06-04 14:15:45 +02:00
mika kuns
79bfc79d33 feat(prompts): daily-prep prompt from file, English default 2026-06-04 14:11:30 +02:00
mika kuns
edc9f77357 feat(prompts): retry prompt from file, append only real captured errors
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 14:03:32 +02:00
mika kuns
925b72ae83 test(worker): cover max-turns in ConfigMcpTools round-trip
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 12:41:54 +02:00
mika kuns
beae2d639d feat(worker): resolve max-turns from task then list then global default
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 12:20:35 +02:00
mika kuns
ac137f7c1c feat(data): persist max_turns in list and task repositories
Add MaxTurns to ListRepository.SetConfigAsync upsert branch and
TaskRepository.UpdateAgentSettingsAsync; fix positional CancellationToken
call in ConfigMcpTools. Covered by MaxTurnsRoundTripTests (2 tests).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 12:18:32 +02:00
mika kuns
2dfa9956c5 revert: drop real-claude smoke test; track as manual verification
A test that spawns the actual claude binary shouldn't live in the suite —
dotnet test must never invoke Claude. §1.0 step 3 stays a manual check.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 11:39:20 +02:00
mika kuns
773811d060 test(worker): add opt-in real-claude smoke test
Spawns the actual claude binary and asserts exit code 0, a session id,
non-empty result, and output tokens > 0 (plan-verification §1.0 step 3).
Inert unless CLAUDE_AUTHENTICATED=1, since it needs an authenticated CLI.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 11:36:51 +02:00
mika kuns
cc46019622 test(worker): cover External MCP worktree/git tools
Add error-path + git-backed happy-path tests for the five previously
untested ExternalMcpService tools: GetTaskWorktree, GetTaskDiff,
MergeTask (dry-run + not-Done guard), ListWorktrees, CleanupTaskWorktree.
Git-backed cases skip when git is unavailable.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 11:24:45 +02:00
mika kuns
71ac48162a fix(worker): clean up orphaned worktree when the DB row insert fails
If WorktreeAddAsync succeeds but the worktrees-row insert throws, the
worktree was left on disk and branch undeleted with nothing tracking it.
Wrap the insert in try/catch and best-effort remove the worktree+branch
(non-cancellable) before rethrowing.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 11:21:40 +02:00
mika kuns
914095dc99 feat(daily-prep): load persisted prep log into the terminal on open
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 09:44:38 +02:00
mika kuns
4d82079cac feat(daily-prep): persist last prep run to a log file and serve it via GetLastPrepLog
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 09:39:11 +02:00
mika kuns
7676ecf0d4 feat(daily-prep): expose prep stream events and ClearMyDay on the UI worker client 2026-06-04 08:09:41 +02:00
mika kuns
fa83d7f441 feat(daily-prep): add ClearMyDay hub method 2026-06-04 08:05:33 +02:00
mika kuns
e48475d6cd feat(daily-prep): stream prep output via PrepStarted/PrepLine/PrepFinished
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 08:02:24 +02:00
mika kuns
2d00160283 feat(daily-prep): add RunDailyPrepNow hub method and expose DailyPrepMaxTasks 2026-06-03 16:30:23 +02:00
mika kuns
20b3a29d08 feat(daily-prep): run daily prep from PrimeRunner via allowed MCP tools 2026-06-03 16:24:09 +02:00
mika kuns
fd7f8ac78f feat(daily-prep): add set_my_day MCP tool with cap-guard 2026-06-03 16:19:36 +02:00
mika kuns
0bb809445e feat(daily-prep): add get_daily_prep_candidates MCP tool 2026-06-03 16:15:27 +02:00