queue-daemon: delegate with just issue ref causes confusing agent behavior #209

Open
opened 2026-04-07 11:13:29 +02:00 by shoko · 0 comments
Owner

Problem

When kugetsu delegate is called with just an issue ref as the message (e.g., kugetsu delegate "git.fbrns.co/shoko/kugetsu#118"), the agent receives the issue ref as both the issue_ref AND the message, causing confusing behavior.

Steps to Reproduce

  1. Run kugetsu delegate "git.fbrns.co/shoko/kugetsu#118"
  2. Queue item stores:
    • issue_ref: "git.fbrns.co/shoko/kugetsu#118"
    • message: "git.fbrns.co/shoko/kugetsu#118"
  3. Daemon calls cmd_continue "git.fbrns.co/shoko/kugetsu#118" "git.fbrns.co/shoko/kugetsu#118"
  4. Agent receives: "Additional instructions from delegator: git.fbrns.co/shoko/kugetsu#118"
  5. Agent gets confused because issue ref looks like a partial instruction

Root Cause

In cmd_delegate (kugetsu-session.sh:205-208):

if [ -n "$issue_ref" ] && [[ "$issue_ref" =~ \#[0-9]+$ ]]; then
    enqueue_task "$issue_ref" "$message"

When message == issue_ref, both get stored identically in the queue item.

Additionally, extract_issue_ref_from_message does not handle:

  • Natural language like "work on issue #81", "create pr for issue #91"
  • Partial refs like user/repo#81 or repo#81
  • Just #81 or 81

Proposed resolution order for partial refs:

  1. Check existing sessions/worktrees (have full issue ref stored)
  2. Check repos.json if it exists
  3. Check GIT_SERVERS - try to match against known repos on each server

Ambiguity handling (TBD): If issue number exists in multiple repos, should pick most recent session/worktree OR error listing matches.

Suggested Fix

TBD - requires deciding on partial ref resolution strategy above.

## Problem When `kugetsu delegate` is called with just an issue ref as the message (e.g., `kugetsu delegate "git.fbrns.co/shoko/kugetsu#118"`), the agent receives the issue ref as both the issue_ref AND the message, causing confusing behavior. ## Steps to Reproduce 1. Run `kugetsu delegate "git.fbrns.co/shoko/kugetsu#118"` 2. Queue item stores: - `issue_ref: "git.fbrns.co/shoko/kugetsu#118"` - `message: "git.fbrns.co/shoko/kugetsu#118"` 3. Daemon calls `cmd_continue "git.fbrns.co/shoko/kugetsu#118" "git.fbrns.co/shoko/kugetsu#118"` 4. Agent receives: "Additional instructions from delegator: git.fbrns.co/shoko/kugetsu#118" 5. Agent gets confused because issue ref looks like a partial instruction ## Root Cause In `cmd_delegate` (kugetsu-session.sh:205-208): ```bash if [ -n "$issue_ref" ] && [[ "$issue_ref" =~ \#[0-9]+$ ]]; then enqueue_task "$issue_ref" "$message" ``` When `message == issue_ref`, both get stored identically in the queue item. ## Related Problem: Partial Issue Refs Additionally, `extract_issue_ref_from_message` does not handle: - Natural language like "work on issue #81", "create pr for issue #91" - Partial refs like `user/repo#81` or `repo#81` - Just `#81` or `81` Proposed resolution order for partial refs: 1. Check existing sessions/worktrees (have full issue ref stored) 2. Check repos.json if it exists 3. Check GIT_SERVERS - try to match against known repos on each server Ambiguity handling (TBD): If issue number exists in multiple repos, should pick most recent session/worktree OR error listing matches. ## Suggested Fix TBD - requires deciding on partial ref resolution strategy above.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/kugetsu#209