Skip to content

improve(tests): avoid WebSocket retry delays in native finalizer fixtures - #155008

Merged
steipete merged 1 commit into
mainfrom
codex/test-codex-native-sse-fallback
Sep 21, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-codex-native-sse-fallback

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Native Codex finalizer tests repeatedly retry WebSocket upgrades against a fixture that serves only HTTP/SSE, adding more than a minute per file run.

User Impact

There is no user-visible behavior change. The same nine native-process cases run faster, with authentication, shell execution, deadlines, finalization, and cleanup coverage retained. Peak RSS increased 2.41%; this is not a memory optimization.

Why This Change Was Made

Return HTTP 426 for GET /v1/responses so the stock client selects its supported HTTP fallback immediately. The existing authenticated POST/SSE path is unchanged. A real native route trace shows the baseline made seven GET requests returning 404 before POST succeeded; the candidate made one GET returning 426 followed by the same successful POST.

Evidence

Crabbox / Blacksmith Testbox run 35602882438, pinned main 5b71ab4fc0d8, passed all nine cases in every canonical full-file ABBA arm:

Run Command time
Baseline A1 147.794s
Candidate B1 28.201s
Candidate B2 26.977s
Baseline A2 133.728s

The warm baseline versus candidate mean is 133.728s to 27.589s: about 106seconds (79.4%) saved. A1 retains its colder startup cost. All 231 native/owner siblings passed, including thread recovery and output fidelity; selected changed checks (530.364s), formatting, and independent P2 review passed. Downloaded source hashes match the candidate, and the lease is stopped. An initial proof driver stopped before testing because it treated the materialized candidate HEAD as baseline; the corrected driver separately verifies exact baseline/candidate hashes. Hosted PR CI remains required before landing.

@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 1:20 PM ET / 17:20 UTC (Revision 2).

ClawSweeper review

What this changes

The native finalization test server returns HTTP 426 for WebSocket attempts so Codex reaches its HTTP event-stream fixture without retry delays.

Merge readiness

✅ Ready for maintainer review

The fixture optimization remains useful on current main. The introduced change matches Codex’s existing fallback contract, preserves the test assertions, and has no identified correctness or security blocker.

Priority: P3
Reviewed head: 3d51f3a14797af6ccbe64d02fe1cbc5d48dbab1c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused fixture correction supported by native transport observations and measured test savings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured Testbox observations exercise the real native client against the changed local fixture: repeated GET/404 retries become one GET/426 followed by successful authenticated POST, with all nine finalization cases passing. Raw linked logs could not be independently retrieved because of reviewer network restrictions.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured Testbox observations exercise the real native client against the changed local fixture: repeated GET/404 retries become one GET/426 followed by successful authenticated POST, with all nine finalization cases passing. Raw linked logs could not be independently retrieved because of reviewer network restrictions.
Evidence reviewed 7 items Pinned introduced change: The merge-base-to-head patch adds only the GET response branch. The authenticated POST handling, scripted events, cleanup, and consuming test assertions remain unchanged.
Still necessary on main: Fetched main still responds with 404 to GET /v1/responses. The fixture path does not exist in the supplied latest release, v2026.9.5; no shipped implementation of this fixture optimization was established.
Affirmative dependency contract: The fixture launches the installed @openai/codex native process, and the PR explicitly relies on its HTTP fallback behavior. This establishes the need for direct Codex source inspection.
Findings None None.
Security None None.

How this fits together

These tests run the real Codex process against a local scripted provider to exercise OpenClaw’s finalization, authentication, cancellation, and cleanup behavior. The changed response controls transport selection before the existing authenticated requests reach that provider.

