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

View File

@@ -973,6 +973,10 @@ describe('Scheduler (Orchestrator)', () => {
CoreToolCallStatus.Cancelled,
'User denied execution.',
);
expect(mockStateManager.setOutcome).toHaveBeenCalledWith(
'call-1',
ToolConfirmationOutcome.Cancel,
);
expect(mockStateManager.cancelAllQueued).toHaveBeenCalledWith(
'User cancelled operation',
);

View File

@@ -487,15 +487,17 @@ export class Scheduler {
});
outcome = result.outcome;
lastDetails = result.lastDetails;
} else {
this.state.setOutcome(callId, ToolConfirmationOutcome.ProceedOnce);
}
this.state.setOutcome(callId, outcome);
// Handle Policy Updates
await updatePolicy(toolCall.tool, outcome, lastDetails, {
config: this.config,
messageBus: this.messageBus,
});
if (decision === PolicyDecision.ASK_USER && outcome) {
await updatePolicy(toolCall.tool, outcome, lastDetails, {
config: this.config,
messageBus: this.messageBus,
});
}
// Handle cancellation (cascades to entire batch)
if (outcome === ToolConfirmationOutcome.Cancel) {