#4 bug: issue_assignee

Lezárt
megnyitva ekkor: 9 hónapja fszontagh által · 4 hozzászólás

Fix the issue: when i change an issue assignee to myself, then back to claude, the command no triggered:

2025-10-28T15:48:58.814Z] INFO: 1 jobs remaining in queue
[2025-10-28T15:48:58.815Z] INFO: Starting job 19 (issues)
{
  "queueLength": 1,
  "jobId": 19
}
[2025-10-28T15:48:58.815Z] INFO: Webhook command prepared
{
  "eventType": "issues",
  "type": "shell",
  "command": "/home/claude/agent-manager/scripts/handle-issue.sh",
  "args": [
    "fszontagh",
    "agent-manager",
    "fszontagh",
    "2",
    "feat: add systemd config file",
    "- add a systemd config file to allow to run the project as service\r\n- keep attention to allow to run the project as unprivileged user (for example local UNIX user claude)\r\n- enhanche the logging to allow to systemd to handle the logging output (for example journalctl -u agent-manager -f -n100)",
    "assigned",
    "",
    "claude"
  ],
  "variables": {
    "event": "issues",
    "repo": "agent-manager",
    "full_repo": "fszontagh/agent-manager",
    "repo_owner": "fszontagh",
    "branch": "",
    "pusher": "fszontagh",
    "commit": "",
    "commit_msg": "",
    "pr_number": "",
    "pr_action": "",
    "tag": "",
    "ref_type": "",
    "issue_number": 2,
    "issue_title": "feat: add systemd config file",
    "issue_action": "assigned",
    "issue_body": "- add a systemd config file to allow to run the project as service\r\n- keep attention to allow to run the project as unprivileged user (for example local UNIX user claude)\r\n- enhanche the logging to allow to systemd to handle the logging output (for example journalctl -u agent-manager -f -n100)",
    "issue_assignee": "claude",
    "comment_body": ""
  }
}
[2025-10-28T15:48:58.817Z] INFO: Executing command
{
  "type": "shell",
  "command": "/home/claude/agent-manager/scripts/handle-issue.sh",
  "args": [
    "fszontagh",
    "agent-manager",
    "fszontagh",
    "2",
    "feat: add systemd config file",
    "- add a systemd config file to allow to run the project as service\r\n- keep attention to allow to run the project as unprivileged user (for example local UNIX user claude)\r\n- enhanche the logging to allow to systemd to handle the logging output (for example journalctl -u agent-manager -f -n100)",
    "assigned",
    "",
    "claude"
  ],
  "fullCommand": "/home/claude/agent-manager/scripts/handle-issue.sh fszontagh agent-manager fszontagh 2 'feat: add systemd config file' '- add a systemd config file to allow to run the project as service\r\n- keep attention to allow to run the project as unprivileged user (for example local UNIX user claude)\r\n- enhanche the logging to allow to systemd to handle the logging output (for example journalctl -u agent-manager -f -n100)' assigned  claude",
  "cwd": "/home/claude/agent-manager",
  "timeout": 600000
}
[2025-10-28T15:48:58.829Z] INFO: Command output (stdout)
Issue not assigned to claude (assignee: ), skipping

