Skip to content

test(gateway): avoid async facade mock race - #118708

Merged
steipete merged 1 commit into
mainfrom
codex/perf-gateway-methods-gap
Aug 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/perf-gateway-methods-gap

Conversation

@steipete

@steipete steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace the gateway tools integration test's async partial same-facade mock with a synchronous complete manual mock
  • keep the real agent, session-store, config-cache, model-reference, delivery, and hot-reload owners in the integration path
  • continue mocking only inventory, MCP, policy, and registry-version work that is outside these three assertions

Root cause

In CI run 30818181352, the first gateway-methods attempt reported 144 of 145 files and 2,846 tests, then remained silent until the 300-second watchdog killed it. The sole missing file was tools-effective.global-agent.integration.test.ts. The automatic retry passed all 145 files and 2,849 tests in 59.13 seconds, producing a 439.91-second wrapper wall.

The missing file was the only gateway-methods test with an async importOriginal partial mock of tools-effective.runtime.js. That factory crossed the shared non-isolated worker's mock-resolution boundary after another file had completed. The replacement facade is synchronous and complete, so it cannot re-enter resolution of the module it is mocking.

Proof

  • Direct AWS Crabbox run_433fbc2be087:
    • five consecutive agent.test.ts -> tools-effective.global-agent.integration.test.ts runs
    • all five passed 2 files / 273 tests in the required order
  • Direct AWS Crabbox run_1a0255aada9a:
    • exact compact-large-6 leading order, retry disabled: auth -> CLI runner -> gateway methods
    • auth: 39 files / 579 tests
    • CLI runner: 1 file / 119 tests
    • gateway methods: 145 files / 2,849 tests, 85.85-second wrapper, no stall or retry
  • Post-rebase focused run_1a39c8d59c15:
    • 1 file / 3 tests passed in 7.21 seconds
  • git diff --check
  • autoreview clean: no accepted/actionable findings

No sharding, worker, concurrency, timeout, retry, production, docs, or coverage behavior changes.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Aug 3, 2026
@steipete steipete self-assigned this Aug 3, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 10:24 AM ET / 14:24 UTC.

ClawSweeper review

What this changes

The branch moves the gateway tools.effective global-agent integration test from an asynchronous partial runtime mock to a synchronous complete manual mock, preventing an intermittent shared-worker test stall.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep this PR open for normal maintainer landing. Current main still uses the asynchronous partial mock that imports the same façade it is mocking; this branch replaces it with a complete synchronous manual mock while retaining the real session, config, routing, and delivery paths exercised by the integration assertions. The PR body supplies repeated remote after-fix runs, and no functional or security defect was found in the patch.

Priority: P3
Reviewed head: 9491efed17fb607401839bbbe0b331fcd1c1952d

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong remote proof and a focused façade-level repair make this a high-confidence test reliability PR.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides after-fix remote test output for five ordered repetitions, the full gateway-methods lane, and a focused post-rebase run; it directly demonstrates the test-worker stall no longer occurs.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides after-fix remote test output for five ordered repetitions, the full gateway-methods lane, and a focused post-rebase run; it directly demonstrates the test-worker stall no longer occurs.
Evidence reviewed 5 items Current-main failure surface: Current main registers an asynchronous vi.mock factory that awaits importOriginal for the same tools-effective.runtime façade; this is the async resolution boundary the branch removes.
Complete façade coverage: The handler imports fourteen façade exports for session/config, inventory, MCP, policy, registry, and delivery work; the new manual mock supplies controlled values only for the expensive inventory/MCP/policy/registry paths and re-exports the real ownership helpers.
Vitest manual-mock contract: Vitest documents that a vi.mock call without a factory resolves the colocated __mocks__ module, and its module mocking rules require a mock to provide accessed exports; the new test follows that supported contract. citeturn0view0.
Findings None None.
Security None None.

How this fits together

Gateway RPC dispatch lazily loads the tools.effective handler, which resolves session ownership, configuration, model context, and tool inventory before returning an effective-tools response. This integration test keeps the session/config path real while replacing only expensive inventory, MCP, policy, and registry dependencies with controlled values.

flowchart LR
  A[Gateway RPC request] --> B[Lazy server-method dispatcher]
  B --> C[Effective-tools handler]
  C --> D[Session and configuration resolution]
  D --> E[Runtime facade]
  E --> F[Tool inventory and policy]
  F --> G[Gateway response]
  H[Integration-test manual mock] --> E
Loading

Before merge

  • Complete next step (P2) - No mechanical repair is warranted; this protected maintainer-labeled PR needs ordinary maintainer landing review rather than a ClawSweeper repair lane.
Agent review details

Security

None.

PR surface

Source +68, Tests -56. Total +12 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 68 0 +68
Tests 1 2 58 -56
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 70 58 +12

Review metrics

None.

Technical review

Best possible solution:

Land the narrow synchronous manual-mock repair after normal maintainer approval and required-check completion; retain the real session/config ownership paths in this integration test.

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

Yes. The PR identifies the ordered gateway-method test sequence and documents a pre-fix CI watchdog stall, followed by repeated remote after-fix runs of that sequence without a stall or retry.

Is this the best way to solve the issue?

Yes. Replacing the same-façade asynchronous partial mock at the test boundary is narrower and more maintainable than changing worker settings, retries, timeouts, or production runtime behavior; the manual mock preserves the owner paths under test.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a focused test-harness reliability repair with no production runtime, configuration, protocol, or user-facing behavior change.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix remote test output for five ordered repetitions, the full gateway-methods lane, and a focused post-rebase run; it directly demonstrates the test-worker stall no longer occurs.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides after-fix remote test output for five ordered repetitions, the full gateway-methods lane, and a focused post-rebase run; it directly demonstrates the test-worker stall no longer occurs.