flowchart LR
  A[Native finalization tests] --> B[Real Codex process]
  B --> C[Local provider fixture]
  C --> D[WebSocket attempt receives 426]
  D --> E[Authenticated HTTP request]
  E --> F[Scripted event stream]
  F --> G[Finalization and cleanup assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +5. Total +5 across 1 file.

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

Review metrics

Metric Value Why it matters
Reported native test runtime 133.728s warm baseline → 27.589s candidate mean; 79.4% reduction The supplied measurements show a substantial recurring test-cost reduction while retaining all nine cases.

Technical review

Best possible solution:

Keep the fixture aligned with Codex’s supported HTTP fallback while retaining the existing native-process coverage.

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

Not applicable as a product bug; source inspection confirms the fixture’s unnecessary retry path, and the supplied native-run observations quantify it.

Is this the best way to solve the issue?

Yes. Returning the dependency’s existing fallback signal is a narrow fixture correction that preserves stock-client selection and the authenticated HTTP path.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a bounded test-runtime improvement with no changed user-facing behavior.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured Testbox observations exercise the real native client against the changed local fixture: repeated GET/404 retries become one GET/426 followed by successful authenticated POST, with all nine finalization cases passing. Raw linked logs could not be independently retrieved because of reviewer network restrictions.
  • 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 (live_output): The captured Testbox observations exercise the real native client against the changed local fixture: repeated GET/404 retries become one GET/426 followed by successful authenticated POST, with all nine finalization cases passing. Raw linked logs could not be independently retrieved because of reviewer network restrictions.

Label justifications:

  • P3: This is a bounded test-runtime improvement with no changed user-facing behavior.
  • 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 (live_output): The captured Testbox observations exercise the real native client against the changed local fixture: repeated GET/404 retries become one GET/426 followed by successful authenticated POST, with all nine finalization cases passing. Raw linked logs could not be independently retrieved because of reviewer network restrictions.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured Testbox observations exercise the real native client against the changed local fixture: repeated GET/404 retries become one GET/426 followed by successful authenticated POST, with all nine finalization cases passing. Raw linked logs could not be independently retrieved because of reviewer network restrictions.

Evidence

What I checked:

  • Pinned introduced change: The merge-base-to-head patch adds only the GET response branch. The authenticated POST handling, scripted events, cleanup, and consuming test assertions remain unchanged. (extensions/codex/src/test-support/settled-turn-finalizer.native.ts:62, 3d51f3a14797)
  • Still necessary on main: Fetched main still responds with 404 to GET /v1/responses. The fixture path does not exist in the supplied latest release, v2026.9.5; no shipped implementation of this fixture optimization was established. (extensions/codex/src/test-support/settled-turn-finalizer.native.ts:62, e3c65f7de2ff)
  • Affirmative dependency contract: The fixture launches the installed @openai/codex native process, and the PR explicitly relies on its HTTP fallback behavior. This establishes the need for direct Codex source inspection. (extensions/codex/src/app-server/native-app-server.test-support.ts:15, 3d51f3a14797)
  • Native client fallback verified: Direct inspection shows UPGRADE_REQUIRED returns FallbackToHttp. The dependency’s websocket fallback test independently asserts one GET followed by one POST for a 426 response. Repository ownership was verified through the backing Git cache’s origin URL. (codex-rs/core/src/client.rs:1809, 6b9826e3aa83)
  • Native execution evidence: The captured PR body reports seven GET/404 attempts before successful POST on baseline versus one GET/426 followed by successful POST on candidate. Its Testbox ABBA runs passed all nine cases, with candidate times of 28.201s and 26.977s, and reports 231 passing sibling cases. The source snapshot identity is 157a8f4d87b180f1bca6f4c84ae821c313c2b99bd3e89479ce5ef9af36f1ef76. The linked lease run is marked cancelled; raw job-log retrieval was blocked by the reviewer’s network allowlist, so those logs were not independently inspected. (3d51f3a14797)
  • Fixture history and routing: Current-main history attributes the fixture extraction to Peter Steinberger. Inspection against the commit’s raw recorded parent confirms the fixture file was added there; this supports routing without attributing the underlying behavior’s original introduction. (extensions/codex/src/test-support/settled-turn-finalizer.native.ts:54, 4e52d0d82c49)

Likely related people:

  • Peter Steinberger: Raw commit 4e52d0d adds extensions/codex/src/test-support/settled-turn-finalizer.native.ts:54 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4e52d0d82c49; files: extensions/codex/src/test-support/settled-turn-finalizer.native.ts)

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 (1 earlier review cycle)
  • reviewed 2026-09-21T16:51:38.878Z sha 3d51f3a :: needs maintainer review before merge. :: none

@steipete
steipete marked this pull request as ready for review September 21, 2026 17:16
@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.

@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 21, 2026
@steipete
steipete merged commit 7eb1fa8 into main Sep 21, 2026
165 checks passed
@steipete
steipete deleted the codex/test-codex-native-sse-fallback branch September 21, 2026 18:11
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 21, 2026
* commit '8a26ae487b5fb9b72ea2c12bf384e9c776659429': (154 commits)
  fix(ui): preserve skill group expansion when filtering (#150911)
  test(gateway): consolidate server history and lifecycle fixtures (#155063)
  test(codex): select HTTP fallback in native finalizer fixtures (#155008)
  improve: reduce isolated Gateway CI test time (#154366)
  test(gateway): await approval registration acknowledgments
  fix(workboard): explain blocked-card claim recovery (#154990)
  perf(agents): consolidate exec target policy tests (#155060)
  perf(config): consolidate environment test fixtures (#155062)
  fix(ui): keep the chat rail anchored through composer resize
  fix: recovery tests wait for committed outcomes (#154995)
  fix(codex): keep inference bursts from failing turns (#154945)
  fix(memory): keep generated REM reflections out of promotion rankings (#154994)
  fix(sqlite): reclaim scratch files when storage is full (#154937)
  test(cli): spawn the compiled Doctor entry in the output process test (#155055)
  fix(update): distinguish config validation execution failures (#154892)
  test(doctor): await session cleanup before deleting fixture state
  fix(update): report unavailable service inspection accurately (#154896)
  test(gateway): observe plugin approval response completion
  perf(msteams): reduce file-consent test scaffolding (#155050)
  fix(ui): retain saved permissions during delayed startup reads (#154982)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: codex 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.

1 participant