Skip to content

fix: clean up telemetry temp files on flush failure#194

Merged
felipefreitag merged 2 commits intomainfrom
fix/telemetry-temp-file-leak-07f9
Apr 14, 2026
Merged

fix: clean up telemetry temp files on flush failure#194
felipefreitag merged 2 commits intomainfrom
fix/telemetry-temp-file-leak-07f9

Conversation

@bukinoshita
Copy link
Copy Markdown
Member

@bukinoshita bukinoshita commented Apr 9, 2026

Summary by cubic

Always delete telemetry temp files after any flush attempt to prevent leaks, even when the network request fails.

  • Bug Fixes
    • Wrap flushPayload() in try/finally in flushFromFile() so unlinkSync() always runs.
    • Update test to assert the temp file is deleted on failed flush.

Written for commit ef3dd39. Summary will update on new commits.

@bukinoshita
Copy link
Copy Markdown
Member Author

@cubic-dev-ai can you review?

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Apr 13, 2026

@cubic-dev-ai can you review?

@bukinoshita I have started the AI code review. It will take a few minutes to complete.

@bukinoshita
Copy link
Copy Markdown
Member Author

@cursor fix conflicts

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 13, 2026

The PR description was updated by cubic (automated summary), and the title is unchanged. No need to update the PR — the conflicts are resolved, tests pass, and the branch is pushed.

Resolved the merge conflicts by rebasing fix/telemetry-temp-file-leak-07f9 onto the latest main. The conflict was in tests/lib/telemetry.test.ts where upstream had already migrated from test() to it() — I kept the updated test name ('deletes file even when flush fails') to match the new behavior. All 26 tests pass and the branch has been force-pushed.

Open in Web Open in Cursor 

Wrap flushPayload() in try/finally so unlinkSync() runs regardless
of whether the telemetry POST succeeds. Previously, failed flushes
left orphaned resend-telemetry-*.json files in the system tmpdir.

Resolves BU-619

Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
@cursor cursor Bot force-pushed the fix/telemetry-temp-file-leak-07f9 branch from ef3dd39 to 10e0d4d Compare April 13, 2026 22:27
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@bukinoshita bukinoshita marked this pull request as ready for review April 13, 2026 23:46
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@felipefreitag felipefreitag merged commit 10075fd into main Apr 14, 2026
7 checks passed
@felipefreitag felipefreitag deleted the fix/telemetry-temp-file-leak-07f9 branch April 14, 2026 19:07
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.

3 participants