Skip to content

test(gateway): join placement fence recovery before teardown - #160124

Merged
steipete merged 1 commit into
mainfrom
fix/placement-fence-test-lifecycle
Sep 28, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/placement-fence-test-lifecycle

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Placement reconciliation now awaits state-worker recovery reads before fencing a turn. The runtime-owner test polled for that boundary with Vitest's one-second default. On a slow runner it failed before completing the held tool operation or joining reconciliation, then database teardown produced an unhandled admission-closed error.

Observed in https://github.com/openclaw/openclaw/actions/runs/36377034783/job/108789323672 (attempt 2).

User Impact

Test-only repair. Observe the real admission-close boundary, preserving the authorization, draining-claim, teardown-order, and final-state assertions. Always complete the held operation and join reconciliation before database teardown, including assertion failures. Apply the same cleanup contract to the sibling staged-result fixture.

Evidence

Exact head 257347684d8daa4c3c464b792c4d7b984484aafb passed all 65 tests in the two affected files on Testbox, with one worker: 68.13s Vitest wall, 69.46s through the repository wrapper, 1m12.522s complete proof. Targeted formatting and whitespace pass. Independent P0–P2 review is clean; the owner closes admission synchronously before awaiting running operations. CI remains required.

Production +0/-0; tests +69/-37. No timeout increase, mock fence, production behavior change, or changelog entry.

@vincentkoc vincentkoc self-assigned this Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 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.

@vincentkoc
vincentkoc marked this pull request as ready for review September 28, 2026 05:00
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Sep 28, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 1:07 AM ET / 05:07 UTC.

ClawSweeper review

What this changes

The branch replaces a timed poll in a Gateway worker-placement test with an admission-close signal and ensures two recovery tests finish their held operations before teardown.

Merge readiness

✅ Ready for maintainer review

Keep open. Current main still has the timeout-prone test, and the related duplicate was closed unmerged in favor of this PR. Source review found no introduced defect.

Priority: P3
Reviewed head: 257347684d8daa4c3c464b792c4d7b984484aafb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow test repair follows the production fence and preserves the lifecycle assertions, with no introduced defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored PR changes Gateway test lifecycle behavior only, so the external-contributor real-setup gate does not apply. Its body reports a focused Testbox run of both files; this read-only review did not execute that run. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR changes Gateway test lifecycle behavior only, so the external-contributor real-setup gate does not apply. Its body reports a focused Testbox run of both files; this read-only review did not execute that run. No stored-data contract changes.
Evidence reviewed 6 items Current main retains the timed poll: The runtime-owner test waits for closed tool authorization with vi.waitFor, then completes its held operation only after its assertions.
Introduced test repair: The introduced hunks observe admission closure, retain the fence and state assertions, and complete the held operation while joining reconciliation in finally blocks.
Synchronous production fence: The placement store closes new tool admission before awaiting running tool operations, so the test's signal follows the production fence.
Findings None None.
Security None None.

How this fits together

Gateway worker-placement recovery compares stored session placements with their worker environments. These tests hold a nested session tool operation while recovery fences new calls, waits for the held operation, and reaches a final placement state.

flowchart LR
  A[Stored placement] --> B[Gateway reconciliation]
  C[Running session tool] --> D[Admission fence]
  B --> D
  D --> E[Wait for tool completion]
  E --> F[Worker teardown]
  F --> G[Final placement state]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +32. Total +32 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 69 37 +32
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 69 37 +32

Review metrics

None.

Root-cause cluster

Relationship: canonical
Canonical: #160124
Summary: The related single-file proposal explicitly deferred to this two-fixture repair and closed unmerged.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep both recovery fixtures synchronized with the real admission fence and ensure held tool work settles before shared-state teardown.

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

No deterministic slow-runner replay was run in this read-only review. Current main contains the timed poll, and the PR reports a CI failure at that boundary.

Is this the best way to solve the issue?

Yes. The test observes the real synchronous admission close, preserves the lifecycle assertions, and joins reconciliation before database teardown.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 02e1ac8391f8.

Labels

Label changes:

  • add P3: This is a focused test-reliability repair with no production behavior change.
  • 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: This MEMBER-authored PR changes Gateway test lifecycle behavior only, so the external-contributor real-setup gate does not apply. Its body reports a focused Testbox run of both files; this read-only review did not execute that run. No stored-data contract changes.

Label justifications:

  • P3: This is a focused test-reliability repair with no production behavior change.
  • 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: This MEMBER-authored PR changes Gateway test lifecycle behavior only, so the external-contributor real-setup gate does not apply. Its body reports a focused Testbox run of both files; this read-only review did not execute that run. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Devin Robison: 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

Copy link
Copy Markdown
Contributor

