Skip to content

fix(test): shut down HTTP fixtures consistently under Bun - #139595

Merged
steipete merged 1 commit into
mainfrom
codex/bun-http-fixture-cleanup
Sep 6, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/bun-http-fixture-cleanup

Conversation

@steipete

@steipete steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes test-fixture shutdown failures and lingering HTTP connections under Bun when browser transport, QA bus, and OTLP receiver tests stop their local servers.

Why This Change Was Made

Each fixture stops accepting requests before destroying its tracked sockets. This avoids depending on runtime-specific closeAllConnections behavior and lets unfinished requests terminate. The OTLP receiver retains idempotent close behavior, and QA bus cleanup restores mocks even if shutdown fails.

User Impact

Developers can run the covered HTTP fixture tests under Node and Bun with deterministic cleanup. Production behavior is unchanged.

Evidence

  • Six focused files, 134 tests: all pass on Node and true Bun.
  • The added unfinished-request shutdown regression failed before the fix with ERR_SERVER_NOT_RUNNING and passes afterward.
  • Complete changed-file gate passed; independent P0–P2 review found no actionable findings.
  • Four files changed, 78 lines added and 79 removed. Full repository Bun compatibility remains an ongoing campaign.

@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: qa-channel Channel integration: qa-channel extensions: browser size: S maintainer Maintainer-authored PR labels Sep 6, 2026
@steipete
steipete marked this pull request as ready for review September 6, 2026 01:21
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 9:27 PM ET / September 6, 2026, 01:27 UTC.

ClawSweeper review

What this changes

The PR stops local HTTP test servers before destroying their sockets, preserves cleanup after errors, and adds coverage for closing an unfinished telemetry request.

Merge readiness

✅ Ready for maintainer review

Keep open: this remains a useful fixture-lifecycle repair absent from inspected main. No blocking correctness findings were identified, and the maintainer-authored PR is protected from automatic closure.

Priority: P2
Reviewed head: 95a4d385b9976776fb43fbe66773c7887b4ca177

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused lifecycle repair with meaningful regression coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-author exemption applies. The fixture regression uses a real HTTP client and unfinished request, and the body reports Node/Bun before-and-after results; this review did not independently execute them.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-author exemption applies. The fixture regression uses a real HTTP client and unfinished request, and the body reports Node/Bun before-and-after results; this review did not independently execute them.
Evidence reviewed 7 items Introduced scope and current-main comparison: The host-verified introduced patch changes only HTTP tests and their OTLP support fixture. Comparing those paths with fetched main shows the same repair remains outstanding; unrelated base-only changes are not attributed to this PR.
Meaningful shutdown regression: The new test waits for HTTP 100 Continue before closing an unfinished POST, checks the client receives ECONNRESET, and repeats close to exercise idempotency. Existing browser release assertions and QA oversized-response assertions still precede fixture teardown.
Direct runtime contract: The patch directly uses node:http under Bun. Inspected Bun source clears its server reference and stops the listener in closeAllConnections; a subsequent close reports ERR_SERVER_NOT_RUNNING when that reference is absent. This supports the reported mechanism. The inspected upstream source is not pinned to the contributor's Bun version. Bun HTTP server source.
Findings None None.
Security None None.

How this fits together

These local HTTP fixtures support browser transport, QA messaging, and telemetry tests. They receive test requests and must release their listeners and connections when each test finishes.

flowchart LR
  A[Test HTTP clients] --> B[Local fixture server]
  B --> C[Tracked connections]
  D[Test teardown] --> E[Stop accepting connections]
  E --> F[Destroy tracked sockets]
  C --> F
  F --> G[Shutdown completes]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -1. Total -1 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 4 78 79 -1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 78 79 -1

Review metrics

None.

Technical review

Best possible solution:

Keep shutdown owned by each fixture: stop acceptance, destroy tracked sockets, and preserve assertions that verify client cleanup before teardown.

