Skip to content

fix(test): prevent premature startup authentication test failures - #155006

Merged
steipete merged 2 commits into
mainfrom
codex/ws-startup-response-owner
Sep 21, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/ws-startup-response-owner

Conversation

@steipete

@steipete steipete commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes timing-dependent startup WebSocket authentication tests that confuse response arrival with completion of the handshake's durable bookkeeping.

User Impact

No production or user-visible behavior changes. The tests retain their authentication, startup-error opacity, rate-limit, isolation, case-order, and admission-lifetime assertions.

Why This Change Was Made

Use the fixture's existing exact-response promise instead of its second polling/search path. For successful bootstrap cases, separately await the existing device.pair.setup.completed event and verify its setup and device identities before reading the database or closing the socket. That event is published only after confirmation commits; receiving hello-ok is an earlier boundary. The separate admission-release wait and existing test and handshake deadlines remain unchanged. This removes four net test lines.

Bootstrap verification now crosses an asynchronous SQLite worker boundary. The invalid-credential cases do not initialize that worker during token-issuance setup, unlike their successful siblings. That is a source-backed explanation for the exposed polling assumption, not a phase-measured attribution of the CI delay.

Evidence

  • Original main CI35620978947 failed both invalid-bootstrap cases in the response poll before reaching their authentication assertions.
  • First candidate CI35627093499 ran all 16 cases in the same order. Both original failures passed (480/524ms), but five retry cases exposed the separate post-response confirmation race: expected confirmed, observed uncertain. The final change waits for the canonical completion event before those unchanged durable assertions.
  • Formatting, targeted core lint, and git diff --check passed. Independent P0–P2 review of the final staged candidate found no actionable findings. An earlier review identified an additional early-close case; it now awaits the same committed-completion event.
  • Testbox qualification failed during source synchronization, before its candidate payload or tests ran (exit124). Its targeted-sync fallback hit the unchanged five-minute guard. The lease was stopped and local consumers joined; this attempt supplies no candidate test or timing result.
  • Final head 307e85efeea passed all 16 startup cases in their original order in CI35629040233, job checks-node-changed-compact-large-14. File duration was 38.44s including transforms; individual case durations total 7.36s. Both original failures and all five confirmation-race cases passed. The complete CI run, including openclaw/ci-gate, passed in 15m55s; startup-corpus validation (592s) owned its critical tail. This does not establish the eight-minute overall goal.
  • The unchanged lazy-handler load-failure sibling was not selected or rerun; its code and fixture are outside this private-helper change.

The separate iOS scope workflow initially failed before checkout because GitHub action-download metadata timed out three times. One failed-job-only retry on the unchanged final head passed in 39s; the unaffected iOS scan was skipped. No source or timeout changes accompanied that infrastructure retry.

@clawsweeper

clawsweeper Bot commented Sep 21, 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 the gateway Gateway runtime label Sep 21, 2026
@steipete
steipete marked this pull request as ready for review September 21, 2026 16:40
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 21, 2026
@steipete
steipete marked this pull request as draft September 21, 2026 16:46
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 21, 2026, 1:05 PM ET / 17:05 UTC (Revision 3).

ClawSweeper review

What this changes

The startup WebSocket tests await their existing response promise and committed setup-completion event before checking persistence or closing successful bootstrap connections.

Merge readiness

⛔ Needs changes before merge - 1 item remains

The prior confirmation-race finding is resolved, and no new actionable defect was found. Current main still contains the original polling helper, so this focused repair remains useful.

Priority: P2
Reviewed head: 307e85efeea208888720f3fa32bf8e9e8af8befc

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair resolves the prior finding without weakening coverage; the PR evidence still needs its final suite result and measured runtime recorded.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored test-only repair is exempt from contributor live-setup proof; no production authority changes trigger additional proof. Existing CI evidence exercises the startup-test boundary, with detailed log inspection limited by the review network.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored test-only repair is exempt from contributor live-setup proof; no production authority changes trigger additional proof. Existing CI evidence exercises the startup-test boundary, with detailed log inspection limited by the review network.
Evidence reviewed 7 items Introduced scope: The pinned merge-base-to-head diff changes only the startup test's private synchronization helper and its callers; production authentication, persistence, deadlines, and assertions remain intact.
Previous finding resolved: The latest commit adds completion-event waits before all five successful retry persistence checks and before the initial successful bootstrap socket closes. Each wait checks setup and device identity. GitHub's commit patch verified the change against the previously reviewed parent after its local blob was unavailable.
Completion ordering: The production hello handler awaits response delivery, then awaits durable confirmation, then broadcasts completion. The broadcast helper emits device.pair.setup.completed only for confirmed state, making the new wait appropriate for the unchanged persistence assertions.
Findings None None.
Security None None.

How this fits together

Gateway startup tests simulate node connections while startup admission is restricted. They verify authentication responses, durable pairing completion, and release of tracked handshake work.

flowchart TD
  A[Simulated node connection] --> B[Startup admission and authentication]
  B --> C[Connection response]
  C --> D[Durable setup confirmation]
  D --> E[Setup completion event]
  E --> F[Persistence assertions and socket cleanup]
  B --> G[Admission lifetime assertions]
