Skip to content

Commit 5bd6159

Browse files
hannesrudolphclaude
andcommitted
Add explanatory comments for automated workflow focus preservation
- Add detailed comments explaining why we preserve focus during automated workflows - Clarify the security implications of accidental API key exposure - Reference issue #4574 for additional context - Improve code documentation for future maintainers 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a6982ab commit 5bd6159

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/core/mentions/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ export async function openMention(mention?: string): Promise<void> {
3737
if (mention.endsWith("/")) {
3838
vscode.commands.executeCommand("revealInExplorer", vscode.Uri.file(absPath))
3939
} else {
40-
// Check if we're in an automated workflow to preserve chat focus during AI processing
40+
// Check if we're in an automated workflow to preserve chat focus during AI processing.
41+
// When users mention files (e.g., @/path/to/file.txt) while the AI is actively processing,
42+
// we want to prevent the chatbox from losing focus to avoid accidental input interruption.
4143
const shouldPreserveFocus = isInAutomatedWorkflowFromVisibleProvider()
4244

4345
openFile(absPath, { preserveFocus: shouldPreserveFocus })

src/core/webview/webviewMessageHandler.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,10 @@ export const webviewMessageHandler = async (
427427
openImage(message.text!)
428428
break
429429
case "openFile":
430-
// Check if we're in an automated workflow to preserve chat focus during AI processing
430+
// Check if we're in an automated workflow to preserve chat focus during AI processing.
431+
// This prevents the chatbox from losing focus when the AI is actively working,
432+
// which could cause users to accidentally type sensitive information (like API keys)
433+
// into the wrong window. See issue #4574 for more context.
431434
const shouldPreserveFocus = isInAutomatedWorkflowFromProvider(provider)
432435

433436
openFile(message.text!, {

0 commit comments

Comments
 (0)