[2025-10-28T15:48:58.830Z] INFO: Command completed successfully
[2025-10-28T15:48:58.830Z] INFO: Job 19 completed successfully
{
  "jobId": 19,
  "duration": 16
}
[2025-10-28T15:48:58.831Z] INFO: Queue is empty
Fix the issue: when i change an issue assignee to myself, then back to claude, the command no triggered: ``` 2025-10-28T15:48:58.814Z] INFO: 1 jobs remaining in queue [2025-10-28T15:48:58.815Z] INFO: Starting job 19 (issues) { "queueLength": 1, "jobId": 19 } [2025-10-28T15:48:58.815Z] INFO: Webhook command prepared { "eventType": "issues", "type": "shell", "command": "/home/claude/agent-manager/scripts/handle-issue.sh", "args": [ "fszontagh", "agent-manager", "fszontagh", "2", "feat: add systemd config file", "- add a systemd config file to allow to run the project as service\r\n- keep attention to allow to run the project as unprivileged user (for example local UNIX user claude)\r\n- enhanche the logging to allow to systemd to handle the logging output (for example journalctl -u agent-manager -f -n100)", "assigned", "", "claude" ], "variables": { "event": "issues", "repo": "agent-manager", "full_repo": "fszontagh/agent-manager", "repo_owner": "fszontagh", "branch": "", "pusher": "fszontagh", "commit": "", "commit_msg": "", "pr_number": "", "pr_action": "", "tag": "", "ref_type": "", "issue_number": 2, "issue_title": "feat: add systemd config file", "issue_action": "assigned", "issue_body": "- add a systemd config file to allow to run the project as service\r\n- keep attention to allow to run the project as unprivileged user (for example local UNIX user claude)\r\n- enhanche the logging to allow to systemd to handle the logging output (for example journalctl -u agent-manager -f -n100)", "issue_assignee": "claude", "comment_body": "" } } [2025-10-28T15:48:58.817Z] INFO: Executing command { "type": "shell", "command": "/home/claude/agent-manager/scripts/handle-issue.sh", "args": [ "fszontagh", "agent-manager", "fszontagh", "2", "feat: add systemd config file", "- add a systemd config file to allow to run the project as service\r\n- keep attention to allow to run the project as unprivileged user (for example local UNIX user claude)\r\n- enhanche the logging to allow to systemd to handle the logging output (for example journalctl -u agent-manager -f -n100)", "assigned", "", "claude" ], "fullCommand": "/home/claude/agent-manager/scripts/handle-issue.sh fszontagh agent-manager fszontagh 2 'feat: add systemd config file' '- add a systemd config file to allow to run the project as service\r\n- keep attention to allow to run the project as unprivileged user (for example local UNIX user claude)\r\n- enhanche the logging to allow to systemd to handle the logging output (for example journalctl -u agent-manager -f -n100)' assigned claude", "cwd": "/home/claude/agent-manager", "timeout": 600000 } [2025-10-28T15:48:58.829Z] INFO: Command output (stdout) Issue not assigned to claude (assignee: ), skipping [2025-10-28T15:48:58.830Z] INFO: Command completed successfully [2025-10-28T15:48:58.830Z] INFO: Job 19 completed successfully { "jobId": 19, "duration": 16 } [2025-10-28T15:48:58.831Z] INFO: Queue is empty ```
Claude Coding Agent hozzászólt 9 hónapja
Közreműködő

Investigating Issue

I can see the problem. The logs show:

  • Variables extracted correctly: "issue_assignee": "claude"
  • Arguments passed correctly: 9th arg = "claude"
  • But script outputs: "Issue not assigned to claude (assignee: ), skipping"

This suggests the script is checking the assignee incorrectly when the action is "assigned". Let me examine the script to identify the issue.

## Investigating Issue I can see the problem. The logs show: - Variables extracted correctly: `"issue_assignee": "claude"` - Arguments passed correctly: 9th arg = `"claude"` - But script outputs: `"Issue not assigned to claude (assignee: ), skipping"` This suggests the script is checking the assignee incorrectly when the action is "assigned". Let me examine the script to identify the issue.
Claude Coding Agent hozzászólt 9 hónapja
Közreműködő

Root Cause Found

The issue is in /home/claude/agent-manager/scripts/handle-issue.sh line 15:

ASSIGNEE="$9"

In bash, positional parameters beyond $9 require curly braces (e.g., ${10}, ${11}). While $9 should technically work, the safer and recommended practice is to use ${9} for consistency and compatibility.

The script is receiving the assignee value correctly as the 9th argument, but $9 is not being parsed correctly, resulting in an empty $ASSIGNEE variable.

Fix

Change line 15 from:

ASSIGNEE="$9"

to:

ASSIGNEE="${9}"

Implementing the fix now...

## Root Cause Found The issue is in `/home/claude/agent-manager/scripts/handle-issue.sh` line 15: ```bash ASSIGNEE="$9" ``` In bash, positional parameters beyond `$9` require curly braces (e.g., `${10}`, `${11}`). While `$9` should technically work, the safer and recommended practice is to use `${9}` for consistency and compatibility. The script is receiving the assignee value correctly as the 9th argument, but `$9` is not being parsed correctly, resulting in an empty `$ASSIGNEE` variable. ## Fix Change line 15 from: ```bash ASSIGNEE="$9" ``` to: ```bash ASSIGNEE="${9}" ``` Implementing the fix now...
Claude Coding Agent hozzászólt 9 hónapja
Közreműködő

Actual Root Cause Identified!

My previous analysis was incorrect. The real issue is in how empty arguments are handled in src/commandExecutor.js.

The Problem

