Repository navigation
test: hold console requests through the shared holdRequests helper - #3610
Conversation
holdRequests gains a timeout option (0 waits as long as the test), resolves requested with the server's answer under afterServer, and can lose that answer on release (loseResponse). 19 hand-written holds in 8 browser files now use it, each with its method, once/times, fetch-first and no-deadline behaviour kept.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR replaces 19 handwritten browser request gates with the shared holdRequests helper while preserving their timing and response behavior. Example: Saving repository access applies a PATCH successfully, but its response is lost.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR is a useful test-only consolidation with no introduced correctness or security defect found; keep it open for normal maintainer landing. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe browser-test helper intercepts Console HTTP requests to the in-process controller fixture and releases, fulfills, or aborts them so tests can inspect pending and uncertain outcomes. flowchart LR
A[Browser test action] --> B[Console request]
B --> C[Shared request hold]
C --> D[Controller fixture]
D --> C
C --> E[Release or lose response]
E --> F[Console state assertions]
Technical reviewBest possible solution: Land the focused consolidation through the existing helper while retaining the migrated scenarios and assertions. Do we have a high-confidence way to reproduce the issue? This is test consolidation rather than a reported product bug; source inspection confirms the duplicated gates and their replacement. Is this the best way to solve the issue? Extending the existing helper is appropriate: each added option supports an actual migrated scenario without creating another synchronization owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bda77b0b61fa. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 25, 2026, 6:19 AM ET / 10:19 UTC. |
Problem
Browser tests hold console requests in two ways: the shared
holdRequestshelper and about 40 hand-writtenpage.routegates. Nineteen of the hand-written gates do exactly whatholdRequestsdoes: hold a request (optionally after the server answered), signal that it arrived, and deliver it on release. Each copy has its own release, teardown and signalling code. Several have no teardown release at all, and two use Playwright's{ times: 1 }, which the helper's comment explains can release other held requests.They could not use the helper as it was:
holdRequestsstarts a 10 s deadline when a test awaitsrequested. The hand-written gates wait as long as the test does, so moving them would add a new way to fail.Change
holdRequestsgets three options. Existing callers do not change.timeout: the deadline forrequestedin ms. The default is still 10 s, and0waits as long as the test does.afterServer,requestedresolves with the server's answer (APIResponse).loseResponse(needsafterServer): the page's request fails on release although the server applied it.holdRequests. Each keeps its method filter, its hold-first or fetch-first order, its status and body checks, and its wait with no deadline (timeout: 0wherever the test awaitsrequested).console-agent-channels: 2console-agent-detail: 3console-agent-draft-guards: 5console-agent-plugin-approvers: 1console-agent-repositories: 3console-agent-state: 2 ({ times: 1 }becomesonce: true)console-agents: 2console-namespace-create: 1Left as they are:
console-agent-detail-2,console-agent-presets,console-agents-2,console.test.mjs).Verification
On a remote test VM:
checks-browser(24 files) andchecks-browser-2(25 files) pass with this change.Mutants of the helper, each run through both lanes:
loseResponseignored: both callers fail at their "Outcome unknown" check (console-agent-draft-guardsx2,console-agent-repositories).requestedresolves without the server's answer: all 4 callers that read it fail (console-agent-detail,console-agent-draft-guardsx3 tests,console-agent-repositories).timeout: 0ignored (the deadline fires at once): 12 tests in 5 of the 6 files that pass it fail with "No … request was held". The 6th,console-agents, survives because its request is already held before the test awaitsrequested.console-agent-channelsholds, the session hold inconsole-agent-plugin-approversand the capabilities hold inconsole-agent-detail. The hand-written originals of those 4 also pass with their gate removed, so this change keeps their strength as it was.Static checks:
tsc --build tsconfig.json tests/tsconfig.jsonpasses.git merge-treeagainst every open PR that touches these files (feat: assign configured OpenClaw roles to Agent users #906, fix: preserve native plugin permissions across Harness selection and admission #2258, feat(console): show the authorized native Gateway people roster #2596, feat: add Gateway managed mode to Agent deployments #2982, feat(console): simplify policy denials and add batch rule review #3232, Track Agent deletion through controller-confirmed cleanup #3390) shows no new conflict.Risks
Test-only. Non-matching methods now fall through with
route.fallback()instead ofroute.continue(). None of the migrated tests registers an earlier route on the same URL, so the requests still reach the API.