Bug Fix - Smart delegate with worktree awareness #128

Closed
opened 2026-04-03 14:56:02 +02:00 by shoko · 0 comments
Owner

Summary

Improve cmd_delegate to route tasks to correct worktrees and inform PM agent when delegation lacks complete information.

Problem

Current cmd_delegate has no worktree awareness. It reuses existing worktrees, causing file conflicts when delegating multiple tasks to different issues.

Proposed Logic

cmd_delegate "<message>"

1. Parse message for: repo, user, issue
2. Inject context:
   "This task delegation has no information about: <missing fields>.
    We need them if user wants to work on a specific issue.
    Otherwise we don't need it."
3. Route:
   ├─ Has complete info + worktree exists → cmd_continue
   ├─ Has complete info + no worktree → cmd_start
   └─ Incomplete info → delegate to PM agent for clarification

4. PM agent responds via:
   ├─ Delegation log (already exists)
   └─ kugetsu notify (already exists)

Context Injection Example

Before sending to PM agent, append:

This task delegation has no information about: repository, issue number.
We need them if user wants to work on a specific issue. Otherwise we don't need it.

PM agent can then:

  • Proceed with research-only tasks (no write access needed)
  • Ask human for clarification before proceeding with specific issues

Relationship to Other Issues

  • #126: This should resolve the delegate file conflict issue
  • #127: Fixes cmd_continue subshell pattern; this builds on top of it

Acceptance Criteria

  • delegate routes to correct worktree when info complete
  • Missing info context injected into delegation message
  • PM agent notified via existing mechanisms
  • No file conflicts with multiple delegated tasks
  • Research tasks still work without full info

Open Questions

  1. How to parse repo/user/issue from natural language?
  2. What level of context injection is sufficient?
## Summary Improve `cmd_delegate` to route tasks to correct worktrees and inform PM agent when delegation lacks complete information. ## Problem Current `cmd_delegate` has no worktree awareness. It reuses existing worktrees, causing file conflicts when delegating multiple tasks to different issues. ## Proposed Logic ``` cmd_delegate "<message>" 1. Parse message for: repo, user, issue 2. Inject context: "This task delegation has no information about: <missing fields>. We need them if user wants to work on a specific issue. Otherwise we don't need it." 3. Route: ├─ Has complete info + worktree exists → cmd_continue ├─ Has complete info + no worktree → cmd_start └─ Incomplete info → delegate to PM agent for clarification 4. PM agent responds via: ├─ Delegation log (already exists) └─ kugetsu notify (already exists) ``` ## Context Injection Example Before sending to PM agent, append: ``` This task delegation has no information about: repository, issue number. We need them if user wants to work on a specific issue. Otherwise we don't need it. ``` PM agent can then: - Proceed with research-only tasks (no write access needed) - Ask human for clarification before proceeding with specific issues ## Relationship to Other Issues - **#126**: This should resolve the delegate file conflict issue - **#127**: Fixes cmd_continue subshell pattern; this builds on top of it ## Acceptance Criteria - [ ] `delegate` routes to correct worktree when info complete - [ ] Missing info context injected into delegation message - [ ] PM agent notified via existing mechanisms - [ ] No file conflicts with multiple delegated tasks - [ ] Research tasks still work without full info ## Open Questions 1. How to parse repo/user/issue from natural language? 2. What level of context injection is sufficient?
shoko added the feature0.2.x-only labels 2026-04-03 14:56:02 +02:00
shoko added this to the v0.2.x milestone 2026-04-03 14:56:10 +02:00
shoko removed the 0.2.x-onlyfeature labels 2026-04-03 15:00:15 +02:00
shoko removed this from the v0.2.x milestone 2026-04-03 15:00:16 +02:00
shoko changed title from Feature - Smart delegate with worktree awareness to Bug Fix - Smart delegate with worktree awareness 2026-04-03 15:00:46 +02:00
shoko closed this issue 2026-04-03 16:31:31 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/kugetsu#128