Label justifications:

  • P3: This is a focused test-harness reliability repair with no production runtime, configuration, protocol, or user-facing behavior change.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides after-fix remote test output for five ordered repetitions, the full gateway-methods lane, and a focused post-rebase run; it directly demonstrates the test-worker stall no longer occurs.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix remote test output for five ordered repetitions, the full gateway-methods lane, and a focused post-rebase run; it directly demonstrates the test-worker stall no longer occurs.

Evidence

What I checked:

Likely related people:

  • steipete: Recent history and blame for both the global-agent integration test and its runtime façade point to Peter Steinberger; the PR continues that same gateway test-maintenance work. (role: recent area contributor and test/runtime façade author; confidence: high; commits: 7571679ecc7c, 188957a18af8, 9491efed17fb; files: src/gateway/server-methods/tools-effective.global-agent.integration.test.ts, src/gateway/server-methods/tools-effective.runtime.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.

@steipete
steipete merged commit 4c74fd8 into main Aug 3, 2026
105 of 112 checks passed
@steipete
steipete deleted the codex/perf-gateway-methods-gap branch August 3, 2026 14:26
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 3, 2026
* origin/main:
  fix(onboard): keep referenced provider secrets out of plaintext (#118702)
  docs: show canonical agent roster configuration (#118722)
  fix(channels): generate catalog from package manifests (#118097)
  fix(zalouser): distinguish probe timeout from auth failure (#111336)
  improve(ui): cut E2E shard runtime by reusing the bundle (#118697)
  fix(cli): publish completion caches atomically (#118715)
  fix(whatsapp): honor disabled self-chat without widening group access (#118711)
  fix(voice-call): terminate carrier calls after realtime startup failures (#118699)
  fix(slack): isolate GovSlack media trust and delivery (#118695)
  fix(browser): wrap page-controlled action results (#118691)
  fix(security): sanitize JSON-escaped forged content boundaries (#118698)
  test(qa): prove real yielded-child completion and channel delivery (#118707)
  fix(doctor): honor explicit plugin-only migration authority (#118700)
  fix(security): detect child_process calls through aliases and computed members (#116304)
  test(gateway): avoid async facade mock race (#118708)
  fix(gateway): preserve final speech during transcription shutdown (#118693)
  fix(gateway): resume durable outbound delivery retries (#118694)
  fix(plugins): reject external public-artifact hardlinks (#118689)
vincentkoc added a commit that referenced this pull request Aug 3, 2026
* origin/main: (78 commits)
  fix(parallels): recover Windows poll transport failures (#118479)
  fix(channels): deny unauthorized Discord and Telegram binding access (#118704)
  fix(test): bound shared git inventory lookup (#111171)
  fix(onboard): keep referenced provider secrets out of plaintext (#118702)
  docs: show canonical agent roster configuration (#118722)
  fix(channels): generate catalog from package manifests (#118097)
  fix(zalouser): distinguish probe timeout from auth failure (#111336)
  improve(ui): cut E2E shard runtime by reusing the bundle (#118697)
  fix(cli): publish completion caches atomically (#118715)
  fix(whatsapp): honor disabled self-chat without widening group access (#118711)
  fix(voice-call): terminate carrier calls after realtime startup failures (#118699)
  fix(slack): isolate GovSlack media trust and delivery (#118695)
  fix(browser): wrap page-controlled action results (#118691)
  fix(security): sanitize JSON-escaped forged content boundaries (#118698)
  test(qa): prove real yielded-child completion and channel delivery (#118707)
  fix(doctor): honor explicit plugin-only migration authority (#118700)
  fix(security): detect child_process calls through aliases and computed members (#116304)
  test(gateway): avoid async facade mock race (#118708)
  fix(gateway): preserve final speech during transcription shutdown (#118693)
  fix(gateway): resume durable outbound delivery retries (#118694)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
* origin/main:
  fix(onboard): keep referenced provider secrets out of plaintext (openclaw#118702)
  docs: show canonical agent roster configuration (openclaw#118722)
  fix(channels): generate catalog from package manifests (openclaw#118097)
  fix(zalouser): distinguish probe timeout from auth failure (openclaw#111336)
  improve(ui): cut E2E shard runtime by reusing the bundle (openclaw#118697)
  fix(cli): publish completion caches atomically (openclaw#118715)
  fix(whatsapp): honor disabled self-chat without widening group access (openclaw#118711)
  fix(voice-call): terminate carrier calls after realtime startup failures (openclaw#118699)
  fix(slack): isolate GovSlack media trust and delivery (openclaw#118695)
  fix(browser): wrap page-controlled action results (openclaw#118691)
  fix(security): sanitize JSON-escaped forged content boundaries (openclaw#118698)
  test(qa): prove real yielded-child completion and channel delivery (openclaw#118707)
  fix(doctor): honor explicit plugin-only migration authority (openclaw#118700)
  fix(security): detect child_process calls through aliases and computed members (openclaw#116304)
  test(gateway): avoid async facade mock race (openclaw#118708)
  fix(gateway): preserve final speech during transcription shutdown (openclaw#118693)
  fix(gateway): resume durable outbound delivery retries (openclaw#118694)
  fix(plugins): reject external public-artifact hardlinks (openclaw#118689)
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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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