Skip to content

fix: await rejectChange() in rejectAll() to avoid overlapping cleanup - #728

Merged
will-lamerton merged 2 commits into
Nano-Collective:mainfrom
jmdlrg:fix/reject-all-await-cleanup
Aug 2, 2026
Merged

will-lamerton merged 2 commits into
Nano-Collective:mainfrom
jmdlrg:fix/reject-all-await-cleanup

Conversation

@jmdlrg

@jmdlrg jmdlrg commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Description

rejectAll() in the VS Code extension's diff manager fired the async rejectChange() without awaiting, so rejecting several pending diffs at once ran their cleanups concurrently. This makes rejectAll() await each rejection sequentially, mirroring how applyAll() already awaits applyChange().

On the issue's verification note (whether concurrency was intentional): three signals say it wasn't — (1) applyAll(), the sibling method, already awaits sequentially; (2) concurrency buys nothing here since extension-host UI operations serialize anyway; (3) closeEditors() snapshots vscode.window.tabGroups.all and closes tabs against that snapshot, so concurrent rejections hold stale Tab references and race over shared editor state — the exact hazard the issue describes.

Signature change (void → Promise<void>): safe — neither rejectAll() nor applyAll() currently has callers in the repo.

Possible follow-up (out of scope here): rejectChange() has no try/catch (unlike applyChange()), so a failure now aborts the remaining rejections instead of becoming a silent unhandled rejection. Happy to address that in a separate PR if you want rejectAll() to keep going on per-change failures.

Fixes #725

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changeset

  • Added a changeset (pnpm changeset) describing this change for the changelog

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files — N/A (bug fix; the VS Code plugin has no test infrastructure)
  • All existing tests pass (pnpm test:all completes successfully) — format, type and lint checks pass; 8 test failures in cli-integration and settings-tabs reproduce identically on a clean main checkout on my machine, so they're pre-existing and unrelated
  • Tests cover both success and error scenarios — N/A

Verified the change with pnpm run build:ext (clean) and tsc --noEmit on the plugin (clean).

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

N/A — the fix is in the VS Code extension's diff manager and is provider-agnostic.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed) — N/A
  • No breaking changes (or clearly documented) — signature change documented above; no callers exist
  • Appropriate logging added using structured logging — N/A, no logging paths touched

@will-lamerton

Copy link
Copy Markdown
Member

@will-lamerton
will-lamerton merged commit 59aed73 into Nano-Collective:main Aug 2, 2026
1 check passed
@jmdlrg

jmdlrg commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for this PR @jmdlrg - feel free to add yourself as a contributor to our website via a PR which I will approve :)

https://nanocollective.org/contributors https://github.com/Nano-Collective/organisation

Thanks! Just opened the contributor PR: Nano-Collective/organisation#86

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.

[Bug] rejectAll() does not await asynchronous cleanup

2 participants