Additional exact-head Linux proof for 257347684d8daa4c3c464b792c4d7b984484aafb, addressing the inherited failure also seen in #159279:

  • 20 consecutive iterations × both affected cases = 40 passes. Each invocation used node scripts/run-vitest.mjs run with the two changed files and a name filter selecting the live-owner fence and running-nested-operation cases. The other 63 cases were excluded by this proof-only filter; their full-file coverage is recorded above. First invocation: 29s including cold transform; subsequent invocations: 9–11s each.
  • Negative control removed only the real owner's closeWorkerTurnToolAdmission(db, identity) call on the disposable remote checkout. Both unchanged authorization assertions failed expected true to be false. There was no unhandled rejection or read-admission cleanup error. Restored source hashes then matched the exact PR head.
  • Blacksmith Testbox tbx_01m3k713f1p15hh7b3pwarxawx, hosting run, Node 24.19.0, frozen installation, full SHA and source-hash checks. Aggregate proof exit 0; 4m21.688s. Command and downloads joined; owned lease confirmed stopped.

This supplements the author's 65/65 full-file Testbox proof and independent P0–P2 review. The production fence is exercised, and no timeout, retry or assertion was weakened. Landing as a pure inherited-CI repair under the maintainer's exact-head immediate squash direction; the package refactor remains separate and unmerged.

@steipete
steipete merged commit e4ea649 into main Sep 28, 2026
177 of 180 checks passed
@steipete
steipete deleted the fix/placement-fence-test-lifecycle branch September 28, 2026 05:36
steipete added a commit that referenced this pull request Sep 28, 2026
Refresh the PR merge ref after #160124 repaired the inherited placement fence synchronization and cleanup race. The reviewed and Testbox-proven package tree remains unchanged.
steipete added a commit that referenced this pull request Sep 28, 2026
Refresh the PR merge ref after #160124 repaired the inherited placement fence synchronization and cleanup race. The reviewed and Testbox-proven package tree remains unchanged.
steipete added a commit that referenced this pull request Sep 28, 2026
Refresh the PR merge ref after #160124 repaired the inherited placement fence synchronization and cleanup race. The reviewed and Testbox-proven package tree remains unchanged.
steipete added a commit that referenced this pull request Sep 28, 2026
Refresh the PR merge ref after #160124 repaired the inherited placement fence synchronization and cleanup race. The reviewed and Testbox-proven package tree remains unchanged.
steipete added a commit that referenced this pull request Sep 28, 2026
Refresh the PR merge ref after #160124 repaired the inherited placement fence synchronization and cleanup race. The reviewed and Testbox-proven package tree remains unchanged.
steipete added a commit that referenced this pull request Sep 28, 2026
* refactor(packages): deslop shared packages second pass

Consolidate remaining stream, parser, schema projection and normalization paths while preserving public exports, wire shapes and runtime semantics. Retain the prior package cleanup owners and shrink assertion ratchets for removed casts.

* refactor(packages): preserve schema declarations and finish type cleanup

* refactor(packages): preserve explicit guards and import ordering

* refactor(packages): retain distinct plugin result declarations

* fix(sdk): bundle private session URL dependency

The private session URL contract exports TypeScript source and has no standalone package build. Keep it as a build-time dependency so the existing package builder bundles it into the SDK. The unchanged external-consumer E2E reproduced the missing build-script failure before this repair.

* ci: refresh packages proof after inherited fixture repairs

Refresh the PR merge ref after #160024 repaired the trusted harness inventory and ordinary child-process jsdom preload. Package source and the reviewed tree are unchanged.

* ci: refresh packages proof after placement fixture repair

Refresh the PR merge ref after #160124 repaired the inherited placement fence synchronization and cleanup race. The reviewed and Testbox-proven package tree remains unchanged.

* ci: refresh packages after compiler scheduling repair

Refresh the PR merge ref after #160290 separated per-group scheduling from shared compiler inputs. The package tree and active Testbox source hashes are unchanged.

* ci: refresh packages after lazy import guard repair
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
* refactor(packages): deslop shared packages second pass

Consolidate remaining stream, parser, schema projection and normalization paths while preserving public exports, wire shapes and runtime semantics. Retain the prior package cleanup owners and shrink assertion ratchets for removed casts.

* refactor(packages): preserve schema declarations and finish type cleanup

* refactor(packages): preserve explicit guards and import ordering

* refactor(packages): retain distinct plugin result declarations

* fix(sdk): bundle private session URL dependency

The private session URL contract exports TypeScript source and has no standalone package build. Keep it as a build-time dependency so the existing package builder bundles it into the SDK. The unchanged external-consumer E2E reproduced the missing build-script failure before this repair.

* ci: refresh packages proof after inherited fixture repairs

Refresh the PR merge ref after openclaw#160024 repaired the trusted harness inventory and ordinary child-process jsdom preload. Package source and the reviewed tree are unchanged.

* ci: refresh packages proof after placement fixture repair

Refresh the PR merge ref after openclaw#160124 repaired the inherited placement fence synchronization and cleanup race. The reviewed and Testbox-proven package tree remains unchanged.

* ci: refresh packages after compiler scheduling repair

Refresh the PR merge ref after openclaw#160290 separated per-group scheduling from shared compiler inputs. The package tree and active Testbox source hashes are unchanged.

* ci: refresh packages after lazy import guard repair
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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.

2 participants