Skip to content

fix(gateway): isolate placement tests after cancellation - #149668

Merged
fuller-stack-dev merged 1 commit into
mainfrom
openclaw/gateway-placement-fixture-lifetimes-20260916
Sep 16, 2026
Merged

fuller-stack-dev merged 1 commit into
mainfrom
openclaw/gateway-placement-fixture-lifetimes-20260916

Conversation

@fuller-stack-dev

Copy link
Copy Markdown
Member

Related: #147390, #149581

What Problem This Solves

Gateway placement-recovery tests can continue changing shared fixture state after a timed-out case, causing misleading recursion and authorization failures in later cases.

User Impact

No production behavior changes. The test suite now waits for the prior case to release Gateway, subprocess, state, and spy ownership before another case starts.

Why This Change Was Made

Keep teardown inside the original 90-second test body, fence continuation after cancellation, and have the finish hook join that same lifetime. A controlled regression exercises pending startup and teardown. The existing three recovery scenarios and their assertions from @obviyus in #147390 are preserved. No retry, longer deadline, or weakened authority check is introduced.

This is the independently consumable test prerequisite for #149581; it contains no worktree profile or generic checkout implementation.

Evidence

  • The controlled regression failed at the intended missing finish-hook assertion on the original fixture (one selected failure, exit 1).
  • The corrected controlled case passed (one selected, exit 0). Its context explicitly forwards Vitest's non-enumerable expect getter.
  • All three real Gateway cases passed in original order in 41.204s, 17.026s, and 32.901s, with the original 90-second deadline. No surviving child or fixture owner remained; source/root state were unchanged.
  • Fresh independent review was clean through P2, including the narrow lint/type corrections: explicit tracked-promise ownership, non-mutating LIFO cleanup, and the existing typed deferred helper. Those corrections preserve the observed runtime semantics.
  • Targeted core/routing lint and the owning Gateway-server type stripe 5/19 passed. The qualifier exited 0 with no signals or descendants and zero product build output.
  • Standalone head 88c08ddaba47b921fef34783e5ae983e27aa97ed is patch-identical to the qualified three-path increment. No profile/generic commits are included. Exact standalone-head CI and native maintainer gates remain required before landing.

Keep teardown inside the original 90-second body deadline and join it before the next case acquires shared state. Preserve the fixture scenarios and assertions introduced by obviyus in #147390. Add a source-bound cancellation regression, forward context-local expect, and use the existing typed deferred owner.
@clawsweeper

clawsweeper Bot commented Sep 16, 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 gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Sep 16, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Sep 16, 2026
@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review September 16, 2026 04:07
@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 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 12:13 AM ET / 04:13 UTC.

ClawSweeper review

What this changes

The PR prevents canceled Gateway placement tests from overlapping shared state, adds a controlled cancellation regression, and routes that regression into isolated test execution.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a focused fixture-isolation repair that current main still needs. No blocking correctness or security finding was identified; the maintainer-authored prerequisite remains distinct from the linked worktree feature.

Priority: P2
Reviewed head: 88c08ddaba47b921fef34783e5ae983e27aa97ed

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful lifecycle coverage, preserved recovery assertions, and no blocking source findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored test-only repair; the body reports controlled cancellation coverage and three real Gateway runs exercising the changed fixture.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored test-only repair; the body reports controlled cancellation coverage and three real Gateway runs exercising the changed fixture.
Evidence reviewed 8 items Introduced change and cleanup ownership: The verified merge-base-to-head diff changes only the placement tests and their isolated-runner registration. The fixture tracks body settlement, joins cleanup from the finish hook, checks cancellation after awaited operations, and retains admission blocking when cleanup fails.
Current main still uses the older fixture: Fetched main retains it.each without context cancellation or a finish-hook lifetime join and captures the tunnel implementation inside each case. The relevant fixture and shared cleanup helpers have no differences between fetched main and the pinned merge base.
Regression exercises the registered fixture: The new test imports the real case registration, cancels pending startup, holds Gateway close and state cleanup independently, rejects overlapping acquisitions, and checks exactly-once cleanup plus spy restoration. External resources are mocked; the fixture lifecycle under review remains real.
Findings None None.
Security None None.

How this fits together

Gateway placement tests verify recovery from offline devices, subsequent chat turns, and transcript archival. Their fixtures own a Gateway, provider subprocess, temporary state, and module spies that must finish cleanup before another case starts.

flowchart TD
  A[Placement recovery cases] --> B[Fixture admission guard]
  B --> C[Gateway and provider startup]
  C --> D[Recovery and chat assertions]
  E[Test cancellation] --> F[Join body and ordered cleanup]
  D --> F
  F --> G[Release shared state]
  G --> B
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +340. Total +340 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 416 76 +340
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 416 76 +340

Review metrics

Metric Value Why it matters
Recovery coverage and deadline 3 existing scenarios retained; 90-second case deadline unchanged The repair preserves recovery coverage without retries, longer deadlines, or weaker assertions.

Technical review

Best possible solution:

Keep the existing recovery scenarios while giving their shared resources one cancellation-aware lifetime that releases state only after verified teardown.

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

Yes, from source: cancel the registered case during pending startup and attempt another acquisition before cleanup settles. The new regression models that sequence; this review did not execute it.

Is this the best way to solve the issue?

Yes. The patch reuses the existing lifetime and ordered-cleanup helpers, preserves the original recovery assertions, and keeps the fix within test infrastructure.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs bounded test-fixture contamination that can produce misleading Gateway failures 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 external-contributor proof gate does not apply to this MEMBER-authored test-only repair; the body reports controlled cancellation coverage and three real Gateway runs exercising the changed fixture.

Label justifications:

  • P2: This repairs bounded test-fixture contamination that can produce misleading Gateway failures 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 external-contributor proof gate does not apply to this MEMBER-authored test-only repair; the body reports controlled cancellation coverage and three real Gateway runs exercising the changed fixture.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit b7fb84e adds src/gateway/server.placement-abandonment.test.ts:34 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b7fb84e6c6ad; files: src/gateway/server.placement-abandonment.test.ts)
  • vincentkoc: 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.

@fuller-stack-dev
fuller-stack-dev merged commit a0ebadf into main Sep 16, 2026
218 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the openclaw/gateway-placement-fixture-lifetimes-20260916 branch September 16, 2026 04:38
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 17, 2026
…49668)

Keep teardown inside the original 90-second body deadline and join it before the next case acquires shared state. Preserve the fixture scenarios and assertions introduced by obviyus in openclaw#147390. Add a source-bound cancellation regression, forward context-local expect, and use the existing typed deferred owner.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime 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: M 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