Skip to content

test(gateway): keep display-consumer test support out of the prod type program - #178306

Merged
steipete merged 1 commit into
mainfrom
upd/upd-l1721
Oct 20, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-l1721

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Restores the production typecheck after the recovered-reply display tests pulled browser-only types into the Node production program.

Refs a2332ca.

User Impact

No runtime behavior changes. Production typechecking works again, and the real-Gateway tests retain their display-consumer assertions.

Why This Change Was Made

tsconfig.core.json includes src/**/* and does not exclude *.test-support.ts. The new Gateway replay helper imported Control UI consumers from that included source tree, reintroducing browser globals and TSX into the DOM-free core program.

Move the helper to the existing test/helpers/gateway/ boundary, which the production config already excludes, and update both callers. Its replay logic and every assertion remain unchanged. No compiler settings or production code change.

Production LOC: +0/-0. Test-only diff: +13/-7 across three files, including relocation of the 36-line helper; only import paths and their formatting change.

Evidence

  • Before: the core production command failed with 809 diagnostics, including TS2304: Cannot find name 'HTMLElement' in src/plugin-sdk/control-ui-components.ts and browser/TSX errors from the UI import graph. After: the same command exits 0.
  • The complete pnpm tsgo:prod lane passes: core, UI, and extensions.
  • Both affected real-Gateway files pass on Node 26.12.0 and the repository's pinned Bun fork: 2 files, 6 tests passed on each runtime, exit 0. These tests start isolated Gateways and synthetic loopback HTTP providers, exercise actual chat.send, persistence, publication, recovery, and display replay, and clean up their own processes. The runner starts with isolated HOME and OPENCLAW_STATE_DIR.
  • Focused test-import-graph typecheck, targeted oxlint, oxfmt, git diff --check, and madge all pass. Madge reports 0 cycles. Independent Codex P0–P2 review is clean.
  • Full check:changed was not run under the campaign's local gate budget; its slow SQLite inventory was skipped. The explicit production lane and targeted checks above were run instead; PR CI provides broad proof.

Commands for the reproduced failure and passing proof (all runtime/test commands used isolated state):

node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo
pnpm tsgo:prod
OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/gateway/server.chat-recovered-output.test.ts src/gateway/server.xai-fallback.test.ts --maxWorkers=1
OPENCLAW_VITEST_RUNTIME=bun node scripts/run-vitest.mjs src/gateway/server.chat-recovered-output.test.ts src/gateway/server.xai-fallback.test.ts --maxWorkers=1

Timing: Node's Vitest duration was 132.50 s (runner wall time 227.98 s, including a 69.2 s source-runtime build); Bun's was 147.49 s (runner wall time 175.17 s). The existing 16-scenario xAI test took 67.887 s on Node and 66.907 s on Bun. It already shares one real Gateway across sequential rejection/recovery cases; cold Gateway initialization and actual provider retry paths contribute to that cost. No timeout, retry, assertion, or coverage changes were made. Compiler preparation took 25.962 s on Node and 23.156 s on Bun. No flaky failures or reruns were encountered.

…e program

Move the replay helper under test/helpers/gateway so its Control UI imports stay outside the Node production type program. Preserve both real-Gateway tests and all display assertions.

Refs a2332ca.
@clawsweeper

clawsweeper Bot commented Oct 20, 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.

@steipete
steipete marked this pull request as ready for review October 20, 2026 09:22
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T09:24:52.724809Z 30d4c2d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS labels Oct 20, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR moves the Gateway display-replay helper into test/helpers/gateway and updates its two test callers.

Example: A developer runs pnpm tsgo:prod after the display-consumer tests were added.

  • Before: The included src/gateway helper pulls browser types into the DOM-free core program, producing errors such as Cannot find name 'HTMLElement'.
  • After: The helper resides outside the production program, and the reviewed head passes check-prod-types.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct boundary repair supported by exact-head compiler checks and reported Gateway replays, with no introduced defects found.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored test-support relocation changes no shipped behavior; exact-head production typechecking passes, and the body reports both unchanged Gateway suites passing on Node and pinned Bun.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Maintenance · Worth it: Yes · Fix scope: Complete
