Skip to content

Fix/slash command#5752

Open
Madrawn wants to merge 2 commits intoKilo-Org:mainfrom
Madrawn:fix/slash_command
Open

Fix/slash command#5752
Madrawn wants to merge 2 commits intoKilo-Org:mainfrom
Madrawn:fix/slash_command

Conversation

@Madrawn
Copy link

@Madrawn Madrawn commented Feb 8, 2026

Context

What problem does this fix?

This fixes a bug where slash commands in tool_result blocks were being ignored. When a user responds to a tool (e.g., "ask for feedback"), or the attempt_completion, or the user cancels a tool and then responds with a slash command like /newtask or a workflow file within <user_message> tags, or if the user canceled, the command was not being processed. The root cause was that parseKiloSlashCommands was only called for text blocks, not for tool_result blocks in the processKiloUserContentMentions function.

Implementation

How was it achieved?

  1. Refactored with a helper function: Created processTextContent that combines parseMentions and parseKiloSlashCommands into a single pipeline. This eliminates code duplication and ensures consistent processing across all block types.

  2. Extended processing to tool_result blocks:

    • For tool_result with string content: now processes through processTextContent when mention tags are present
    • For tool_result with array content: each text block is processed through processTextContent
    • Properly propagates needsRulesFileCheck flag in all cases
  3. Added comprehensive regression tests: Created 4 test cases covering:

    • String content in tool_result with slash commands
    • Array content in tool_result with slash commands
    • Slash command transformation verification
    • No-op when no mention tags present

Tradeoffs: None - this is a pure bug fix that extends existing logic to a missing case without changing behavior for other scenarios.

Important attention points:

  • The fix maintains the needsRulesFileCheck flag correctly across all code paths
  • The helper function signature uses ClineRulesToggles type for consistency
  • All existing tests continue to pass (verified: 37 mentions tests pass, as do the 3000+ src/core tests)

Screenshots

before after
N/A (logic bug) N/A (logic bug)

This is a backend logic fix with no UI changes.

How to Test

Manual testing:

  1. Trigger a tool that asks for feedback (e.g., /ask or any tool that returns a tool_result)
  2. In your response, include a slash command within <user_message> tags:
    • Example 1: <user_message>/newtask</user_message>
    • Example 2: <user_message>/just-do-this-workflow.md</user_message>
  3. Verify the slash command is properly processed and transformed (e.g., new task is created, workflow is executed)
  4. Test both formats: when tool_result.content is a string and when it's an array of text blocks

Automated testing:

cd src && pnpm test core/mentions/__tests__/processKiloUserContentMentions.spec.ts

Expected: All 4 new regression tests pass, plus all existing mentions tests (37 total) pass.

The changeset has been created at .changeset/free-toes-hammer.md.

Get in Touch

Madrawn in Discord

Daniel Dengler added 2 commits February 8, 2026 15:00
Previously, parseKiloSlashCommands was only called for text blocks,
causing slash commands in tool_result blocks to be ignored. This fix
extends the processing to tool_result blocks by using the new
processTextContent helper function that combines parseMentions and
parseKiloSlashCommands.

The regression test ensures that slash commands in tool responses are
properly processed and transformed.
@changeset-bot
Copy link

changeset-bot bot commented Feb 8, 2026

🦋 Changeset detected

Latest commit: 1704d4c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant