Skip to content

Tests: align pnpm test expectations with main#67001

Merged
hxy91819 merged 6 commits into
openclaw:mainfrom
hxy91819:fix/tests-pnpm-main-alignment
Apr 15, 2026
Merged

Tests: align pnpm test expectations with main#67001
hxy91819 merged 6 commits into
openclaw:mainfrom
hxy91819:fix/tests-pnpm-main-alignment

Conversation

@hxy91819

Copy link
Copy Markdown
Member

Summary

  • make test-only expectations match current upstream/main behavior for gateway timezone fallback, plugin install blocking, and sudo fallback messaging
  • pass an explicit empty config in the coding tools schema test so host config does not leak into assertions
  • cover CLI startup metadata through the source-render fallback path when no built root-help bundle exists

Testing

  • OPENCLAW_LOCAL_CHECK=0 pnpm test src/gateway/server-methods/server-methods.test.ts
  • OPENCLAW_LOCAL_CHECK=0 pnpm test src/plugins/install.test.ts
  • OPENCLAW_LOCAL_CHECK=0 pnpm test src/agents/skills-install-fallback.test.ts
  • OPENCLAW_LOCAL_CHECK=0 pnpm test src/agents/pi-tools.create-openclaw-coding-tools.adds-claude-style-aliases-schemas-without-dropping-b.test.ts
  • OPENCLAW_LOCAL_CHECK=0 pnpm test test/scripts/write-cli-startup-metadata.test.ts
  • OPENCLAW_LOCAL_CHECK=0 pnpm run test

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling channel: qa-channel Channel integration: qa-channel extensions: qa-lab size: S maintainer Maintainer-authored PR labels Apr 15, 2026
@greptile-apps

greptile-apps Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR aligns test expectations with current main behavior across five test files and extends the qa-lab/qa-channel infrastructure to use cursor-based long polling and Node.js http/https (instead of fetch) so test servers can shut down cleanly.

The non-test changes are confined to qa-lab and qa-channel extensions: bus-waiters.ts adds a CursorWaiter abstraction, bus-server.ts switches to waitForCursorAdvance, and bus-client.ts replaces the Fetch API with raw Node.js HTTP for postJson. The multipass.runtime.ts refactor is a cosmetic clarity improvement.

Confidence Score: 5/5

Safe to merge; all remaining finding is a P2 robustness suggestion in test infrastructure.

All changes are either straightforward test expectation alignments or confined to qa-channel/qa-lab test infrastructure. The one substantive code change (bus-client.ts http rewrite) is correctly structured except for an unguarded JSON.parse in an event callback — a P2 that would produce an unhandled exception rather than a clean rejection on malformed responses. No production logic is affected.

extensions/qa-channel/src/bus-client.ts — the end handler's JSON.parse should be wrapped in a try/catch to ensure the promise rejects rather than hanging on invalid JSON.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/qa-channel/src/bus-client.ts
Line: 70-80

Comment:
**JSON.parse can silently hang the promise**

`JSON.parse(text)` on line 72 is called inside a Node.js `EventEmitter` callback (`response.on("end", ...)`), not inside the `Promise` executor. If the bus server ever returns a non-JSON body (e.g. on an unexpected error), the `SyntaxError` propagates as an uncaught exception rather than calling `reject`, leaving the promise unsettled until the test's own timeout fires.

```suggestion
        response.on("end", () => {
          const text = Buffer.concat(chunks).toString("utf8");
          let parsed: T | { error?: string };
          try {
            parsed = text ? (JSON.parse(text) as T | { error?: string }) : ({} as T);
          } catch (err) {
            reject(err instanceof Error ? err : new Error(String(err)));
            return;
          }
          if ((response.statusCode ?? 500) < 200 || (response.statusCode ?? 500) >= 300) {
            const error =
              typeof parsed === "object" && parsed && "error" in parsed ? parsed.error : undefined;
            reject(new Error(error || `qa-bus request failed: ${response.statusCode ?? 500}`));
            return;
          }
          resolve(parsed as T);
        });
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "Tests: align pnpm test expectations with..." | Re-trigger Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1bddaad42d

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread extensions/qa-channel/src/bus-client.ts Outdated
Comment thread extensions/qa-channel/src/bus-client.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e00f912d14

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread extensions/qa-lab/src/bus-server.ts Outdated
Comment thread extensions/qa-channel/src/bus-client.ts Outdated
@hxy91819

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@hxy91819 hxy91819 force-pushed the fix/tests-pnpm-main-alignment branch from 896d81b to b1ae3bf Compare April 15, 2026 10:26
@hxy91819 hxy91819 force-pushed the fix/tests-pnpm-main-alignment branch from b77dc41 to 29c8068 Compare April 15, 2026 10:30
@hxy91819 hxy91819 merged commit edfa074 into openclaw:main Apr 15, 2026
9 checks passed
@hxy91819

Copy link
Copy Markdown
Member Author

Merged via squash.

Thanks @hxy91819!

@hxy91819 hxy91819 deleted the fix/tests-pnpm-main-alignment branch April 15, 2026 10:31

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 29c8068053

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const text = Buffer.concat(chunks).toString("utf8");
let parsed: T | { error?: string };
try {
parsed = text ? (JSON.parse(text) as T | { error?: string }) : ({} as T);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat empty QA bus responses as parse errors

postJson currently parses "" as {} (text ? JSON.parse(text) : ({} as T)), so a 200 response with an empty body is treated as success. In that scenario, callers like pollQaBus can receive missing fields (cursor/events), which can then replay old events or fail later in unrelated code instead of surfacing a clear transport/parse failure at the boundary. This is a regression from the previous response.json() behavior, which rejected empty JSON payloads.

Useful? React with 👍 / 👎.

kind: "event-kind",
eventKind: "inbound-message",
timeoutMs,
await params.state.waitForCursorAdvance(input.cursor ?? 0, timeoutMs, (snapshot) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clamp long-poll wait cursor when client cursor is ahead

The long-poll waiter uses input.cursor ?? 0 directly, but poll() normalizes an ahead-of-server cursor back to 0 (effectiveStartCursor) to recover from desync/restart. If a client sends a stale high cursor and the bus is currently empty, new events will not satisfy waitForCursorAdvance until timeout because the server cursor cannot exceed that stale value yet, so /v1/poll can wait the full timeout even when matching events arrive. The waiter should use the same effective cursor basis as poll().

Useful? React with 👍 / 👎.

xudaiyanzi pushed a commit to xudaiyanzi/openclaw that referenced this pull request Apr 17, 2026
Merged via squash.

Prepared head SHA: 29c8068
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Reviewed-by: @hxy91819
kvnkho pushed a commit to kvnkho/openclaw that referenced this pull request Apr 17, 2026
Merged via squash.

Prepared head SHA: 29c8068
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Reviewed-by: @hxy91819
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
Merged via squash.

Prepared head SHA: 29c8068
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Reviewed-by: @hxy91819
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
Merged via squash.

Prepared head SHA: 29c8068
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Reviewed-by: @hxy91819
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
Merged via squash.

Prepared head SHA: 29c8068
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Reviewed-by: @hxy91819
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
Merged via squash.

Prepared head SHA: 29c8068
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Reviewed-by: @hxy91819
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
Merged via squash.

Prepared head SHA: 29c8068
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Reviewed-by: @hxy91819
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Merged via squash.

Prepared head SHA: 29c8068
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Reviewed-by: @hxy91819
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: qa-channel Channel integration: qa-channel extensions: qa-lab gateway Gateway runtime maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant