Skip to content

fix(vscode): keep auth quick inputs open on focus loss - #6274

Merged
wenshao merged 1 commit into
QwenLM:mainfrom
barry166:barry166/auth-quickpick-focus-6230
Jul 4, 2026
Merged

fix(vscode): keep auth quick inputs open on focus loss#6274
wenshao merged 1 commit into
QwenLM:mainfrom
barry166:barry166/auth-quickpick-focus-6230

Conversation

@barry166

@barry166 barry166 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep the VS Code auth provider QuickPick open when focus moves away
  • keep auth InputBox prompts open across focus changes
  • add regression coverage for both quick input option objects

Fixes #6230.

Testing

  • npm test --workspace=packages/vscode-ide-companion -- src/webview/handlers/AuthMessageHandler.test.ts
  • npm run check-types --workspace=packages/vscode-ide-companion
  • npm run lint --workspace=packages/vscode-ide-companion
  • npm run build --workspace=packages/vscode-ide-companion
  • git diff --check

Notes

AI-assisted: yes. I manually reviewed the diff and test output before opening this PR.

I did not manually exercise the VS Code QuickPick/InputBox UI because the regression is covered through the mocked VS Code API options in AuthMessageHandler.test.ts.

VS Code dismisses QuickPick and InputBox prompts on focus loss unless ignoreFocusOut is enabled, which breaks the multi-step auth flow when users switch windows to copy provider details.

Constraint: VS Code extension API defaults ignoreFocusOut to false for quick inputs
Confidence: high
Scope-risk: narrow
Tested: npm test --workspace=packages/vscode-ide-companion -- src/webview/handlers/AuthMessageHandler.test.ts
Tested: npm run check-types --workspace=packages/vscode-ide-companion
Tested: npm run lint --workspace=packages/vscode-ide-companion
Tested: npm run build --workspace=packages/vscode-ide-companion
Tested: git diff --check
@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Thanks for the PR @barry166!

Template headings deviate slightly from the PR template — uses "Summary"/"Testing"/"Notes" instead of the standard "What this PR does"/"Why it's needed"/"Reviewer Test Plan" headings, and "Risk & Scope" is absent. The substance is all there though — what changed is clear, testing commands are listed, and the linked issue #6230 provides motivation. Not blocking on this, but worth aligning for future PRs.

On direction: straightforward bug fix for #6230 — the auth QuickPick and InputBox close when the user switches focus away (e.g. to copy a model name or API endpoint), forcing them to start over. ignoreFocusOut: true is standard VS Code API behavior and exactly what other extensions do. Aligned.

On approach: minimal and focused — 2 files, +9 lines, adds ignoreFocusOut: true to the two helper methods (pick() and input()) that wrap every showQuickPick/showInputBox call in the auth flow. No scope creep. Exactly the right size for this fix.

Moving on to code review. 🔍

中文说明

感谢贡献 @barry166

模板标题和标准模板有偏差——用了"Summary"/"Testing"/"Notes",缺少"Why it's needed"和"Risk & Scope"章节。不过实质内容都在——改动清晰,测试命令已列出,关联的 #6230 提供了动机。不因此阻断,但建议后续 PR 对齐模板。

方向:修复 /auth 过程中 QuickPick/InputBox 失焦关闭的问题(比如用户切窗口复制模型名或 API 地址时,之前的输入全部丢失)。ignoreFocusOut: true 是 VS Code 标准做法,方向没问题。

方案:精简聚焦——2 个文件,+9 行,在封装所有 showQuickPick/showInputBox 调用的 pick()input() 辅助函数中加上 ignoreFocusOut: true,没有多余改动。范围完全正确。

进入代码审查 🔍

Qwen Code · qwen3.7-max

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Code review

The fix adds ignoreFocusOut: true to the two private helpers in AuthMessageHandler.ts:

  • pick() — wraps vscode.window.showQuickPick(), used for provider selection, protocol, base URL options, and advanced config
  • input() — wraps vscode.window.showInputBox(), used for base URL, API key, and model ID entry

Since every QuickPick and InputBox call in the auth flow goes through these two helpers, the fix is complete — no missed call sites.

Tests add expect.objectContaining({ ignoreFocusOut: true }) assertions to both the QuickPick dismiss and InputBox dismiss test cases. Clean and correct.

No blockers. No AGENTS.md violations.

Testing

This is a VS Code extension GUI change — the ignoreFocusOut option only affects VS Code's QuickPick/InputBox widgets, so CLI tmux testing cannot exercise it. Substituted with unit tests + type check + whitespace check.

$ cd packages/vscode-ide-companion && npx vitest run src/webview/handlers/AuthMessageHandler.test.ts

 RUN  v3.2.4 /home/github-runner/actions-runner-21/_work/qwen-code/qwen-code/packages/vscode-ide-companion

 ✓ src/webview/handlers/AuthMessageHandler.test.ts (10 tests) 10ms

 Test Files  1 passed (1)
      Tests  10 passed (10)
   Start at  22:03:47
   Duration  2.70s (transform 1.47s, setup 0ms, collect 2.46s, tests 10ms, environment 0ms, prepare 0.89s)

$ npx tsc --noEmit
(no errors)

$ git diff --check
(clean)
中文说明

代码审查

修复在 AuthMessageHandler.ts 的两个私有辅助函数中添加了 ignoreFocusOut: true

  • pick() — 封装 vscode.window.showQuickPick(),用于选择 provider、protocol、base URL 和高级配置
  • input() — 封装 vscode.window.showInputBox(),用于输入 base URL、API key 和 model ID

所有 QuickPick 和 InputBox 调用都经过这两个辅助函数,修复完整无遗漏。

测试通过 expect.objectContaining({ ignoreFocusOut: true }) 断言验证了选项传递。干净正确。

无阻断问题,无 AGENTS.md 违规。

测试

这是 VS Code 扩展 GUI 改动,ignoreFocusOut 只影响 VS Code 的 QuickPick/InputBox 组件,CLI tmux 测试无法覆盖。改用单元测试 + 类型检查 + 空白字符检查。

结果:10 个测试全部通过,TypeScript 编译无错误,git diff --check 干净。

Qwen Code · qwen3.7-max

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

This is a clean, focused bug fix. The PR does exactly what it says — adds ignoreFocusOut: true to the two helper methods that wrap every VS Code QuickPick and InputBox call in the auth flow. My independent proposal was identical, so no simpler path was missed.

The linked issue (#6230) describes a real frustration: switching windows to copy a model name or API endpoint causes the entire auth flow to reset. The fix is a one-line addition per helper, and the tests verify both call sites correctly.

No blockers from code review. Unit tests pass (10/10). Type check clean. The only nit is the PR template heading names, which I flagged in Stage 1 but aren't worth blocking on.

Approving. ✅

中文说明

干净聚焦的 bug 修复。PR 做了它该做的事——在封装所有 VS Code QuickPick 和 InputBox 调用的两个辅助函数中添加 ignoreFocusOut: true。我的独立方案完全一致,没有更简路径被遗漏。

关联 issue #6230 描述了真实的用户痛点:切换窗口复制模型名或 API 地址会导致整个 auth 流程重置。修复每个辅助函数只加一行,测试验证了两个调用点都正确。

代码审查无阻断问题。单元测试 10/10 通过。类型检查干净。唯一的瑕疵是模板标题名称(Stage 1 已提及),不值得阻断。

批准合入 ✅

Qwen Code · qwen3.7-max

@qwen-code-ci-bot qwen-code-ci-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, looks ready to ship. ✅

@qwen-code-ci-bot qwen-code-ci-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No review findings. Downgraded from Approve to Comment: CI still running.

— qwen3.7-max via Qwen Code /review

@doudouOUC doudouOUC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found. LGTM! ✅

— qwen3.7-max via Qwen Code /review

@wenshao
wenshao added this pull request to the merge queue Jul 4, 2026
Merged via the queue into QwenLM:main with commit 3282c17 Jul 4, 2026
38 checks passed
@wyldebill

Copy link
Copy Markdown

Thanks @barry166 for jumping on this and fixing #6230 so quickly and cleanly—really appreciate it! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quickpick dropdowns lose focus during /auth process

5 participants