Repository navigation
fix(test): ignore shards created before the test process started - #9674
Merged
Merged
Conversation
…e-yeongyu#9673) A pid is reused, so a shard left by an earlier process that held this pid named it as creator and failed an unrelated run. Read created_at from the shard meta and only report shards created at or after the process start.
code-yeongyu
approved these changes
Oct 6, 2026
code-yeongyu
left a comment
Owner
There was a problem hiding this comment.
Approving 8ee3f376cf. Thanks, @drakeo338; this fixes #9673 the way the issue asked.
- The behavior holds:
bun test ./test-hermetic-home.test.tspasses 4/4 on this head. - Both guards are pinned by a test that fails without them:
- With the
created_at >= startedAtfilter removed, ignores a shard naming this pid that was created before the process started fails. - Dropping the
Number.isNaNbranch, so a malformed meta is no longer reported, fails reports a shard naming this pid whose created_at cannot be parsed.
- With the
- The time source is right: the default start time (
Date.now() - process.uptime() * 1000) matches what the shard writer records (shard-sidecar.tswritescreated_atas an ISO string fromnow()), so a shard this process creates always compares as at-or-after its start.
The one red check, test (macos-latest, 1/2), failed at Install dependencies, before any test ran. That's a runner problem, not this change, and I'm re-running it. I'll merge once it's green.
Owner
|
Merged as a1074ea. Thanks, @drakeo338: a clean fix with tests that fail when either guard is removed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The hermetic-home guard failed a run whenever a shard in the real agent dir named the test process's pid in
created_by_pid, even if a real session wrote it days earlier and the pid was later reused. It now also readscreated_atand ignores shards created before the process started; a shard with an unparseablecreated_atis still reported so a malformed meta cannot hide a leak.Changes
test-hermetic-home.ts:shardsCreatedBycomparescreated_atto the process start time.test-hermetic-home.test.ts: old-shard ignored, new-shard reported.QA & Evidence
bun test test-hermetic-home.test.ts: 4 pass, 0 fail on this commit; before the fix, the new test file fails against the base.Risks & Residuals
bun run typecheckand the fullbun testwere not run, so they are not listed below.Screenshots
Not applicable.
Automated Checks
bun test test-hermetic-home.test.tsRelated Issues
Closes #9673
Summary by cubic
Fixes the hermetic-home guard so a shard left by an earlier process that reused this pid no longer fails unrelated test runs. The guard now reads
created_atfrom shard meta files and ignores shards created before the process started; a shard whosecreated_atcannot be parsed is still reported so a malformed meta cannot hide a leak.Written for commit 8ee3f37. Summary will update on new commits.