Skip to content

fix(test): wait for gateway hook model activity - #122584

Merged
vincentkoc merged 1 commit into
mainfrom
fix/gateway-hook-model-server-ready
Aug 12, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/gateway-hook-model-server-ready

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where the gateway hook concurrency E2E could fail after all hook responses settled but before the held model server recorded its first active request.

Why This Change Was Made

The test now waits within the existing 30-second synchronization budget for model activity instead of sampling it once. The assertion still reports captured gateway logs on timeout, and no production behavior changes.

User Impact

No user-visible product change. Release validation no longer fails on this model-request scheduling race.

Evidence

  • Four independent Blacksmith Testbox focused runs passed:
    • tbx_01kztpyr6pdzjqea5h7by2qvtx
    • tbx_01kztpyr6xjyhw7yg4ybqrbj6r
    • tbx_01kztpyr69jpqyb7rhad09fm2e
    • tbx_01kztpyr81ca9s7nj97e4v5t16
  • Known predecessor-order slice passed: 2 files, 11 tests (tbx_01kztqahqzn44mbdyqywdn2w2j).
  • Scoped changed checks passed (tbx_01kztqn4syyxgemk4kx7hqa2p5).
  • git diff --check passed.
  • Autoreview: clean, no accepted/actionable findings.

@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@vincentkoc vincentkoc self-assigned this Aug 12, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 12, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@vincentkoc
vincentkoc marked this pull request as ready for review August 12, 2026 10:27
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 7:00 AM ET / 11:00 UTC.

ClawSweeper review

What this changes

The PR replaces a one-time held-model activity assertion in the gateway hook concurrency E2E test with a 30-second Vitest wait.

Regression provenance

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

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open for normal maintainer merge handling. The current E2E test can observe a successful hook admission before the held model server increments its active count; this focused bounded wait removes that scheduling race without changing production behavior.

Priority: P3
Reviewed head: 5fee858280debe070edd210a232865d5056ad42b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A small, source-grounded test stabilization with focused reported validation and no blocking review finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored, test-only PR is outside the external-contributor proof gate; its body nevertheless reports focused Testbox runs.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored, test-only PR is outside the external-contributor proof gate; its body nevertheless reports focused Testbox runs.
Evidence reviewed 6 items Current-main race surface: Current main samples held-model activity once after hook responses settle, while the PR waits for that same observable condition within the test's existing synchronization budget.
Admission precedes model activity: The hook dispatcher resolves HTTP admission from onExecutionStarted, then the isolated run continues; therefore a 200 response is not a guarantee that the model server has already received its request.
Existing synchronization convention: The same E2E already uses bounded vi.waitFor polling for response settlement, request arrival, and eventual idle state, so the change follows the test's established asynchronous-observation pattern.
Findings None None.
Security None None.

How this fits together

The gateway accepts hook HTTP requests and reports success when the isolated agent run enters execution; that run later contacts the configured model server. This E2E test holds model responses to verify the shared admission budget and observes the server activity before releasing work.

flowchart LR
  A[Hook HTTP requests] --> B[Gateway admission]
  B --> C[Isolated agent run starts]
  C --> D[Held model server]
  D --> E[Activity and budget assertions]
  E --> F[Release and completion checks]
Loading

Before merge

  • Complete next step (P2) - No mechanical repair remains; this MEMBER-authored PR carries the protected maintainer label and should follow normal maintainer merge handling.
Agent review details

Security

None.

PR surface

Tests +3. Total +3 across 1 file.

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

Review metrics

Metric Value Why it matters
Production versus test LOC production +0/-0; tests +4/-1 (net +3) The entire diff is a test synchronization repair; no runtime, configuration, or persisted-behavior surface changes.

Technical review

Best possible solution:

Keep the bounded activity wait at the E2E observation boundary so hook-admission coverage remains strict while no longer assuming a scheduler ordering the gateway does not promise.

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

Yes, from source: HTTP success is settled at runner entry while the test server increments activity only after the later model request, making the prior one-time sample a real scheduling race.

Is this the best way to solve the issue?

Yes. Waiting at the assertion boundary preserves the intended model-activity invariant and matches the file's existing bounded asynchronous checks; changing production admission semantics would solve the wrong problem.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a focused internal E2E reliability repair with no user-facing runtime behavior change.
  • 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 MEMBER-authored, test-only PR is outside the external-contributor proof gate; its body nevertheless reports focused Testbox runs.

Label justifications:

  • P3: This is a focused internal E2E reliability repair with no user-facing runtime behavior change.
  • 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 MEMBER-authored, test-only PR is outside the external-contributor proof gate; its body nevertheless reports focused Testbox runs.

Evidence

What I checked:

  • Current-main race surface: Current main samples held-model activity once after hook responses settle, while the PR waits for that same observable condition within the test's existing synchronization budget. (test/gateway-hook-concurrency.e2e.test.ts:92, 5fee858280de)
  • Admission precedes model activity: The hook dispatcher resolves HTTP admission from onExecutionStarted, then the isolated run continues; therefore a 200 response is not a guarantee that the model server has already received its request. (src/gateway/server/hooks.ts:496, 5235269b3c38)
  • Existing synchronization convention: The same E2E already uses bounded vi.waitFor polling for response settlement, request arrival, and eventual idle state, so the change follows the test's established asynchronous-observation pattern. (test/gateway-hook-concurrency.e2e.test.ts:72, 5fee858280de)
  • Test provenance: Blame attributes the original one-shot assertion and file introduction to the merged gateway refactor; the PR is a narrowly scoped stabilization of that test assertion. (test/gateway-hook-concurrency.e2e.test.ts:92, 07d9f9c92ca2)
  • Current-main and release check: The proposed head is not contained in current main, and the latest release contains the original test but not this stabilization; the item is still necessary. (5fee858280de)
  • Contributor validation: The PR body reports four focused Testbox runs, an 11-test predecessor-order slice, scoped changed checks, and a clean diff check; provided GitHub context also reports successful required checks. (test/gateway-hook-concurrency.e2e.test.ts:92, 5fee858280de)

Likely related people:

  • steipete: Git history and blame attribute the original concurrency E2E assertion to the merged gateway work that introduced this file. (role: test introducer and recent gateway contributor; confidence: high; commits: 07d9f9c92ca2; files: test/gateway-hook-concurrency.e2e.test.ts, src/gateway/server/hooks.ts)
  • vincentkoc: Prior merged history includes multiple hook-dispatch changes, including mapped wake-event routing, in addition to this focused repair. (role: recent gateway-hooks contributor; confidence: high; commits: fc95d7190cbb, 3200378ab4f0; files: src/gateway/server/hooks.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.

@vincentkoc
vincentkoc merged commit ce56c40 into main Aug 12, 2026
144 checks passed
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

@vincentkoc
vincentkoc deleted the fix/gateway-hook-model-server-ready branch August 12, 2026 11:02
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 13, 2026
tomorrowflow pushed a commit to tomorrowflow/openclaw that referenced this pull request Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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