[codex] Prevent background Git fetches from leaking temp packs#3537

closed7
main
codex/fix-git-fetch-temp-pack-leaks
openedJun 23, 2026byJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 3d ago
16 unresolved threads · Jump to file
Selected thread: apps/server/src/vcs/GitVcsDriverCore.ts:1027 — ### Deletes unrelated fetch temp packs **Medium Severity** <!-- DESCRIPTION START --> After a failed status `fetchRemoteForStatus`, cleanup removes every new `tmp_pack_*` name versus a pre-fetch snapshot, not packs created only by that fetch. Another `git fetch` (for example `fetchRemote`) can fail, release `FETCH_HEAD.lock`, and leave temp packs that this path then deletes. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: d4ee9b55-a6b9-42f7-8202-1538bf13282a --> <!-- LOCATIONS START apps/server/src/vcs/GitVcsDriverCore.ts#L1002-L1027 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjlmMjJjM2E0LTk3NzItNGJiMi04ODY3LTllNjUxNGM4ZjVmNCIsImVuY3J5cHRpb25LZXkiOiJLVG45U1E0TzlkYTN5LUJrSjQ3RzUtMFRlOG5PWGpWZnVMOS1HbkhEekVZIiwiYnJhbmNoIjoiY29kZXgvZml4LWdpdC1mZXRjaC10ZW1wLXBhY2stbGVha3MiLCJyZXBvT3duZXIiOiJwaW5nZG90Z2ciLCJyZXBvTmFtZSI6InQzY29kZSJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjlmMjJjM2E0LTk3NzItNGJiMi04ODY3LTllNjUxNGM4ZjVmNCIsImVuY3J5cHRpb25LZXkiOiJLVG45U1E0TzlkYTN5LUJrSjQ3RzUtMFRlOG5PWGpWZnVMOS1HbkhEekVZIiwiYnJhbmNoIjoiY29kZXgvZml4LWdpdC1mZXRjaC10ZW1wLXBhY2stbGVha3MiLCJyZXBvT3duZXIiOiJwaW5nZG90Z2ciLCJyZXBvTmFtZSI6InQzY29kZSIsInByTnVtYmVyIjozNTM3LCJjb21taXRTaGEiOiI1ODM0MDYwNGYwYjc5NjdlN2E1YTNlNTMyOTkzZjM0NDM0NDJkMTRlIiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 58340604f0b7967e7a5a3e532993f3443442d14e. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
0 / 100 viewed100 files changedLine totals unavailable

apps/server/src/diagnostics/ProcessDiagnostics.ts · File comment

M
macroscopeappBotJul 29, 2026

🟡 Medium

https://github.com/pingdotgg/t3code/blob/58340604f0b7967e7a5a3e532993f3443442d14e/apps/server/src/diagnostics/ProcessDiagnostics.ts#L1

The read function filters only the server PID out of snapshot.processes, so independent Electron roots and the resource-monitor process are returned as server child processes. This inflates processCount, totalRssBytes, and totalCpuPercent, and their depth is clamped to 0 via Math.max(0, entry.depth - 1) even though they are not descendants of the server. The filter at line 78 should restrict the list to the server/backend descendant tree rather than all telemetry processes.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
text
1In file @apps/server/src/diagnostics/ProcessDiagnostics.ts around line 1:
2
3The `read` function filters only the server PID out of `snapshot.processes`, so independent Electron roots and the resource-monitor process are returned as server child processes. This inflates `processCount`, `totalRssBytes`, and `totalCpuPercent`, and their `depth` is clamped to `0` via `Math.max(0, entry.depth - 1)` even though they are not descendants of the server. The filter at line 78 should restrict the list to the server/backend descendant tree rather than all telemetry processes.