User problem: Contributors cannot complete production typechecking because test-only browser imports enter the Node compiler program.
Reason: The maintainer-authored repair restores an explicit compiler boundary while preserving the existing recovery tests and all runtime behavior.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR fixes the production type-program boundary with a minimal relocation, preserves existing coverage, and has no actionable findings; broad CI remains pending.

Priority: P2
Reviewed head: 30d4c2d4f8707eca422dc9fc3179f535ab8c7125

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway integration tests collect chat and session.message frames and replay them through existing Control UI consumers to compare displayed replies with persisted history.

flowchart LR
A[Gateway integration tests] --> B[Chat and session message frames]
B --> C[Shared test replay helper]
C --> D[Existing Control UI consumers]
D --> E[Display and history assertions]
F[Core production type program] --> G[Node production sources]
Loading

Technical review

Best possible solution:

Keep the unchanged replay helper at the existing shared-test boundary without weakening compiler settings or removing display assertions.

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

The included helper's UI imports and DOM-free compiler configuration establish the failure path, corroborated by the reported baseline diagnostics; this read-only review ran no target code.

Is this the best way to solve the issue?

The relocation is the smallest complete fix: it uses the existing excluded test directory, migrates every reference, and preserves compiler strictness and consumer coverage.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Gateway display-consumer replay coverage keeps the original intent (a2332ca: Replay actual Gateway frames through existing UI consumers to verify that terminal handoff clears live state and displayed assistant messages match persisted history.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Minimal complete cutover: The introduced diff only relocates the helper, adjusts its relative imports, and updates both callers; replay logic and assertions remain unchanged. (test/helpers/gateway/chat-display-replay.ts:1, 30d4c2d4f870)
  • Existing production boundary: Core includes src//* with ES2023 libraries, excludes test/ and test files, and does not exclude *.test-support.ts; fetched main still contains the original UI-importing helper. (tsconfig.core.json:11, 6a2e9a1f9ea0)
  • Original display-consumer intent preserved: Commit a2332ca added replay through existing UI consumers to verify terminal handoff and persisted display agreement; this PR preserves that purpose. (src/gateway/chat-display-replay.test-support.ts:3, a2332caed768)
  • Exact-head compiler validation: The reviewed head has successful check-prod-types, test-type, and lint checks. PostgreSQL conformance remains in progress and openclaw/ci-gate remains pending; no diff-caused failing check was observed. (30d4c2d4f870)
  • Independent report of inherited failure: The discussion in fix(config): return actionable errors for retired settings #178289 reports the same browser-type import failure on clean main and identifies the included replay helper as its cause; that PR changes config diagnostics rather than owning this relocation.

Likely related people:

  • Peter Steinberger: Raw commit a2332ca adds src/gateway/server.chat-recovered-output.test.ts:32 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a2332caed768; files: src/gateway/server.chat-recovered-output.test.ts)
  • Ayaan Zaidi: Raw commit 08c998f adds src/gateway/server.chat-recovered-output.test.ts:21 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 08c998f90b26; files: src/gateway/server.chat-recovered-output.test.ts)
  • RileyJJY: Raw commit 6a7b1e4 adds src/gateway/server.xai-fallback.test.ts:15 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 6a7b1e41d281; files: src/gateway/server.xai-fallback.test.ts)

PR surface

Tests +6. Total +6 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 13 7 +6
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 13 7 +6

Labels

Label changes:

  • add P2: Restores production typechecking after a test-support import regression without changing shipped runtime behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Restores production typechecking after a test-support import regression without changing shipped runtime behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 20, 2026, 5:37 AM ET / 09:37 UTC.

@steipete
steipete merged commit 8ebf027 into main Oct 20, 2026
198 checks passed
@steipete
steipete deleted the upd/upd-l1721 branch October 20, 2026 09:48
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
…e program (openclaw#178306)

Fixes main check-prod-types red since 6b28ddf: the Gateway display-consumer test helper lived under src/ and pulled Control UI DOM types into the production tsgo program (809 diagnostics). Moved it to test/helpers/gateway/ and updated both callers; logic and assertions unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime 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