Skip to content

Temp directories are never cleaned up: PipelineRunner leaks one per instance, and test fixtures leaked 7 GB into a tmpfs /tmp - #532

Merged
AdamFrisby merged 3 commits into
mainfrom
codeybox/4eb99834
Sep 18, 2026
Merged

AdamFrisby merged 3 commits into
mainfrom
codeybox/4eb99834

Conversation

@AdamFrisby

Copy link
Copy Markdown
Owner

Automated via CodeyBox — work item 4eb99834138c4684b956ae047a84b78b

Initiated by CodeyBox operator


Co-Authored-By: CodeyBox noreply@codeybox.invalid
🤖 Generated with CodeyBox

AdamFrisby and others added 3 commits September 18, 2026 11:51
…sweep

Production:
- PipelineRunner no longer creates a per-instance disabled-host-hooks
  directory; a single shared directory is created once and reused.
- ProcessSandbox.DisposeAsync honors DisablePreserveOnDispose even after a
  preserved disposal, so phase disposal reaps converted retained VMs.
- GitHubAppStorePath is now a bound CodeyBoxOptions property instead of an
  ad-hoc configuration read (consistent with StateDatabasePath).
- New bounded startup sweep (TempFileSweeper + TempSweepStartupService,
  CodeyBox:TempSweep options) removes stale codeybox-* temp entries without
  following symlinks or touching fresh/live entries.

Tests:
- All temp-database fixtures migrated to a shared TestScratchDirectory
  helper that removes the directory, database and SQLite sidecars on
  disposal; every owner now disposes it.
- Test servers isolate their GitHub App store under the fixture scratch.
- TrackingSandboxProvider cleans up sandboxes intentionally left
  preserved/abandoned by preemption and teardown-failure scenarios.

Docs: host-requirements section notes the tmpfs consequence.

Verification: full suite green (13382 passed); two consecutive full runs
leave identical fixed-name /tmp entries with zero variable leftovers.

CodeyBox-Prompt-Revision: 1
Co-Authored-By: CodeyBox <noreply@codeybox.invalid>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the shared disabled-host-hooks directory out of the world-writable
shared temp path into the per-user application-data directory, where
another local user cannot pre-create it as a file, symlink, or hostile
hook farm. Creation fails closed with an unpredictable per-process
GUID fallback, and the resolver never throws (Lazy must not cache).

Drop the sweeper exclusion for the legacy predictable name so planted
or leftover entries are reaped once stale; wire the sweeper logger
through the startup service; document SkippedFresh as fresh-or-unprovable.

CodeyBox-Prompt-Revision: 1
Co-Authored-By: CodeyBox <noreply@codeybox.invalid>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace recursive Directory.Delete with fd-relative O_NOFOLLOW /
unlinkat deletion on Linux (per-component re-validation at the sink;
any link aborts the entry), plus a re-validating non-recursive
fallback elsewhere. Add direct sink regression tests. Narrow a
bare catch in test teardown and drop dead exception discards.

CodeyBox-Prompt-Revision: 1
Co-Authored-By: CodeyBox <noreply@codeybox.invalid>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@AdamFrisby
AdamFrisby merged commit f22278f into main Sep 18, 2026
@AdamFrisby
AdamFrisby deleted the codeybox/4eb99834 branch September 18, 2026 15:32
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.

1 participant