mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
Merge branch 'feature/stream-json-migration' of github.com:x22x22/qwen-code into feature/stream-json-migration
This commit is contained in:
@@ -696,7 +696,7 @@ export class CoreToolScheduler {
|
||||
response: createErrorResponse(
|
||||
reqInfo,
|
||||
new Error(permissionErrorMessage),
|
||||
ToolErrorType.TOOL_NOT_REGISTERED,
|
||||
ToolErrorType.EXECUTION_DENIED,
|
||||
),
|
||||
durationMs: 0,
|
||||
};
|
||||
@@ -811,6 +811,32 @@ export class CoreToolScheduler {
|
||||
);
|
||||
this.setStatusInternal(reqInfo.callId, 'scheduled');
|
||||
} else {
|
||||
/**
|
||||
* In non-interactive mode where no user will respond to approval prompts,
|
||||
* and not running as IDE companion or Zed integration, automatically deny approval.
|
||||
* This is intended to create an explicit denial of the tool call,
|
||||
* rather than silently waiting for approval and hanging forever.
|
||||
*/
|
||||
const shouldAutoDeny =
|
||||
!this.config.isInteractive() &&
|
||||
!this.config.getIdeMode() &&
|
||||
!this.config.getExperimentalZedIntegration();
|
||||
|
||||
if (shouldAutoDeny) {
|
||||
// Treat as execution denied error, similar to excluded tools
|
||||
const errorMessage = `Qwen Code requires permission to use "${reqInfo.name}", but that permission was declined.`;
|
||||
this.setStatusInternal(
|
||||
reqInfo.callId,
|
||||
'error',
|
||||
createErrorResponse(
|
||||
reqInfo,
|
||||
new Error(errorMessage),
|
||||
ToolErrorType.EXECUTION_DENIED,
|
||||
),
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Allow IDE to resolve confirmation
|
||||
if (
|
||||
confirmationDetails.type === 'edit' &&
|
||||
|
||||
@@ -14,6 +14,8 @@ export enum ToolErrorType {
|
||||
UNHANDLED_EXCEPTION = 'unhandled_exception',
|
||||
TOOL_NOT_REGISTERED = 'tool_not_registered',
|
||||
EXECUTION_FAILED = 'execution_failed',
|
||||
// Try to execute a tool that is excluded due to the approval mode
|
||||
EXECUTION_DENIED = 'execution_denied',
|
||||
|
||||
// File System Errors
|
||||
FILE_NOT_FOUND = 'file_not_found',
|
||||
|
||||
Reference in New Issue
Block a user