fix(server): skip killing completed provider updates - #6284
Conversation
Avoid redundant process-group cleanup after successful updates, which can invoke taskkill through cmd.exe on Windows.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the server-side provider maintenance runner to avoid issuing a redundant process kill during scoped cleanup when the provider updater has already exited (mitigating Windows cmd.exe / taskkill flash side-effects), and adds a regression test to cover the completed-update path.
Changes:
- Guard the scoped finalizer so it only calls
child.kill()whenchild.isRunningreports the updater is still running. - Add a regression test asserting
kill()is not invoked for an already-exited updater process.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/server/src/provider/providerMaintenanceRunner.ts | Adds an isRunning guard before attempting to kill the updater process during scoped cleanup. |
| apps/server/src/provider/providerMaintenanceRunner.test.ts | Adds a regression test ensuring kill() is not called when the updater has already exited. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
ApprovabilityVerdict: Approved 9442413 Straightforward bug fix that adds a guard to check if a child process is still running before attempting to kill it in the cleanup finalizer. The change is defensive, self-contained, and includes a test verifying the behavior. You can customize Macroscope's approvability policy. Learn more. |
What changed
Why
Completed provider updates were still sent a kill request when their scope closed. On Windows this can invoke
taskkillthroughcmd.exeand briefly flash a console window.This keeps cleanup for running processes while skipping the redundant kill after a successful exit. Related to #2537.
Testing
vp test run apps/server/src/provider/providerMaintenanceRunner.test.ts(12 passed)vp lint apps/server/src/provider/providerMaintenanceRunner.ts apps/server/src/provider/providerMaintenanceRunner.test.tsvp run --filter t3 typecheckModel: GPT-5.6 Sol · Harness: Codex
Note
Skip killing already-exited processes in provider maintenance runner
In
providerMaintenanceRunner.ts, the finalizer now checkschild.isRunningbefore callingchild.kill(), skipping the kill signal if the process has already exited. IfisRunningcheck fails, it still attempts to kill. A regression test is added to verify no kill is sent for already-completed processes.Macroscope summarized 9442413.
Note
Low Risk
Small process-cleanup tweak with a safe fallback that still kills when
isRunningcannot be determined. No auth, data, or API surface changes.Overview
Stops the provider update cleanup finalizer from always calling
kill()on completed child processes.In
collectCommandResult, the scoped finalizer now checkschild.isRunningfirst and only kills when the process is still alive (isRunningfailures still fall back to kill). Adds a regression test covering the already-exited case.Reviewed by Cursor Bugbot for commit 9442413. Bugbot is set up for automated code reviews on this repo. Configure here.