Skip to content

fix(test): ignore shards created before the test process started - #9674

Merged
code-yeongyu merged 1 commit into
code-yeongyu:devfrom
drakeo338:claude/9673-fix
Oct 6, 2026
Merged

code-yeongyu merged 1 commit into
code-yeongyu:devfrom
drakeo338:claude/9673-fix

Conversation

@drakeo338

@drakeo338 drakeo338 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

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 reads created_at and ignores shards created before the process started; a shard with an unparseable created_at is still reported so a malformed meta cannot hide a leak.

Changes

  • test-hermetic-home.ts: shardsCreatedBy compares created_at to the process start time.
  • test-hermetic-home.test.ts: old-shard ignored, new-shard reported.

QA & Evidence

  • Ran 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 typecheck and the full bun test were not run, so they are not listed below.

Screenshots

Not applicable.

Automated Checks

bun test test-hermetic-home.test.ts

Related 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_at from shard meta files and ignores shards created before the process started; a shard whose created_at cannot be parsed is still reported so a malformed meta cannot hide a leak.

Written for commit 8ee3f37. Summary will update on new commits.

Review in cubic

…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 code-yeongyu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Approving 8ee3f376cf. Thanks, @drakeo338; this fixes #9673 the way the issue asked.

  • The behavior holds: bun test ./test-hermetic-home.test.ts passes 4/4 on this head.
  • Both guards are pinned by a test that fails without them:
    • With the created_at >= startedAt filter removed, ignores a shard naming this pid that was created before the process started fails.
    • Dropping the Number.isNaN branch, so a malformed meta is no longer reported, fails reports a shard naming this pid whose created_at cannot be parsed.
  • The time source is right: the default start time (Date.now() - process.uptime() * 1000) matches what the shard writer records (shard-sidecar.ts writes created_at as an ISO string from now()), 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.

@code-yeongyu
code-yeongyu merged commit a1074ea into code-yeongyu:dev Oct 6, 2026
57 of 58 checks passed
@code-yeongyu

Copy link
Copy Markdown
Owner

Merged as a1074ea. Thanks, @drakeo338: a clean fix with tests that fail when either guard is removed.

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.

test guard (#9578) reports a real session's old shard as a test leak when the test process reuses that pid

2 participants