diff --git a/packages/cli/src/config/settingsSchema.ts b/packages/cli/src/config/settingsSchema.ts index 928a9c46d..ddb52c212 100644 --- a/packages/cli/src/config/settingsSchema.ts +++ b/packages/cli/src/config/settingsSchema.ts @@ -474,7 +474,7 @@ const SETTINGS_SCHEMA = { }, }, }, - lastShownTimestamp: { + feedbackLastShownTimestamp: { type: 'number', label: 'Feedback Last Shown Timestamp', category: 'UI', diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx index 1f7ed099a..b640bcd61 100644 --- a/packages/cli/src/ui/components/InputPrompt.tsx +++ b/packages/cli/src/ui/components/InputPrompt.tsx @@ -329,7 +329,7 @@ export const InputPrompt: React.FC = ({ return; } - // Intercept feedback dialog option keys (1, 2, 3) when dialog is open + // Intercept feedback dialog option keys (1, 2) when dialog is open if ( uiState.isFeedbackDialogOpen && (FEEDBACK_DIALOG_KEYS as readonly string[]).includes(key.name) diff --git a/packages/cli/src/ui/hooks/useFeedbackDialog.ts b/packages/cli/src/ui/hooks/useFeedbackDialog.ts index b5b50103c..18865b1f0 100644 --- a/packages/cli/src/ui/hooks/useFeedbackDialog.ts +++ b/packages/cli/src/ui/hooks/useFeedbackDialog.ts @@ -6,6 +6,7 @@ import { UserFeedbackEvent, type UserFeedbackRating, isNodeError, + AuthType, } from '@qwen-code/qwen-code-core'; import { StreamingState, MessageType, type HistoryItem } from '../types.js'; import { @@ -30,19 +31,19 @@ const lastMessageIsAIResponse = (history: HistoryItem[]): boolean => history.length > 0 && history[history.length - 1].type === MessageType.GEMINI; /** - * Read lastShownTimestamp directly from the user settings file + * Read feedbackLastShownTimestamp directly from the user settings file */ -const getLastShownTimestampFromFile = (): number => { +const getFeedbackLastShownTimestampFromFile = (): number => { try { if (fs.existsSync(USER_SETTINGS_PATH)) { const content = fs.readFileSync(USER_SETTINGS_PATH, 'utf-8'); const settings = JSON.parse(stripJsonComments(content)); - return settings?.ui?.lastShownTimestamp ?? 0; + return settings?.ui?.feedbackLastShownTimestamp ?? 0; } } catch (error) { if (isNodeError(error) && error.code !== 'ENOENT') { console.warn( - 'Failed to read lastShownTimestamp from settings file:', + 'Failed to read feedbackLastShownTimestamp from settings file:', error, ); } @@ -54,10 +55,10 @@ const getLastShownTimestampFromFile = (): number => { * Check if we should show the feedback dialog based on fatigue mechanism */ const shouldShowFeedbackBasedOnFatigue = (): boolean => { - const lastShownTimestamp = getLastShownTimestampFromFile(); + const feedbackLastShownTimestamp = getFeedbackLastShownTimestampFromFile(); const now = Date.now(); - const timeSinceLastShown = now - lastShownTimestamp; + const timeSinceLastShown = now - feedbackLastShownTimestamp; const cooldownMs = FEEDBACK_COOLDOWN_HOURS * 60 * 60 * 1000; return timeSinceLastShown >= cooldownMs; @@ -100,7 +101,11 @@ export const useFeedbackDialog = ({ setIsFeedbackDialogOpen(true); // Record the timestamp when feedback dialog is shown (fire and forget) - settings.setValue(SettingScope.User, 'ui.lastShownTimestamp', Date.now()); + settings.setValue( + SettingScope.User, + 'ui.feedbackLastShownTimestamp', + Date.now(), + ); }, [settings]); const closeFeedbackDialog = useCallback( @@ -128,13 +133,15 @@ export const useFeedbackDialog = ({ const checkAndShowFeedback = () => { if (streamingState === StreamingState.Idle && history.length > 0) { // Show feedback dialog if: - // 1. Qwen logger is enabled (required for feedback submission) - // 2. User feedback is enabled in settings - // 3. The last message is an AI response - // 4. Random chance (25% probability) - // 5. Meets minimum requirements (tool calls > 10 OR user messages > 5) - // 6. Fatigue mechanism allows showing (not shown recently across sessions) + // 1. User is authenticated via QWEN_OAUTH + // 2. Qwen logger is enabled (required for feedback submission) + // 3. User feedback is enabled in settings + // 4. The last message is an AI response + // 5. Random chance (25% probability) + // 6. Meets minimum requirements (tool calls > 10 OR user messages > 5) + // 7. Fatigue mechanism allows showing (not shown recently across sessions) if ( + config.getAuthType() !== AuthType.QWEN_OAUTH || !config.getUsageStatisticsEnabled() || settings.merged.ui?.enableUserFeedback === false || !lastMessageIsAIResponse(history) ||