[Bug]: Duplicate skill execution if first message in thread contains just the skill #3594
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/desktop
Steps to reproduce#
Create a simple bash script
~/.claude/scripts/skill-exec-log.shthat just appends a new line with the current date into file/tmp/skill-exec-log.txt: skill-exec-log.shCreate a new skill
~/.claude/skills/call-script/SKILL.mdwhich executes the script: SKILL.mdSet the title generation model In T3 Code to any Claude Code model (e.g. Haiku)
Start a new thread int T3 Code, select a Claude Code model (e.g. Opus), write prompt
/call-scriptand submitObserve the execution logs:
cat /tmp/skill-exec-log.txt
Expected behavior#
A single row has been added into /tmp/skill-exec-log.txt.
Actual behavior#
Two new rows have been added into /tmp/skill-exec-log.txt with with dates ~1s apart. This means the skill has been executed twice!
This is causing problems with skills that implement new functionality (2 separate agents are modifying the same code) and can have even worse consequences for destructive skills.
Issue #1713 was reporting something similar, but it was closed and the problem currently persists in the latest version, so I created this issue.
Root cause#
On the first turn of a thread, title/branch text generation spawns a claude -p process with full tool access and --dangerously-skip-permissions, and feeds it the raw user message. If that message is a slash command / skill invocation (e.g. /github-review), the "title generator" executes it — running tools with side effects.
processTurnStartRequestedforks title/branch generation on the first turn and passes the rawmessage.text:apps/server/src/orchestration/Layers/ProviderCommandReactor.ts—maybeGenerateThreadTitleForFirstTurn/maybeGenerateAndRenameWorktreeBranchForFirstTurn(forked viaEffect.forkScoped).
buildThreadTitlePrompt(apps/server/src/textGeneration/TextGenerationPrompts.ts) embeds the message verbatim:You write concise thread titles for coding conversations. Return a JSON object with key: title. Rules: ... User message: /call-scriptapps/server/src/textGeneration/ClaudeTextGeneration.tsspawns:
with noclaude -p --output-format json --json-schema … --model <textGenModel> --dangerously-skip-permissions--allowedToolsrestriction → full Bash/Skill/Write access, permissions bypassed.
Suggested fix#
The one-shot structured-output generations need tools off. In the text-gen spawn(s), drop --dangerously-skip-permissions and disable tools — e.g. --allowedTools "" (the claude CLI supports --allowedTools / --disallowed-tools / --permission-mode). Title/branch/commit/PR generation only needs the model to read the prompt and emit JSON; no tools are required. Apply the same guard to other text-gen drivers that spawn an agent CLI.
A regression test asserting that a /skill-style first message triggers no tool use during title generation would help lock this down.
Impact#
Major degradation or frequent failure
Version or commit#
0.0.27
Environment#
No response
Logs or stack traces#
Screenshots, recordings, or supporting files#
No response
Workaround#
No response
Jardo-51(GitHub profile, opens in a new tab) added labelsbug
Jardo-51(GitHub profile, opens in a new tab) added labelsneeds-triage
Confirmed: even when Opus is used for text generation, it sometimes executes the skill
juliusmarminge removed labelsneeds-triage
juliusmarminge added labels🚧 In Progress
Implementation is already covered by the refreshed PR #4062 branch:
codex/refresh-pr-4062at1a297f5c2.That commit removes
--dangerously-skip-permissions, disables Claude’s tool surface with an empty--toolsvalue plus an explicit denylist/dontAskdefense, and adds a focused headless text-generation regression. Verification passed 6 server tests plus targeted lint, format, typecheck, and an authenticated Claude CLI side-effect check: the baseline invocation created the marker while the hardened invocation did not. No new PR has been opened.I just wanted to add that our company's security policy doesn't allow agents to run with
--dangerously-skip-permissions, so I'd also like to see this added for a different reason.Thanks for the detailed report. This looks like the same issue tracked in issue #5447.
The skill runs twice because the visible conversation and Claude title helper both execute the first message. That is the same auxiliary text-generation tool execution proven by issue #5447's transcripts. Current source passes the message into a title prompt and launches the helper with bypassed permissions and no tool restriction. The source issue adds a small deterministic skill reproduction and an explicit enterprise-policy objection to the bypass flag, which must both remain tracked.
I'm closing this as a duplicate as part of an automated pass on all open issues. I linked this report from issue #5447 so its extra details remain available. This does not mean the underlying bug is fixed.
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
I experimented with setting different text generation models. Sonet keeps executing the skill as well. Opus seems smart enough to not execute the skill, but I'm not sure if I can trust it 100% of the time.