When the command is built, argument 8 (COMMENT_BODY) is an empty string. The buildCommandString function doesn't wrap empty strings in quotes, so the command becomes:

/path/to/script.sh arg1 arg2 ... assigned  claude
#                                        ^^
#                                  double space - empty arg lost!

When bash parses this, it sees only 8 arguments instead of 9:

  • Arg 7: assigned
  • Arg 8: claude (should be arg 9!)
  • Arg 9: empty (the assignee is actually in arg 8)

The Fix

Modify src/commandExecutor.js line 137-143 to wrap empty strings in quotes:

const escapeArg = (arg) => {
  // Always wrap empty strings in quotes to preserve them as arguments
  if (arg === '') {
    return "''";
  }
  // If arg contains spaces or special chars, wrap in single quotes
  if (arg.includes(' ') || arg.includes('$') || arg.includes('`') || arg.includes('"')) {
    return `'${arg.replace(/'/g, "'\\''")}'`;
  }
  return arg;
};

Implementing now...

## Actual Root Cause Identified! My previous analysis was incorrect. The real issue is in how **empty arguments** are handled in `src/commandExecutor.js`. ### The Problem When the command is built, argument 8 (COMMENT_BODY) is an empty string. The `buildCommandString` function doesn't wrap empty strings in quotes, so the command becomes: ```bash /path/to/script.sh arg1 arg2 ... assigned claude # ^^ # double space - empty arg lost! ``` When bash parses this, it sees only 8 arguments instead of 9: - Arg 7: `assigned` - Arg 8: `claude` (should be arg 9!) - Arg 9: empty (the assignee is actually in arg 8) ### The Fix Modify `src/commandExecutor.js` line 137-143 to wrap empty strings in quotes: ```javascript const escapeArg = (arg) => { // Always wrap empty strings in quotes to preserve them as arguments if (arg === '') { return "''"; } // If arg contains spaces or special chars, wrap in single quotes if (arg.includes(' ') || arg.includes('$') || arg.includes('`') || arg.includes('"')) { return `'${arg.replace(/'/g, "'\\''")}'`; } return arg; }; ``` Implementing now...
claude lezárta ekkor: 9 hónapja
Claude Coding Agent hozzászólt 9 hónapja
Közreműködő

✅ Fixed and Deployed

The issue has been successfully resolved and pushed:

  • Commit: 467952e - fix: preserve empty arguments in command execution (#4)

Summary

Problem: When COMMENT_BODY (arg 8) was empty during the "assigned" action, bash would collapse the double space, shifting all subsequent arguments left by one position. This caused claude to be read as arg 8 instead of arg 9, making $ASSIGNEE empty.

Solution: Modified src/commandExecutor.js:165-167 to wrap empty strings in quotes ('') when building shell commands. This preserves empty arguments as distinct positional parameters.

Testing Results

Before fix:

/script.sh ... assigned  claude    # 8 args (double space lost)
# $7=assigned, $8=claude, $9=empty ❌

After fix:

/script.sh ... assigned '' claude  # 9 args (empty preserved)
# $7=assigned, $8=empty, $9=claude ✅

The webhook handler will now correctly trigger Claude Code when issues are assigned to the "claude" user, regardless of whether COMMENT_BODY is empty or not.

## ✅ Fixed and Deployed The issue has been successfully resolved and pushed: - Commit: `467952e` - fix: preserve empty arguments in command execution (#4) ### Summary **Problem:** When `COMMENT_BODY` (arg 8) was empty during the "assigned" action, bash would collapse the double space, shifting all subsequent arguments left by one position. This caused `claude` to be read as arg 8 instead of arg 9, making `$ASSIGNEE` empty. **Solution:** Modified `src/commandExecutor.js:165-167` to wrap empty strings in quotes (`''`) when building shell commands. This preserves empty arguments as distinct positional parameters. ### Testing Results Before fix: ```bash /script.sh ... assigned claude # 8 args (double space lost) # $7=assigned, $8=claude, $9=empty ❌ ``` After fix: ```bash /script.sh ... assigned '' claude # 9 args (empty preserved) # $7=assigned, $8=empty, $9=claude ✅ ``` The webhook handler will now correctly trigger Claude Code when issues are assigned to the "claude" user, regardless of whether COMMENT_BODY is empty or not.
Jelentkezzen be hogy csatlakozhasson a beszélgetéshez.
Nincs mérföldkő
Nincs megbízott
2 Résztvevő
Töltés...
Mégse
Mentés
Még nincs tartalom.