Skip to content

test(storage): close agent run stores before cleanup - #2341

Merged
Astro-Han merged 2 commits into
apache:mainfrom
liugddx:fix/windows-agent-run-store-cleanup
Aug 7, 2026
Merged

test(storage): close agent run stores before cleanup#2341
Astro-Han merged 2 commits into
apache:mainfrom
liugddx:fix/windows-agent-run-store-cleanup

Conversation

@liugddx

@liugddx liugddx commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

  • make the two root-admission test fixtures own every SQLite AgentRun store they open
  • close original and reopened stores in reverse order before removing each temporary root
  • keep the change limited to test lifecycle cleanup with no filesystem retries or production behavior changes

Part of #2142 Phase 1.

Why

The latest Windows baseline reports six cleanup failures across these two files after their assertions pass. Each test opens an AgentRun store, and two also open a second store, but the fixture removes the root without releasing the shared runtime.sqlite leases. Windows correctly rejects that unlink with EBUSY; POSIX hides the lifecycle omission.

Validation

  • npm --workspace @maka/storage run build
  • node --test packages/storage/dist/__tests__/agent-graph-supervisor-root-admission.test.js packages/storage/dist/__tests__/claimed-agent-graph-root-admission.test.js (6 pass)
  • npx biome check packages/storage/src/__tests__/agent-graph-supervisor-root-admission.test.ts packages/storage/src/__tests__/claimed-agent-graph-root-admission.test.ts
  • git diff --check

@liugddx

liugddx commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

The first required workspace lane failed in two unrelated timing-sensitive tests: maka-cu-service did not observe its cancel line within the assertion window, and opencode-free-anonymous observed provider_unavailable before its 42ms shared timeout. The six changed storage tests passed. The Windows artifact independently confirms the intended effect: storage moved from 648 pass / 38 fail / 38 skip to 654 pass / 32 fail / 38 skip, exactly eliminating the six targeted AgentRun cleanup failures, with no remaining maka-graph-supervisor-admission or maka-claimed-graph-admission cleanup errors. I cannot use Actions rerun on the upstream repo from the fork account, so 03d747b5 is an empty commit that retriggers the flaky checks without changing code.

@liugddx
liugddx force-pushed the fix/windows-agent-run-store-cleanup branch from 03d747b to 3dcefe9 Compare August 7, 2026 00:20

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for another clean fixture-lifecycle fix in the #2339 family — all 7 createSqliteAgentRunStore calls in both files route through openStore(), closing is idempotent behind the refcount/released chain, and 6/6 tests pass. The withTempRoot-scoped tracking is arguably cleaner than #2339's map wrapper.

Three non-blocking notes:

  • The 'ci: retry flaky workspace checks' commit (3dcefe9) is an empty commit — zero diff, just a CI retry. Squash will absorb it; worth avoiding message-only pushes in the future.
  • store.close?.() leans on close? being optional in the DurableAgentRunStore interface (agent-run-store.ts:142), which is type-consistent but weaker than #2339's mandatory close() — the very invariant this test exists to protect (must close before rm) could silently degrade on POSIX. Consider assert.ok(store.close) or making close mandatory.
  • Sibling files still close on the happy path only (regenerate-root-admission.test.ts:27, sqlite-long-term-memory-store.test.ts, agent-graph-supervisor-wakes.test.ts) — a follow-up could apply the same finally-close pattern.

Merging.

@Astro-Han
Astro-Han merged commit c75a519 into apache:main Aug 7, 2026
11 checks passed
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.

2 participants