Skip to content

test(gateway): stabilize yielded-session settlement - #149558

Merged
RomneyDa merged 3 commits into
mainfrom
fix/gateway-yield-resume-test-settlement
Sep 16, 2026
Merged

RomneyDa merged 3 commits into
mainfrom
fix/gateway-yield-resume-test-settlement

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

  • isolate the yielded-session recovery regression in the Gateway methods forked lane
  • synchronize the test on terminal, cleanup, requester-wake, and delivery state without advancing its future fake-timer deadline
  • include active Gateway root holders in persistence-test leak diagnostics

Problem

Main CI run https://github.com/openclaw/openclaw/actions/runs/35028916689 failed in checks-node-compact-large-26 while this regression waited for the process-wide Gateway root count to reach zero.

The test uses fake timers and owns a future requester-settle wake. Vitest advances fake time on every default vi.waitFor poll, so a slow shard can fire that future wake while the test is trying to observe unrelated cleanup quiescence. The file also replaces process-global registry and task state while running in the shared Gateway methods project.

Solution

Route the file through the existing isolated Gateway methods project. Replace body-level global-quiescence waits with zero-interval waits for the exact lifecycle facts produced by each action. Keep the teardown leak invariant and report named root holders when it fails.

Validation

  • node scripts/run-vitest.mjs src/gateway/server-methods/sessions.send-yield-resume.test.ts
  • node scripts/run-vitest.mjs test/vitest-projects-config.test.ts
  • targeted tracked requester-wake lifecycle test
  • node scripts/check-changed.mjs --dry-run -- <changed paths>
  • node scripts/check-changed.mjs -- <changed paths>
  • git diff --check
  • diff-scoped autoreview: clean

Production code delta: 0.

@vincentkoc vincentkoc self-assigned this Sep 16, 2026
@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.

@vincentkoc
vincentkoc marked this pull request as ready for review September 16, 2026 00:59
@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 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 9:58 PM ET / September 16, 2026, 01:58 UTC (Revision 3).

ClawSweeper review

What this changes

The PR isolates the yielded-session regression test, waits for specific completion state without advancing fake time, improves cleanup diagnostics, and makes PR-wrapper dependency fixtures repeatable.

Merge readiness

✅ Ready for maintainer review

The test stabilization remains useful and is not present on fetched main. No blocking correctness or security finding was identified; the member-authored PR should remain open for normal maintainer handling.

Priority: P3
Reviewed head: dadf57116c7b7e81a41a148dd2004eaa4490cb92

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test repair with preserved behavioral assertions, verified timer semantics, and no blocking findings.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR changes test synchronization and fixtures only; the external-contributor runtime-proof gate does not apply, and no production authority change triggers additional proof.
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 test synchronization and fixtures only; the external-contributor runtime-proof gate does not apply, and no production authority change triggers additional proof.
Evidence reviewed 8 items Introduced scope and review continuity: The complete pinned introduction contains only tests, test support, and test routing. The GitHub comparison against the previous reviewed head confirms the latest commit only changes dependency-fixture idempotence and adds its regression test. Previous review context contains no outstanding findings.
Specific lifecycle assertions preserve coverage: The full session-resume test retains the registered sessions.send entry point, cached-send behavior, original task identity, combined child results, exactly one dispatch, delivered task status, and removal of both wake records. The shared fixture still waits for zero active Gateway roots during teardown.
Verified fake-timer dependency contract: The changed test directly uses vi.waitFor, and OpenClaw pins Vitest 5.0.0. That version's waitFor implementation defaults to a 50 ms interval and calls vi.advanceTimersByTime(interval) before each assertion attempt; interval zero therefore avoids advancing the future wake deadline. The tag resolves to the recorded dependency SHA.
Findings None None.
Security None None.

How this fits together

Gateway session messaging resumes paused child tasks, while the subagent registry schedules delivery of their combined results to the parent. These tests check that lifecycle and configure its isolation from other tests.

