Skip to content

🪲 BUG-#19: Fix stale process exit handler breaking provider/model switches - #20

Merged
FernandoCelmer merged 1 commit into
masterfrom
feature/19
Aug 15, 2026
Merged

🪲 BUG-#19: Fix stale process exit handler breaking provider/model switches#20
FernandoCelmer merged 1 commit into
masterfrom
feature/19

Conversation

@FernandoCelmer

Copy link
Copy Markdown
Member

Closes #19

reload() (called after switching provider/model, or any settings toggle) kills the old pycodeloop serve process and immediately assigns a new RpcClient to this.client. The old process's exit event fires later, asynchronously — its handler, still registered, wrote this.client = undefined unconditionally, clobbering the reference to the already-working new connection and posting a scary processExit ("pycodeloop serve exited (code null)") for what was actually just the expected teardown of the replaced process.

Symptom: switching provider or model shows a spurious error and the next prompt silently fails until reconnecting manually.

Fix: both exit and spawnError handlers now check this.client === client before acting, so a delayed event from a superseded client can't affect the currently active one.

Test plan

  • npm test (43 passed) / npx tsc --noEmit / npm run lint clean
  • No automated test — chat.controller.ts imports vscode directly, same limitation as every other file in this class (untestable under node:test outside the Extension Host)

@FernandoCelmer
FernandoCelmer merged commit 969057c into master Aug 15, 2026
2 checks passed
@FernandoCelmer
FernandoCelmer deleted the feature/19 branch August 15, 2026 16:48
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.

Switching provider/model breaks the connection — stale exit handler from the old process clobbers the new one

1 participant