Retry the closeout fixture's temp-root removal so the release gate tolerates the detached telemetry flush
The 2026.10.16 release run 38867443956 failed in Run release checks. test/closeout-workflow.test.ts ("compact PR summary is privacy gated before the bot branch is published") threw ENOTEMPTY removing <tmp>/global/runtime/telemetry. The same race failed PR #133's first CI run.
Cause: the pm CLI's detached telemetry flush can still write under PM_GLOBAL_PATH after the CLI exits. Upstream pm-cli#1423 stopped it from resurrecting a deleted root, but a write during removal still races; follow-up filed as pm-cli#1484. test/import-gate.test.ts already retries its global-root removal (maxRetries: 5, retryDelay: 100); the closeout fixture added in #132 did not.
Fix: the closeout fixture's teardown retries the removal (maxRetries: 10, retryDelay: 100). Telemetry behaviour is unchanged.
Evidence: a CI-like local run (fresh HOME, no global git config, no GitHub tokens, built dist/) passes node --test test/closeout-workflow.test.ts 20/20.
Closes pm-github-aplb.
Summary by Sourcery
Harden disposable test fixture cleanup so release checks tolerate asynchronous telemetry activity.
Bug Fixes:
- Prevent intermittent test cleanup failures caused by telemetry writes racing disposable global-root removal.
Enhancements:
- Keep telemetry flushes within test commands and add defensive retries when removing temporary fixture roots.
Tests:
- Harden the closeout and import-gate test fixtures against detached telemetry cleanup races.
Summary by cubic
Fixes the release checks' ENOTEMPTY failures by stopping the pm CLI's detached telemetry flush from racing the closeout fixture's temp-root removal.
The 2026.10.16 release run failed when <tmp>/global/runtime/telemetry could not be removed: the CLI's detached telemetry worker can still write under PM_GLOBAL_PATH after the process exits, beyond any finite removal retry. Both disposable-global-root fixtures (closeout-workflow.test.ts, import-gate.test.ts) now set PM_TELEMETRY_INLINE_FLUSH=1 so telemetry flushes inline inside each command, without an outliving worker. The removal retry (10 attempts, 100 ms apart) stays as defensive cleanup. Telemetry delivery is unchanged.