test(responses): stop the shutdown-cleanup reserve from expiring under load - #3055
Conversation
…r load The drain expiry in "shutdown cleanup failure still persists unrelated response state and reports failure" is forced by the icacls gate, not by the clock. The 80ms fallback reserve, however, was a real wall-clock value, and on a loaded runner it could expire before the unrelated response finished persisting. When it did, fallbackPendingResponseSpills terminalized resp_cleanup_unrelated into a spill-failed tombstone and the replay assertion failed. Observed on a Linux host at origin/dev: 8 parallel runs of this single test ranged from 2.08s to 109.38s, and a 6-way parallel run reproduced the failure once. GitHub CI hit it on test 2/4 twice in a row. Sizing the reserve so it cannot be the thing that runs out keeps the assertion exactly as it was — the gate still forces the drain to expire, the cleanup failure is still injected, and the unrelated response must still replay.
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe shutdown cleanup failure test now uses an extended spill shutdown budget and documents that the injected ACL gate must expire the drain before the fallback reserve. ChangesShutdown cleanup validation
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This test-only change prevents a load-sensitive cleanup reserve from expiring before the test assertion completes, without changing product behavior. No actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Title checkExplanation The title clearly describes the main change: preventing the shutdown-cleanup test's fallback reserve from expiring under load. It matches the changes in tests/responses-state.test.ts and the stated pull request objective. Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
리뷰 · 우선순위 55 / 80설명 이 PR은 제품 코드를 안 고친다. 고치는 것은 테스트 하나다. 이름은 이 테스트가 확인하고 싶은 것은 짧다. 종료 정리가 실패해도, 그것과 상관없는 작은 응답은 남아야 하고, 나중에 다시 읽을 수 있어야 한다. 방법은 이렇다. 플랫폼을 Windows처럼 속인 뒤 문제는 폴백 예약 80ms가 진짜 벽시계라는 점이다. 고침은 예약을 30초로 늘리는 것이다. 라인 1225 - 메인테이너의 판단이 필요한 지점
너의 추천 CI 테스트 샤드가 초록이면 이 댓글은 grok-bot이 작성했습니다 |
Summary
Responses previous_response_id state > shutdown cleanup failure still persists unrelated response state and reports failureis flaky on loaded runners. It failedtest 2/4on two consecutive CI runs for PR #3054, a branch that does not touchsrc/responses/at all.The test forces the shutdown drain to expire by holding an
icaclsgate open, then injects anunlinkfailure during cleanup, and asserts that an unrelated small response still replays afterwards. Drain expiry is driven by the gate, which is deterministic. The fallback reserve was not:fallbackReserveMs: 80is a real wall-clock value measured withDate.now()infallbackPendingResponseSpills.On a loaded runner that 80ms window can expire before the unrelated response finishes persisting. When it does,
terminalizeExhaustedShutdownFallbackconvertsresp_cleanup_unrelatedinto aspill-failedtombstone, and the replay assertion fails with the raw request echoed back instead of the stored input and output.This is a test defect, not a product defect. The drain and fallback budgets behave correctly; the test was asserting a real-time property it did not intend to assert.
The fix
Size the reserve so it cannot be the thing that runs out (
totalMs: 30_120, fallbackReserveMs: 30_000). The gate still forces the drain to expire, the cleanup failure is still injected, and the unrelated response must still replay. Every assertion is unchanged.Verification
Reproduced first, on a Linux host at
origin/dev(7c68768ca), before changing anything:test 2/4twice in a row on PR fix(codex): refresh expired management entitlements #3054.After the fix, at
883faf0d9on the same host: 10 parallel runs, 10 pass, 0 fail, with individual run times spread from 5.47s to 45.51s. The longest run is now over 500x the old reserve and still passes.Focused suite locally:
bun test tests/responses-state.test.ts— 130 pass / 0 fail / 364 assertions.Checklist
devSummary by CodeRabbit