Loading

Before merge

  • Complete next step (P2) - Update the PR Evidence section with the final 16-case startup suite result in its original order and measured file runtime, preserving any execution limitations.
Agent review details

Security

None.

PR surface

Tests -4. Total -4 across 1 file.

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

Review metrics

None.

Technical review

Best possible solution:

Keep response delivery, durable setup completion, and admission release as separate synchronization boundaries while preserving the existing behavioral assertions.

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

Yes, the source identifies the timing mechanism: response delivery precedes durable confirmation, while current main polls responses with an incidental deadline. The captured CI failures support that mechanism; this review did not execute tests.

Is this the best way to solve the issue?

Yes. Reusing the exact-response promise and the existing committed-completion event removes the premature assertions without increasing deadlines or weakening authentication coverage.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • 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 maintainer-authored test-only repair is exempt from contributor live-setup proof; no production authority changes trigger additional proof. Existing CI evidence exercises the startup-test boundary, with detailed log inspection limited by the review network.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 automation: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This repairs a concrete startup-test synchronization defect with a limited, test-only scope.
  • 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 maintainer-authored test-only repair is exempt from contributor live-setup proof; no production authority changes trigger additional proof. Existing CI evidence exercises the startup-test boundary, with detailed log inspection limited by the review network.

Evidence

What I checked:

  • Introduced scope: The pinned merge-base-to-head diff changes only the startup test's private synchronization helper and its callers; production authentication, persistence, deadlines, and assertions remain intact. (src/gateway/server/ws-connection.startup.test.ts:87, 307e85efeea2)
  • Previous finding resolved: The latest commit adds completion-event waits before all five successful retry persistence checks and before the initial successful bootstrap socket closes. Each wait checks setup and device identity. GitHub's commit patch verified the change against the previously reviewed parent after its local blob was unavailable. (src/gateway/server/ws-connection.startup.test.ts:552, 307e85efeea2)
  • Completion ordering: The production hello handler awaits response delivery, then awaits durable confirmation, then broadcasts completion. The broadcast helper emits device.pair.setup.completed only for confirmed state, making the new wait appropriate for the unchanged persistence assertions. (src/gateway/server/ws-connection/connect-hello.ts:306, 307e85efeea2)
  • Still needed on current main: The startup test has identical blob fd27f1323f7689c48b36b54e6e23b288eac3aafc at the merge base and fetched main. Main therefore retains the response poll and lacks this completion wait. No verified merged replacement was established; release inclusion is not claimed. (src/gateway/server/ws-connection.startup.test.ts:215, 3df982d2c345)
  • Current-head CI evidence: GitHub reports checks-node-changed-compact-large-14 successful for the exact reviewed head; its Run Node test shard step took 42 seconds. The log download redirected to a host blocked by the review environment, so individual case results and file runtime were not independently inspected. This is a reviewer limitation, not missing contributor runtime proof. (307e85efeea2)
  • Validation context and remaining documentation: The captured PR body records original polling failures, successful invalid-credential cases on the first candidate, and the subsequently repaired confirmation race. It explicitly records the failed Testbox synchronization attempt and pending final suite evidence. Root and Gateway guidance request measured test cost; the prior review also requested the complete original-order suite result and runtime. No tests were executed in this read-only review. (src/gateway/AGENTS.md, 307e85efeea2)

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)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record the final original-order startup suite result and measured file runtime in the PR Evidence section.

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-21T16:48:22.352Z sha 2f8d694 :: needs changes before merge. :: [P2] Wait for setup confirmation before reading its persisted state
  • reviewed 2026-09-21T16:55:56.311Z sha 2f8d694 :: blocked before merge. :: [P2] Wait for setup confirmation before reading its persisted state

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 21, 2026
@steipete
steipete marked this pull request as ready for review September 21, 2026 16:58
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 21, 2026
@steipete
steipete merged commit f804111 into main Sep 21, 2026
174 of 177 checks passed
@steipete
steipete deleted the codex/ws-startup-response-owner branch September 21, 2026 17:35
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

roboclaw-bot added a commit that referenced this pull request Sep 21, 2026
Move only the suspended-exhaustion scenario into the existing broker-backed
admission suite. Observe the real reconciliation attempt and stop it while
admission remains suspended; preserve durable state and dispatch assertions.
Wait for actual approval publication and task-lane completion in the hosted
lifecycle fixture instead of polling worker-backed state.

Keep the startup fix landed in #155006. Leave the exec/plugin agent-runtime
cases to active #154977 and the two other exhaustion cases to #155007.
This narrows our bot-owned repair without modifying those owners' PRs.
No production changes, deadline increases, retries, or guard weakening.

Final three-file proof: 231 tests pass in109.01s; full changed checks pass.
Fresh canonical Codex autoreview through P3 is scoped-clean. The original
suspended-case failure was reproduced with controlled worker lookup delay;
prior admission proof includes20 repeated suite runs. Temporary delay
instrumentation is not retained. Earlier broader-head CI is historical only.

Co-authored-by: VACInc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
…enclaw#155006)

* test(gateway): await startup connect responses

* test(gateway): await committed setup confirmation
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: 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.

1 participant