Skip to content

Commit a86ffac

Browse files
fix(server): Claude sets a /goal that also mentions a skill (pingdotgg#34818)
1 parent 9786b82 commit a86ffac

2 files changed

Lines changed: 27 additions & 8 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5058,6 +5058,20 @@ describe("ClaudeAdapterV2 background wake turns", () => {
50585058
),
50595059
);
50605060

5061+
// regression: #29750 Claude sets a goal only from a prompt that opens with /goal
5062+
it("keeps a /goal that mentions a skill as one native goal command", () => {
5063+
const message = ClaudeAdapterV2.makeClaudeUserMessage({
5064+
text: "/goal fix all the gaps.\ndecompile target.ipa into ./target/\n$review",
5065+
skills: new Map([["review", { path: "/home/me/.claude/skills/review/SKILL.md" }]]),
5066+
});
5067+
const content = message.message.content;
5068+
assert.isString(content);
5069+
assert.match(
5070+
content as string,
5071+
/^\/goal fix all the gaps\.\ndecompile target\.ipa into \.\/target\/\n/,
5072+
);
5073+
});
5074+
50615075
// regression: #15708 Stop must not silently drop a steer Claude queued behind a foreground task
50625076
it.effect.each([
50635077
{

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ import {
9797
TrimmedNonEmptyString,
9898
defaultInstanceIdForDriver,
9999
isCompactionCommandMessage,
100+
parseGoalCommand,
100101
type MessageId,
101102
type ModelSelection,
102103
type OrchestrationV2ConversationMessage,
@@ -2551,18 +2552,22 @@ export function makeClaudeUserMessage(input: {
25512552
// Keep the whole request before that block; see ClaudeSkillDispatch.
25522553
const dispatch =
25532554
input.skills === undefined ? undefined : planClaudeSkillDispatch(input.text, input.skills);
2555+
// Claude runs `/goal` only when it opens the prompt, so a goal stays one block.
2556+
const isGoalCommand = parseGoalCommand({ text: input.text }) !== null;
25542557
return {
25552558
type: "user",
25562559
message: {
25572560
role: "user",
2558-
content: dispatch
2559-
? [
2560-
...(dispatch.leadingText === undefined
2561-
? []
2562-
: [{ type: "text" as const, text: dispatch.leadingText }]),
2563-
{ type: "text" as const, text: dispatch.commandText },
2564-
]
2565-
: input.text,
2561+
content: isGoalCommand
2562+
? (dispatch?.leadingText ?? input.text)
2563+
: dispatch
2564+
? [
2565+
...(dispatch.leadingText === undefined
2566+
? []
2567+
: [{ type: "text" as const, text: dispatch.leadingText }]),
2568+
{ type: "text" as const, text: dispatch.commandText },
2569+
]
2570+
: input.text,
25662571
},
25672572
parent_tool_use_id: null,
25682573
...(input.priority === undefined ? {} : { priority: input.priority }),

0 commit comments

Comments
 (0)