Skip to content

test(gateway): wait for both queued recovery inputs - #136473

Merged
vincentkoc merged 1 commit into
mainfrom
codex/perf4-recovery-queue-fixture
Sep 2, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
codex/perf4-recovery-queue-fixture

Conversation

@steipete

@steipete steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The startup-recovery WebChat test could advance before both browser turns reached the queue. An active source remains in items, so one item and one inFlight entry can refer to the same object. The intended two-source state could also fail the old one-item assertion.

Why This Change Was Made

Wait for the exact two ID/prompt pairs, one active source, one pending source through the existing queue helper, and the unchanged recovery-provider request count before releasing recovery. The same map supplies the submitted messages and expected queue contents. Production code, deadlines, cancellation, and survivor-once assertions are unchanged.

User Impact

This makes the existing recovery integration test verify its intended precondition and removes a race in CI. Production LOC is unchanged; test LOC is +8. No runtime performance or memory claim is made.

Evidence

The original Linux CI assertion failure is retained in the failed recovery test job. A fresh unchanged local Gateway run passed; a separate read-only identity capture showed that it advanced with just one unique source. The corrected canonical Gateway run and identity capture both passed with the two exact sources retained under the original recovery owner. This is a local reproduction of the premature barrier, not a claimed repeat of the Linux assertion failure.

The real ephemeral Gateway, authenticated WebSocket client, and embedded dispatch ran against a synthetic localhost Responses provider. All 15 queue-helper tests and the full changed gate passed. Independent managed Codex P0–P2 review completed with no findings. Owned processes joined and private runtime state was removed. Local proof used macOS/Node 26; no Windows execution, statistical flake-rate estimate, or real provider call is claimed.

node scripts/run-vitest.mjs src/gateway/server.startup-recovery-webchat.test.ts src/utils/queue-helpers.test.ts
node scripts/check-changed.mjs -- src/gateway/server.startup-recovery-webchat.test.ts

Reviewed test SHA-256: d19570aa26620198236b6f18a977add371b563b486beacacd4b533779a4e4c05.

@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review September 2, 2026 17:25
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 1:34 PM ET / 17:34 UTC.

ClawSweeper review

What this changes

The PR updates the Gateway startup-recovery WebChat integration test to wait for both submitted queue entries, including one active and one pending entry, before releasing recovery.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still uses the one-item recovery barrier, while this focused test-only patch verifies both queued browser inputs before recovery proceeds. The strengthened assertions match the queue’s documented active-item semantics; no introduced correctness or security defect was found.

Priority: P3
Reviewed head: d153770add0ed16e1d8f395b0098fde34e9739e4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-aligned integration-test repair with supplied production-boundary runtime evidence and no actionable review findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The changed owner is the startup-recovery Gateway integration path; the PR supplies an after-fix ephemeral-Gateway run using an authenticated WebSocket client and real dispatch boundary, reporting that both exact queued sources were retained before recovery release.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed owner is the startup-recovery Gateway integration path; the PR supplies an after-fix ephemeral-Gateway run using an authenticated WebSocket client and real dispatch boundary, reporting that both exact queued sources were retained before recovery release.
Evidence reviewed 6 items Introduced test barrier: The introduced assertions require two exact queued message ID/prompt pairs, one in-flight source, one pending source, and no second provider request before recovery is released.
Queue-state contract: Follow-up queues intentionally retain active deliveries in items, and the shared helper counts only items absent from inFlight; the new barrier matches that contract.
Gateway identity flow: Gateway chat handling assigns the client run ID to MessageSid, which is the queued message identity used by the new exact-pair assertion.
Findings None None.
Security None None.

How this fits together

WebChat requests enter the Gateway’s follow-up queue while startup recovery holds the session’s work admission. The queue retains active deliveries in its item list, and recovery resumes processing once the replacement owner releases the barrier.

flowchart LR
  A[WebChat requests] --> B[Gateway chat handling]
  B --> C[Follow-up queue]
  C --> D[Startup recovery barrier]
  D --> E[Replacement session owner]
  E --> F[Queued survivor executes]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +8. Total +8 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 13 5 +8
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 13 5 +8

Review metrics

Metric Value Why it matters
Production vs. test LOC production +0; tests +8 net (13 added, 5 removed) The patch is confined to one existing integration test and does not alter Gateway runtime behavior.

Technical review

Best possible solution:

Merge the focused test repair after normal exact-head CI, retaining the queue’s canonical active-versus-pending accounting rather than restoring the one-item proxy assertion.

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

Yes: the supplied CI failure and current-main one-item barrier align with the queue contract showing that an active source remains in items; the reviewer did not execute the test because this review checkout is read-only.

Is this the best way to solve the issue?

Yes: asserting the two submitted identities plus separate active and pending counts directly protects the intended recovery precondition without changing production behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8c60cc9d2ca9.

Labels

Label changes:

  • add P3: This is a narrow CI-test reliability improvement without a production behavior change.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The changed owner is the startup-recovery Gateway integration path; the PR supplies an after-fix ephemeral-Gateway run using an authenticated WebSocket client and real dispatch boundary, reporting that both exact queued sources were retained before recovery release.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The changed owner is the startup-recovery Gateway integration path; the PR supplies an after-fix ephemeral-Gateway run using an authenticated WebSocket client and real dispatch boundary, reporting that both exact queued sources were retained before recovery release.

Label justifications:

  • P3: This is a narrow CI-test reliability improvement without a production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The changed owner is the startup-recovery Gateway integration path; the PR supplies an after-fix ephemeral-Gateway run using an authenticated WebSocket client and real dispatch boundary, reporting that both exact queued sources were retained before recovery release.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed owner is the startup-recovery Gateway integration path; the PR supplies an after-fix ephemeral-Gateway run using an authenticated WebSocket client and real dispatch boundary, reporting that both exact queued sources were retained before recovery release.

Evidence

What I checked:

Likely related people:

  • Jesse Merhi: Raw commit f2b77cb adds src/gateway/server.startup-recovery-webchat.test.ts:204 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f2b77cb1ff7e; files: src/gateway/server.startup-recovery-webchat.test.ts)
  • steipete: 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS maintainer Maintainer-authored PR labels Sep 2, 2026
@vincentkoc vincentkoc self-assigned this Sep 2, 2026
@vincentkoc
vincentkoc merged commit 564e544 into main Sep 2, 2026
228 of 238 checks passed
@vincentkoc
vincentkoc deleted the codex/perf4-recovery-queue-fixture branch September 2, 2026 18:55
steipete added a commit that referenced this pull request Sep 2, 2026
Keep the stronger queue identity and pending-depth assertions from #136473.
The remaining CI optimization and shared test fixes are unchanged.
steipete added a commit that referenced this pull request Sep 2, 2026
Reuse the gateway CLI fixture cleanup from #136469 (667ce2b) and
the landed startup-recovery queue assertions from #136473 (564e544).
These address independent lint and shared-worker test failures while
preserving all process, state, cancellation, and survivor assertions.

Keep Vincent Koc's scanner implementation and original PR ancestry unchanged.
The new commit also refreshes pull-request CI against main's authenticated
checkout repair from #136178.
steipete added a commit that referenced this pull request Sep 2, 2026
Remove the temporary copies of the CLI fixture and startup queue test fixes.
Main now owns the CLI suite split in aef65cc and queue assertions in #136473.
Keeping the earlier fixture cleanup here conflicts with main's new shared
test support and health suite.

Restore the cumulative PR tree exactly to Vincent Koc's reviewed 4a35cef
without replacing his ancestry. The merge then retains main's canonical
test repairs and authenticated checkout fix from #136178.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 3, 2026
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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