Skip to content

[AIW-314] Fully drain poll-agent deadline fixtures - #356

Merged
outof-place merged 1 commit into
mainfrom
codex/aiw-314-lifecycle-drain-followup
Aug 28, 2026
Merged

[AIW-314] Fully drain poll-agent deadline fixtures#356
outof-place merged 1 commit into
mainfrom
codex/aiw-314-lifecycle-drain-followup

Conversation

@outof-place

@outof-place outof-place commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Scope

Authoritative reproduction

Exact historical main SHA 3f23d34c2fefeaed5048966eee07cb1b0085b44a failed run 33173321742, job 98855565522: 383/384 files and 6,671/6,673 tests passed, while two poll-agent tests exposed stale async work crossing mock resets.

A focused sequential regression failed deterministically before this patch because a late stdout reader received an already-aborted signal and never settled.

Fix

  • Retain and drain every deadline collector and raw Sandbox fixture.
  • Reject stdout immediately for already-aborted signals and on later abort.
  • Guarantee idempotent cleanup even when an assertion fails.
  • Assert exact current call counts and critical Sandbox arguments before advancing fake time.
  • Remove irreversible pending test promises.
  • Prove deadline → late stdout abort → full drain → clean next poll in one regression.

Current exact candidate

Base: 6c461fdaffeba85118efa23f14a57e6d2b085f6a.
Candidate: b3d367a9ab5f222ef357ec9f00de4f83ab32d032.
Blob: be199744e79dd95afa3a598ae2009a3308cc0a01.

The prior candidate 97161a809e6947c499ef16e64d61a0aa16b112bf and its green CI remain superseded historical evidence only.

Current-candidate local evidence

  • Node 25.6.1 focused file: 22/22 PASS.
  • Node 24.19.0 focused file: 22/22 PASS.
  • Node 24.19.0 shuffled seeds 1–10: 10/10 PASS.
  • Node 25.6.1 shuffled seeds 1–10: 10/10 PASS.
  • Named sequential lifecycle regression on Node 24.19.0: 1/1 PASS.
  • pnpm --filter worker typecheck: PASS.
  • git diff --check origin/main...HEAD: PASS.
  • Prior deliberate assertion-failure audit remains valid for the lifecycle implementation; the following tests stayed isolated with no OIDC/mock leakage.
  • Literal acceptance-criteria review: ACCEPT.

No full repository suite was run locally. Exact-candidate GitHub run 33199307016, job 98944431213, is in progress. The PR remains draft and unmerged.

Summary by CodeRabbit

  • Tests
    • Improved coverage for timeout handling, cancellation, hanging operations, and artifact access.
    • Added checks for abort signal propagation and cleanup of asynchronous work.
    • Added scenarios covering resource reuse and replay timeout handling.
    • Increased test determinism and isolation for sandbox polling workflows.

@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ai-workflow-app-dashboard Ready Ready Preview Aug 28, 2026 6:27pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ac43e63-e880-44ed-9083-1d5eccb07c38

📥 Commits

Reviewing files that changed from the base of the PR and between 6c461fd and b3d367a.

📒 Files selected for processing (1)
  • apps/worker/src/sandbox/poll-agent.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The poll-agent tests now track deferred operations, propagate abort signals, centralize cleanup, and cover hanging sandbox lookups, artifact reads, stdout streams, replay timeouts, late-abort drainage, and subsequent poll reuse.

Changes

Poll-agent asynchronous test isolation

Layer / File(s) Summary
Fixture tracking and centralized cleanup
apps/worker/src/sandbox/poll-agent.test.ts
Tracked promises, deferred fixtures, abort-aware stream mocks, shared artifact paths, signal assertions, and asynchronous global cleanup were added.
Timeout and abort scenario coverage
apps/worker/src/sandbox/poll-agent.test.ts
Tests now cover hanging sandbox lookups, artifact reads, stdout streams, stop operations, replay diagnostics, and deterministic SandboxDeadlineError results.
Late-abort drainage and poll reuse
apps/worker/src/sandbox/poll-agent.test.ts
The tests verify that pending operations settle before mocks are reused by a subsequent poll.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Merge Risk: ⚪ Minimal · up to b3d36

This PR only updates poll-agent tests to make deadline cleanup deterministic and does not alter product behavior; the supplied focused, cross-runtime, shuffled, lifecycle, typecheck, and diff checks pass, so no actionable merge-blocking risk remains beyond normal checks.

Suggested reviewers: iipanda

Poem

A rabbit tracks each promise tight

And drains the streams before moonlight
Abort signals hop through every gate
Deadlines settle tests in state
Fresh polls follow, clean and bright

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the test-only change to fully drain poll-agent deadline fixtures.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@outof-place

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@outof-place
outof-place merged commit 6187e88 into main Aug 28, 2026
7 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.

1 participant