mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-08 22:13:59 +01:00
fix(native): continue runs woken by withdrawn or cancelled interactions (#19163)
Withdrawing a card or cancelling a question wakes the assignee with that interaction id. The native interaction bridge required every wake interaction to be accepted, rejected or answered, so preparation failed with native_interaction_unresolved before the provider started. Project a cancelled interaction as a closed response with its stored result. Consumers grant authority only for accepted, answered or pending items, so the closed response carries context and no approval. Pending requests and governed tool reviews keep their existing checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5fdfd3f17a
commit
b9fbbf8d30
2 files changed
+204
No files matched your search
@@ -43,6 +43,15 @@ function record(value: unknown): Record<string, unknown> {
|
||||
: {};
|
||||
}
|
||||
|
||||
const CLOSABLE_INTERACTION_KINDS: ReadonlySet<string> = new Set<NativeInteractionResponseEnvelope["kind"]>([
|
||||
"connection_intent",
|
||||
"suggest_tasks",
|
||||
"ask_user_questions",
|
||||
"request_confirmation",
|
||||
"request_checkbox_confirmation",
|
||||
"request_item_verdicts",
|
||||
]);
|
||||
|
||||
export type NativeAttentionMaterializedTarget = {
|
||||
effectKind: string;
|
||||
targetType: string;
|
||||
@@ -254,6 +263,24 @@ export async function materializeNativeInteractionResponses(input: {
|
||||
});
|
||||
continue;
|
||||
}
|
||||
// Withdraw and cancel close a request without granting anything, yet
|
||||
// they still wake the assignee to continue. Project the closed lifecycle
|
||||
// as context; consumers act only on accepted, answered or pending items.
|
||||
if (
|
||||
interaction.status === "cancelled"
|
||||
&& interaction.result
|
||||
&& CLOSABLE_INTERACTION_KINDS.has(interaction.kind)
|
||||
) {
|
||||
responses.push({
|
||||
interactionId: interaction.id,
|
||||
kind: interaction.kind as NativeInteractionResponseEnvelope["kind"],
|
||||
response: {
|
||||
status: interaction.status,
|
||||
result: structuredClone(interaction.result) as unknown as Record<string, unknown>,
|
||||
},
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if (
|
||||
interaction.resolvedByRunId === input.runId
|
||||
|| (
|
||||
|
||||
Reference in new issue
Block a user