flowchart TD
  A[Session resume test] --> B[Isolated Gateway test process]
  B --> C[Session messaging handler]
  C --> D[Child registry and task state]
  D --> E[Scheduled parent wake]
  E --> F[Combined result delivery]
  F --> G[Completion and cleanup assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +75. Total +75 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 6 104 29 +75
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 104 29 +75

Review metrics

None.

Technical review

Best possible solution:

Keep lifecycle assertions synchronized to their actual state changes, preserve teardown leak detection, and reuse the existing isolated test lane.

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

Yes, source establishes the timing mechanism: default Vitest polls advance fake time while this test owns a future requester wake. The captured discussion reports CI failures; this review did not execute a reproduction.

Is this the best way to solve the issue?

Yes. The patch uses existing test isolation and observes lifecycle facts without relaxing delivery assertions, increasing timeouts, or changing production scheduling.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is bounded test and fixture stabilization 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 test synchronization and fixtures only; the external-contributor runtime-proof gate does not apply, and no production authority change triggers additional proof.

Evidence

What I checked:

  • Introduced scope and review continuity: The complete pinned introduction contains only tests, test support, and test routing. The GitHub comparison against the previous reviewed head confirms the latest commit only changes dependency-fixture idempotence and adds its regression test. Previous review context contains no outstanding findings. (test/scripts/pr-wrapper.test-support.ts:19, dadf57116c7b)
  • Specific lifecycle assertions preserve coverage: The full session-resume test retains the registered sessions.send entry point, cached-send behavior, original task identity, combined child results, exactly one dispatch, delivered task status, and removal of both wake records. The shared fixture still waits for zero active Gateway roots during teardown. (src/gateway/server-methods/sessions.send-yield-resume.test.ts:130, dadf57116c7b)
  • Verified fake-timer dependency contract: The changed test directly uses vi.waitFor, and OpenClaw pins Vitest 5.0.0. That version's waitFor implementation defaults to a 50 ms interval and calls vi.advanceTimersByTime(interval) before each assertion attempt; interval zero therefore avoids advancing the future wake deadline. The tag resolves to the recorded dependency SHA. (packages/vitest/src/integrations/wait.ts:73, f441c6fab25e)
  • Main and release necessity check: Fetched main still lacks this test in the isolated Gateway methods inventory and retains its global-quiescence body waits. The latest release tag has no sessions.send-yield-resume.test.ts. The supplied merged related PRs do not establish that this stabilization has landed. (test/vitest/vitest.gateway-server-paths.mjs:43, 4321816e2a76)
  • Fixture safety and meaningful regression coverage: Dependency refresh removes only named entries beneath fixture-owned node_modules directories and recreates links to the installed packages. The new test invokes preparation twice and checks canonical targets; existing alias tests retain argument, supervisor-handoff, and spoofed-anchor refusal assertions. (test/scripts/pr-wrapper.test-support.ts:26, dadf57116c7b)
  • Merged area history: Main history identifies prior work by Peter Steinberger on the yielded-task path and Vincent Koc on wrapper dependency preparation. GitHub commit patches corroborate those narrow source changes. Some older local blobs were unavailable, so deeper blame and follow-history inspection was incomplete; no causal introduction claim is made. (test/scripts/pr-wrapper.test-support.ts:22, 7450a11bd15c)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-16T01:06:49.999Z sha 872c7c5 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T01:39:19.841Z sha 7ce6880 :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Sep 16, 2026
@steipete

Copy link
Copy Markdown
Contributor

Main's duplicate alias initialization is now repaired at its caller by #149520 (83f948498fde0dd597b95455adc30c216072cb28), retaining one setup immediately before the recorder and the original helper contract.

At audited head dadf57116c7b7e81a41a148dd2004eaa4490cb92, this PR also adds fixture setup, changes the shared helper to recursive mkdir plus removal/recreation of dependency links, and adds repeated-setup coverage. Those changes are broader than the yielded-session fix and would hide the duplicate-ownership failure instead of keeping one setup owner. Please reconcile these incidental fixture/helper changes against the canonical caller repair before landing. If repeatable helper setup has a separate required contract, discuss and prove that scope independently; do not use it to absorb stale additive fixture hunks. Preserve the yielded-session work and its own proof.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
* test(gateway): stabilize yielded-session settlement

* test(pr): prepare dependencies for alias handoff fixtures (openclaw#149488)

* test(pr): refresh wrapper dependencies idempotently

---------

Co-authored-by: Peter Steinberger <[email protected]>
ruel225 added a commit to ruel225/openclaw that referenced this pull request Sep 16, 2026
 landed for prior shard failures)

Co-Authored-By: Claude <[email protected]>
steipete added a commit that referenced this pull request Sep 16, 2026
Carry the test-only correction from 2dd0ed9 (#149558). Preserve both idempotent alias setup calls and the yielded-session completion and zero-root cleanup contracts.

Adapt only the wrapper fixture hunks to the frozen metadata branch; runtime and dependency inputs remain unchanged.

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime maintainer Maintainer-authored PR 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.

3 participants