Repository navigation
fix(browser): bound batch action nesting depth in act request normalization - #120274
Conversation
|
Codex review: needs changes before merge. Reviewed August 7, 2026, 9:49 PM ET / August 8, 2026, 01:49 UTC. ClawSweeper reviewWhat this changesThe PR bounds nested Browser Merge readinessKeep open: depth bounding is the right repair, but the unchanged head repeats the prior P1 off-by-one and rejects an executor-valid six-wrapper batch before dispatch. Priority: P1 Review scores
Verification
How this fits togetherBrowser flowchart LR
A[Browser /act JSON request] --> B[1 MB JSON parser]
B --> C[Batch request normalizer]
C --> D[Depth and action-count validation]
D --> E[Route error or dispatch]
E --> F[Playwright batch executor]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +10, Tests +26. Total +36 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use the executor-equivalent depth boundary, preserve the deep-input rejection, and pin both the last accepted and first rejected wrapper counts in regression tests. Do we have a high-confidence way to reproduce the issue? Yes—source establishes that six batch wrappers reach executor depth 5 and execute, while this head rejects wrapper six; the PR body also supplies a direct real-normalizer 30,000-level before/after trace. Is this the best way to solve the issue? No—the validation owner is correct, but Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 48639663b0aa. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
…zation normalizeActRequest recursed over batch nesting with no depth bound, so a ~1MB POST /act body with tens of thousands of nested batch levels parsed fine and then crashed normalization with RangeError: Maximum call stack size exceeded before the ACT_MAX_BATCH_ACTIONS count check could run, surfacing an internal stack overflow as the 400 validation message. Thread the existing ACT_MAX_BATCH_DEPTH limit through normalizeBatchAction/ normalizeActRequest and reject deeper nesting up front with a clear 'batch nesting exceeds maximum depth of 5' error, matching the bound the Playwright executor already enforces at dispatch time.
Accept the six wrapper levels supported by the Playwright executor and reject the seventh during request normalization. Co-authored-by: 万拥 0668000723 <[email protected]>
5f94b83 to
e121916
Compare
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
Merged via squash.
|
…zation (openclaw#120274) * fix(browser): bound batch action nesting depth in act request normalization normalizeActRequest recursed over batch nesting with no depth bound, so a ~1MB POST /act body with tens of thousands of nested batch levels parsed fine and then crashed normalization with RangeError: Maximum call stack size exceeded before the ACT_MAX_BATCH_ACTIONS count check could run, surfacing an internal stack overflow as the 400 validation message. Thread the existing ACT_MAX_BATCH_DEPTH limit through normalizeBatchAction/ normalizeActRequest and reject deeper nesting up front with a clear 'batch nesting exceeds maximum depth of 5' error, matching the bound the Playwright executor already enforces at dispatch time. * fix(browser): match batch depth executor boundary Accept the six wrapper levels supported by the Playwright executor and reject the seventh during request normalization. Co-authored-by: 万拥 0668000723 <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]>
#173065) * refactor(browser,qa-lab): consolidate internal validation and capture Keep external validation, navigation and credential authority, selected evidence integrity, process settlement and public contracts. Trust canonical normalized actions and fresh internal evidence instead of repeating their owners' work. Stage bundled sources and compute their runtime host floor in one pass. Best-effort tradeoffs accepted - Internal child evidence changing completed/pending history: #147756/#168841 describe synthetic ownership foundations, not human mutation incidents. Keep the first captured facts; canonical publication still validates the graph. - Invalid internal evidence selection/combination: duplicate preflights from #147756 are not external boundaries. Invalid snapshots fail at canonical publication instead of every adapter/select step. - Fresh V3 snapshots or local taxonomy objects mutating between private calls: no external writer holds them. Use owner-held facts; path rebasing still copies because it mutates paths. - Gallery roots/symlinks changing during one request: private consumers use the canonical ingress root. Actual artifact containment and download authorization remain at their boundaries. - Gallery model rows not belonging to their own declaration list: impossible because those rows are created from that exact list. Actual arbitrary-path downloads keep the allowlist. - Configured replacement Telegram skill returning malformed internal results: #133030 introduced a canonical leased-skill producer, not a human malformed-result incident. Canonical credential validation and effect-time lease health remain; malformed replacements fail at use. - Local filesystem calls hanging during Mantis cleanup: #111051/#158313 provide synthetic timeout qualification, not a human uncancellable-local-FS incident. Await the OS; preserve Git deadlines, exact path/inode authority and process settlement. - Mantis path replacement between consecutive ownership probes: preserve one precheck plus child-side pinned identity at destructive dispatch; a disappeared/replaced path fails safely. - Typed log collector returning an impossible bad cursor: #137622 added the retirement mode as a review defense. Trust its paired owner; retain bounded rollover, redaction and legacy fallback. - Fetch implementation ignoring AbortSignal: Matrix's removed outer timer defended fake-only behavior. Native request deadline/cancellation, parallel healthy-peer probes, response-body and loser cleanup remain. - Artifact disappearing immediately after its successful own write: #92606/445317a38b1 add the redundant access check, with no human disappearance report. Real write failures propagate; actual readers detect later deletion. - Private Browser leaves receiving unnormalized values: #63977 owns external /act normalization; extraction #113771 retained mirror checks. Keep external fill repair #131231 and all effect authority. Invalid internal calls may fail at Playwright rather than a second validator. - Unnormalized oversized/deep batches reaching the private executor: restored executor 61d171a has no human bounds incident. Keep recursive ingress depth repair #120274 and total count bound #63977; remove duplicate executor depth plumbing. - Abort firing between synchronous resetTransport checks: #126407 added synthetic lifecycle coverage. No async work intervenes, so keep entry and post-await invocation checks. - Taxonomy file disappearing after successful parse: #91500/#92558 introduced reporting, not a human mid-report deletion incident. Finish with parsed facts; the next read notices deletion. The named standalone session-memory backend and tests remain untouched. Proof: fresh independent P0-P2 review scoped-clean after repairing a reproduced false-coverage descendant-admission defect; targeted source graph types and syntax-boundary lint pass; runtime/static cycles both zero; format/diff clean. Browser focused owner/sibling cohort: 12 files, 194 tests pass. Invocation/containment/staging: 3 files, 34 tests pass, including the reproduced false-coverage regression. Both unchanged Gateway-child staging-cleanup cases pass after retaining staging-directory creation before root metadata parsing. Below-500 coordinator packet: 442 net production LOC removed (+198/-640). No cleanup PR or merge claim. Full check-changed, type-aware package lint and Telegram command-menu Gateway E2E remain unproven under host saturation. The remaining full QA owner cohort was interrupted before assertions; not green. Suppression inventory fails only on untouched UI rows, reproduced on clean main 45b463f; no suppression allowance changed. * refactor(browser,qa-lab): remove test-only execution indirection Publish Chrome MCP handles synchronously and wait only for transport readiness. Keep process identity, close settlement, waiter sharing and effect authority. Remove character-eval callback injection and private projection/type mirrors; reuse canonical lifecycle cancellation and timer bounds. Best-effort tradeoffs accepted - Delayed asynchronous MCP factory handles existed only through the test seam (ea2b558/#104601; extracted by #113114). Linked #103784 is a forced Delay launch/source-proof matrix, not a human actual-use incident. Production constructs the handle synchronously; readiness remains asynchronous and cancellable, and exact owned process cleanup still settles before replacement. - Same-tick lifecycle completion and abort now follow the canonical SDK Promise.race ordering rather than a private listener implementation (#127761/22e12267f68, synthetic lifecycle qualification). Shared work is not cancelled; synchronous pre-abort and effect authority stay intact. - A private already-clamped timer no longer repeats the SDK maximum check (4abde61; centralized by 5f4fc75). The same canonical grace helper caps the result, with no timeout change. Character-eval test callbacks were never supplied by its sole production CLI caller (3101d81; #92606). Tests now mock the actual suite/manual-lane owners. Six private pwAi projections had only test consumers; canonical session exports remain. Port reservation accepts the actual node:net.Server instead of a mirror. Full-branch production reduction: 610 net lines (+241/-851), excluding tests, fixtures, test-support, generated files and declarations. No public/config/SDK, storage, protocol or dependency contract changes. Phase E remains untouched. * fix(qa-lab): drop unproven cleanup paths and type standalone restorer Restore character-eval and CLI runtime byte-for-byte to the cleanup base after exact-head CI found concurrent mock bypass and captured-taxonomy failures. Keep every original behavioral assertion; no retry, timeout or skip changes. The local character replay was inconclusive, so drop its whole cleanup cluster instead of waiting for host capacity. Restore CLI snapshot capture as well. Declare the imported credential-restorer's receiver-free function contract. The canonical exported function never uses this; no runtime guard or credential validation changes. This fixes the typed unbound-method lint finding. Branch production reduction is now 568 net lines (+229/-797), tests/fixtures/ test-support/generated/declarations excluded. Prior full autoreview remains valid for this strict restoration subset; independent repair review confirms exact base blobs and the type-only correction. Source-graph types, focused syntax-boundary lint, formatting and diff checks pass. * refactor(qa-lab): split pending Telegram credential cleanup Restore the two Telegram files to current main for #173065. Park their rewrite and receiver-free lint contract on deslop/y13-telegram-userbot-credential-20261015 pending Test Server userbot proof with Convex-leased credentials. Coordinator waives the floor for the remaining 474 net production lines.
openclaw#173065) * refactor(browser,qa-lab): consolidate internal validation and capture Keep external validation, navigation and credential authority, selected evidence integrity, process settlement and public contracts. Trust canonical normalized actions and fresh internal evidence instead of repeating their owners' work. Stage bundled sources and compute their runtime host floor in one pass. Best-effort tradeoffs accepted - Internal child evidence changing completed/pending history: openclaw#147756/openclaw#168841 describe synthetic ownership foundations, not human mutation incidents. Keep the first captured facts; canonical publication still validates the graph. - Invalid internal evidence selection/combination: duplicate preflights from openclaw#147756 are not external boundaries. Invalid snapshots fail at canonical publication instead of every adapter/select step. - Fresh V3 snapshots or local taxonomy objects mutating between private calls: no external writer holds them. Use owner-held facts; path rebasing still copies because it mutates paths. - Gallery roots/symlinks changing during one request: private consumers use the canonical ingress root. Actual artifact containment and download authorization remain at their boundaries. - Gallery model rows not belonging to their own declaration list: impossible because those rows are created from that exact list. Actual arbitrary-path downloads keep the allowlist. - Configured replacement Telegram skill returning malformed internal results: openclaw#133030 introduced a canonical leased-skill producer, not a human malformed-result incident. Canonical credential validation and effect-time lease health remain; malformed replacements fail at use. - Local filesystem calls hanging during Mantis cleanup: openclaw#111051/openclaw#158313 provide synthetic timeout qualification, not a human uncancellable-local-FS incident. Await the OS; preserve Git deadlines, exact path/inode authority and process settlement. - Mantis path replacement between consecutive ownership probes: preserve one precheck plus child-side pinned identity at destructive dispatch; a disappeared/replaced path fails safely. - Typed log collector returning an impossible bad cursor: openclaw#137622 added the retirement mode as a review defense. Trust its paired owner; retain bounded rollover, redaction and legacy fallback. - Fetch implementation ignoring AbortSignal: Matrix's removed outer timer defended fake-only behavior. Native request deadline/cancellation, parallel healthy-peer probes, response-body and loser cleanup remain. - Artifact disappearing immediately after its successful own write: openclaw#92606/a5445ce41eb add the redundant access check, with no human disappearance report. Real write failures propagate; actual readers detect later deletion. - Private Browser leaves receiving unnormalized values: openclaw#63977 owns external /act normalization; extraction openclaw#113771 retained mirror checks. Keep external fill repair openclaw#131231 and all effect authority. Invalid internal calls may fail at Playwright rather than a second validator. - Unnormalized oversized/deep batches reaching the private executor: restored executor 1034ccb has no human bounds incident. Keep recursive ingress depth repair openclaw#120274 and total count bound openclaw#63977; remove duplicate executor depth plumbing. - Abort firing between synchronous resetTransport checks: openclaw#126407 added synthetic lifecycle coverage. No async work intervenes, so keep entry and post-await invocation checks. - Taxonomy file disappearing after successful parse: openclaw#91500/openclaw#92558 introduced reporting, not a human mid-report deletion incident. Finish with parsed facts; the next read notices deletion. The named standalone session-memory backend and tests remain untouched. Proof: fresh independent P0-P2 review scoped-clean after repairing a reproduced false-coverage descendant-admission defect; targeted source graph types and syntax-boundary lint pass; runtime/static cycles both zero; format/diff clean. Browser focused owner/sibling cohort: 12 files, 194 tests pass. Invocation/containment/staging: 3 files, 34 tests pass, including the reproduced false-coverage regression. Both unchanged Gateway-child staging-cleanup cases pass after retaining staging-directory creation before root metadata parsing. Below-500 coordinator packet: 442 net production LOC removed (+198/-640). No cleanup PR or merge claim. Full check-changed, type-aware package lint and Telegram command-menu Gateway E2E remain unproven under host saturation. The remaining full QA owner cohort was interrupted before assertions; not green. Suppression inventory fails only on untouched UI rows, reproduced on clean main a7fbdc2; no suppression allowance changed. * refactor(browser,qa-lab): remove test-only execution indirection Publish Chrome MCP handles synchronously and wait only for transport readiness. Keep process identity, close settlement, waiter sharing and effect authority. Remove character-eval callback injection and private projection/type mirrors; reuse canonical lifecycle cancellation and timer bounds. Best-effort tradeoffs accepted - Delayed asynchronous MCP factory handles existed only through the test seam (2f7b3f8/openclaw#104601; extracted by openclaw#113114). Linked openclaw#103784 is a forced Delay launch/source-proof matrix, not a human actual-use incident. Production constructs the handle synchronously; readiness remains asynchronous and cancellable, and exact owned process cleanup still settles before replacement. - Same-tick lifecycle completion and abort now follow the canonical SDK Promise.race ordering rather than a private listener implementation (openclaw#127761/71473724074, synthetic lifecycle qualification). Shared work is not cancelled; synchronous pre-abort and effect authority stay intact. - A private already-clamped timer no longer repeats the SDK maximum check (e8241d3; centralized by ca3aad3). The same canonical grace helper caps the result, with no timeout change. Character-eval test callbacks were never supplied by its sole production CLI caller (46ad8dd; openclaw#92606). Tests now mock the actual suite/manual-lane owners. Six private pwAi projections had only test consumers; canonical session exports remain. Port reservation accepts the actual node:net.Server instead of a mirror. Full-branch production reduction: 610 net lines (+241/-851), excluding tests, fixtures, test-support, generated files and declarations. No public/config/SDK, storage, protocol or dependency contract changes. Phase E remains untouched. * fix(qa-lab): drop unproven cleanup paths and type standalone restorer Restore character-eval and CLI runtime byte-for-byte to the cleanup base after exact-head CI found concurrent mock bypass and captured-taxonomy failures. Keep every original behavioral assertion; no retry, timeout or skip changes. The local character replay was inconclusive, so drop its whole cleanup cluster instead of waiting for host capacity. Restore CLI snapshot capture as well. Declare the imported credential-restorer's receiver-free function contract. The canonical exported function never uses this; no runtime guard or credential validation changes. This fixes the typed unbound-method lint finding. Branch production reduction is now 568 net lines (+229/-797), tests/fixtures/ test-support/generated/declarations excluded. Prior full autoreview remains valid for this strict restoration subset; independent repair review confirms exact base blobs and the type-only correction. Source-graph types, focused syntax-boundary lint, formatting and diff checks pass. * refactor(qa-lab): split pending Telegram credential cleanup Restore the two Telegram files to current main for openclaw#173065. Park their rewrite and receiver-free lint contract on deslop/y13-telegram-userbot-credential-20261015 pending Test Server userbot proof with Convex-leased credentials. Coordinator waives the floor for the remaining 474 net production lines.
What Problem This Solves
Fixes an issue where deeply nested Browser
/actbatch payloads could overflow the JavaScript stack during request normalization, before the existing action-count and executor depth checks produced a useful validation result.The route accepts bodies up to 1 MB, so hostile inputs can contain tens of thousands of one-child batch wrappers. Before this change,
normalizeActRequestrecursively walked that tree without a depth bound and surfacedRangeError: Maximum call stack size exceededas the HTTP 400 message.Why This Change Was Made
The request normalizer now carries the existing
ACT_MAX_BATCH_DEPTHpolicy through nested batch parsing and rejects the seventh batch wrapper before recursing into it. The boundary matches the Playwright executor's depth convention: the outer batch starts at depth 0, so six wrappers are valid at depths 0 through 5 and the seventh would enter depth 6.This keeps one shared depth policy and bounds the later recursive action-count and target-ID walks without adding another traversal or compatibility path.
User Impact
Valid batches with up to six wrappers continue to normalize and execute. Deeper payloads now receive the deterministic validation error
batch nesting exceeds maximum depth of 5instead of an internal stack-overflow message.Evidence
OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs extensions/browser/src/browser/routes/agent.act.normalize.test.ts extensions/browser/src/browser/routes/agent.act.normalize.batch-contract.test.ts— 2 files, 15 tests passed.git diff --check— passed.