fix(core): ensure user rejections update tool outcome for telemetry (#18982)

This commit is contained in:
abhiasap
2026-02-19 14:14:02 +01:00
committed by GitHub
parent 70b427c7dd
commit ad9c49a604
2 changed files with 12 additions and 6 deletions
@@ -973,6 +973,10 @@ describe('Scheduler (Orchestrator)', () => {
CoreToolCallStatus.Cancelled, CoreToolCallStatus.Cancelled,
'User denied execution.', 'User denied execution.',
); );
expect(mockStateManager.setOutcome).toHaveBeenCalledWith(
'call-1',
ToolConfirmationOutcome.Cancel,
);
expect(mockStateManager.cancelAllQueued).toHaveBeenCalledWith( expect(mockStateManager.cancelAllQueued).toHaveBeenCalledWith(
'User cancelled operation', 'User cancelled operation',
); );
+8 -6
View File
@@ -487,15 +487,17 @@ export class Scheduler {
}); });
outcome = result.outcome; outcome = result.outcome;
lastDetails = result.lastDetails; lastDetails = result.lastDetails;
} else {
this.state.setOutcome(callId, ToolConfirmationOutcome.ProceedOnce);
} }
this.state.setOutcome(callId, outcome);
// Handle Policy Updates // Handle Policy Updates
await updatePolicy(toolCall.tool, outcome, lastDetails, { if (decision === PolicyDecision.ASK_USER && outcome) {
config: this.config, await updatePolicy(toolCall.tool, outcome, lastDetails, {
messageBus: this.messageBus, config: this.config,
}); messageBus: this.messageBus,
});
}
// Handle cancellation (cascades to entire batch) // Handle cancellation (cascades to entire batch)
if (outcome === ToolConfirmationOutcome.Cancel) { if (outcome === ToolConfirmationOutcome.Cancel) {