Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,22 @@ describe("ClaudeAdapterV2 session permissions", () => {
assert.equal(result.decisionClassification, "user_reject");
assert.equal(result.message, "User declined tool execution.");
assert.equal(result.interrupt, undefined);

// regression: #27854 bare feedback read to Claude as a tool error, not the user's words
const withFeedback = ClaudeAdapterV2.permissionResultFromDecision({
toolName: "Bash",
decision: "decline",
toolInput: { command: "make" },
toolUseID: "denied-build",
feedback: " Use the dry-run flag first. ",
});
assert.equal(withFeedback.behavior, "deny");
if (withFeedback.behavior !== "deny") return;
assert.equal(withFeedback.decisionClassification, "user_reject");
assert.equal(
withFeedback.message,
"The user declined this tool call and said:\nUse the dry-run flag first.",
);
});

it("forces suggested permission updates to session scope", () => {
Expand Down
9 changes: 5 additions & 4 deletions apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3776,13 +3776,14 @@ export function permissionResultFromDecision(input: {
};
}

const feedback = input.feedback?.trim();
return {
behavior: "deny",
message:
input.feedback?.trim() ||
(input.decision === "cancel"
message: feedback
? `The user declined this tool call and said:\n${feedback}`
: input.decision === "cancel"
? "User cancelled tool execution."
: "User declined tool execution."),
: "User declined tool execution.",
toolUseID: input.toolUseID,
decisionClassification: "user_reject",
...(input.decision === "cancel" ? { interrupt: true } : {}),
Expand Down
Loading