Do we have a high-confidence way to reproduce the issue?

Yes, source inspection establishes the shutdown failure mechanism: Bun's closeAllConnections stops the listener before the existing fixture calls close. The unfinished-request regression exercises that boundary; no tests were executed during this review.

Is this the best way to solve the issue?

Yes. The patch repairs fixture-owned lifecycle ordering without weakening transport assertions, changing production APIs, or adding runtime-specific branches.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against abd18df28d85.

Labels

Label changes:

  • add P2: This repairs bounded developer test failures under Bun without changing production behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-author exemption applies. The fixture regression uses a real HTTP client and unfinished request, and the body reports Node/Bun before-and-after results; this review did not independently execute them.

Label justifications:

  • P2: This repairs bounded developer test failures under Bun without changing production behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-author exemption applies. The fixture regression uses a real HTTP client and unfinished request, and the body reports Node/Bun before-and-after results; this review did not independently execute them.

Evidence

What I checked:

  • Introduced scope and current-main comparison: The host-verified introduced patch changes only HTTP tests and their OTLP support fixture. Comparing those paths with fetched main shows the same repair remains outstanding; unrelated base-only changes are not attributed to this PR. (test/e2e/qa-lab/runtime/otel-test-support.ts:802, 95a4d385b997)
  • Meaningful shutdown regression: The new test waits for HTTP 100 Continue before closing an unfinished POST, checks the client receives ECONNRESET, and repeats close to exercise idempotency. Existing browser release assertions and QA oversized-response assertions still precede fixture teardown. (test/e2e/qa-lab/runtime/otel-test-support.test.ts:10, 95a4d385b997)
  • Direct runtime contract: The patch directly uses node:http under Bun. Inspected Bun source clears its server reference and stops the listener in closeAllConnections; a subsequent close reports ERR_SERVER_NOT_RUNNING when that reference is absent. This supports the reported mechanism. The inspected upstream source is not pinned to the contributor's Bun version. Bun HTTP server source. (src/js/node/_http_server.ts:424)
  • Shutdown ordering contract: Node documents stopping acceptance before forcefully closing connections to avoid races with newly accepted connections; the patch follows that ordering. Node HTTP shutdown documentation.
  • Latest-release comparison: The inspected v2026.9.2 OTLP fixture still calls closeLocalOtlpReceiverConnections before and after server.close, and that helper calls closeAllConnections. This release does not contain the proposed repair. (test/e2e/qa-lab/runtime/otel-test-support.ts:812, 3928bad9badf)
  • Validation and discussion: The captured PR body reports 134 tests passing on Node and Bun, including a pre-fix ERR_SERVER_NOT_RUNNING failure and after-fix success. These are author-reported results, not reviewer executions. No substantive review comments were supplied. Read-only diff whitespace validation passed. (95a4d385b997)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 047fdfe into main Sep 6, 2026
212 checks passed
@steipete
steipete deleted the codex/bun-http-fixture-cleanup branch September 6, 2026 03:06
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 6, 2026
* commit 'a2886546df92c3a601db538b1b70125e3519a16f':
  test(reports): deduplicate native process census setup (#139596)
  fix(ui): avoid refetching unrelated catalog hosts (#139570)
  test(compaction): consolidate classification proof at its owner (#139564)
  fix(apple): harden native state file permissions (#139623)
  improve(skills): review retained conversation for durable learning (#139656)
  fix(docker): stage bundled plugin runtime dependencies under the packaged plugin root (#139117)
  test: close HTTP fixtures before destroying their sockets (#139595)
  refactor(agents): simplify attempt execution and recovery (#139597)
  test(gateway): share HTTP authority scenarios (#139611)
  test(gateway): distinguish final CLI results from draft text (#139605)
  fix(shell-env): preserve CLI terminal ownership during login imports (#139308)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: qa-channel Channel integration: qa-channel extensions: browser maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant