Skip to content

Fix delayed code action commands with arguments - #333295

Merged
Dmitriy Vasyura (dmitrivMS) merged 2 commits into
mainfrom
dmitriv/fix-code-action-command-arguments
Aug 29, 2026
Merged

Fix delayed code action commands with arguments#333295
Dmitriy Vasyura (dmitrivMS) merged 2 commits into
mainfrom
dmitriv/fix-code-action-command-arguments

Conversation

@dmitrivMS

@dmitrivMS Dmitriy Vasyura (dmitrivMS) commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • transfer ownership of resolved code actions from the model to the action widget
  • keep command arguments alive while the Quick Fix menu remains open
  • dispose unclaimed nearby code-action results on cancellation, failure, or fallthrough
  • add regression coverage for a canceled automatic request completing after a manual result is shown

Fixes #331834.

This regressed in #330142, which made the reusable code-action disposable holder active again but allowed a later result to dispose the action set still backing an open Quick Fix menu.

Validation

  • scripts\test.bat --run src\vs\editor\contrib\codeAction\test\browser\codeActionModel.test.ts (7 passing)
  • Code OSS 1.136.0 Dev on Windows x64: kept the Quick Fix menu open for 3 seconds, invoked a command with arguments, and confirmed the argument arrived without an Actual command not found notification

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 29, 2026 00:46
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added bug Issue identified by VS Code Team member as probable bug editor-code-actions Editor inplace actions (Ctrl + .) recent-regression labels Aug 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

Review tier: Balanced
Findings: 2 Medium severity

New issues introduced by this change (2)
Severity Finding
Medium severity src/​vs/​editor/​contrib/​codeAction/​browser/​codeActionModel.ts — A canceled request can still reach _setCodeActions after its provider eventually resolves. If it…
Medium severity src/​vs/​editor/​contrib/​codeAction/​test/​browser/​codeActionModel.test.ts — This test enables nearby quick fixes, but Default does not satisfy the nearby-actions gate…
What changed in this PR

Fixes code-action lifetime handling so delayed Quick Fix commands retain their arguments.

Changes:

  • Transfers resolved action ownership to the controller.
  • Disposes unclaimed or canceled action results.
  • Adds regression coverage for overlapping requests.
File Description
codeActionModel.ts Adds explicit ownership transfer and disposal.
codeActionController.ts Claims and manages resolved actions.
codeActionModel.test.ts Tests cancellation-related lifetime behavior.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/vs/editor/contrib/codeAction/browser/codeActionModel.ts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit 8e33c19 into main Aug 29, 2026
38 checks passed
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) deleted the dmitriv/fix-code-action-command-arguments branch August 29, 2026 01:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

Review tier: Balanced
Findings: None

Issues resolved since last review (2)
Severity Finding
Medium severity src/​vs/​editor/​contrib/​codeAction/​test/​browser/​codeActionModel.test.ts — This test enables nearby quick fixes, but Default does not satisfy the nearby-actions gate… View resolved comment
Medium severity src/​vs/​editor/​contrib/​codeAction/​browser/​codeActionModel.ts — A canceled request can still reach _setCodeActions after its provider eventually resolves. If it… View resolved comment
Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

src/vs/editor/contrib/codeAction/browser/codeActionController.ts:215

  • After this claim, the model no longer owns the set, so CodeActionModel._update() cannot dispose it when the editor model is cleared. The controller's Empty branch only hides the lightbulb and _activeCodeActions keeps the previous model's provider result (including extension-host command payloads) until another result arrives or the controller itself is destroyed. Please release the claimed set on model/state teardown while still preserving it for any currently open action widget.
			actions = this._model.takeCodeActions(await newState.actions);

@vs-code-engineering vs-code-engineering Bot added this to the 1.136.0 milestone Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue identified by VS Code Team member as probable bug editor-code-actions Editor inplace actions (Ctrl + .) recent-regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code actions with arguments fail with "Actual command not found" when the Quick Fix menu is open for ~2s (regression in 1.134.0)

3 participants