fix(browser): bound Chrome launch stderr diagnostics#101506
Conversation
vincentkoc
left a comment
There was a problem hiding this comment.
The bounded-memory goal is valid, but this implementation changes recovery behavior and can emit the wrong diagnostic text.
- The rolling 64 KiB buffer drops early singleton and missing-display markers. Those markers currently drive stale-lock recovery and launch guidance after the process exits, so enough later stderr noise silently disables existing behavior.
- The final rendering takes the first 2,000 characters of the retained tail, not the newest failure output. With a full buffer this reports older retained noise instead of the terminal Chrome error.
- Trimming raw Buffer bytes can split a UTF-8 sequence and introduce replacement characters in the diagnostic.
Please keep the memory bound while tracking recovery facts independently, retain a UTF-8-safe newest display tail, and add regressions for an early singleton/display marker followed by more than 64 KiB of noise, a final marker at the newest end, and a split multibyte chunk. A real managed-Chrome failure proof should confirm the retry/hint paths remain unchanged.
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 3:25 AM ET / 07:25 UTC. Summary PR surface: Source +91, Tests +136. Total +227 across 5 files. Reproducibility: yes. from source: current main retains Chrome launch stderr in an unbounded array until startup succeeds or fails, then renders the first capped diagnostic slice and derives recovery hints from that same retained stream. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land the bounded tail helper after maintainer review confirms current-head proof or intentionally accepts the earlier real Chrome proof for the narrow post-proof helper refactor. Do we have a high-confidence way to reproduce the issue? Yes from source: current main retains Chrome launch stderr in an unbounded array until startup succeeds or fails, then renders the first capped diagnostic slice and derives recovery hints from that same retained stream. Is this the best way to solve the issue? Yes, likely: the current patch keeps memory bounded at the collection boundary, carries recovery facts separately, renders the newest diagnostic slice, and avoids a duplicate Chrome MCP tail implementation. I did not find a narrower existing helper on current main that already solves both launch and MCP stderr tails. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 67630e897357. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +91, Tests +136. Total +227 across 5 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (7 earlier review cycles)
|
0bf188f to
7fe9bfc
Compare
Thanks for the detailed review —I addressed the launch-diagnostics regressions you called out. Changes made:
I also added real managed-Chrome launch-failure proof for the current head: the proof harness imported the actual After syncing current
ClawSweeper now marks Could you please re-review when you have a chance? |
7fe9bfc to
6b52997
Compare
fca5198 to
40b680f
Compare
|
Land-ready maintainer proof for
Known gap: no separate macOS live run. The contributor supplied real Windows Chrome failure proof; maintainer proof covers Linux real-Chromium launch. No OpenAI/provider key is involved in this browser-process fix, and the untrusted fork was intentionally never credential-hydrated. |
|
Merged via squash.
|
* fix(browser): bound Chrome launch stderr diagnostics * fix(browser): preserve chrome launch recovery diagnostics * refactor(browser): share bounded UTF-8 stderr tails * fix(browser): own bounded stderr storage --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
extensions/browser/src/browser/chrome.ts, specifically the launch path that waits for CDP readiness and includes stderr diagnostics when startup fails.Why This Change Was Made
slice(-CHROME_STDERR_HINT_MAX_CHARS), and drops leading continuation bytes before UTF-8 decoding so diagnostics do not start with replacement characters after a boundary trim.launchOpenClawChromeremains the owner of managed-Chrome launch diagnostics and retry decisions. The source of truth for the public diagnostic size cap remainsCHROME_STDERR_HINT_MAX_CHARS; this patch only changes the private launch-time stderr retention and signal tracking that feed that existing diagnostic path.launchOpenClawChromeimplementation.merge-risk: availability.init-prdetected no linked issues for this PR, and this repair does not define or extend a public contract. No competing contract PR is needed to own the private stderr-retention behavior; the source of truth remainslaunchOpenClawChrome.User Impact
CHROME_STDERR_HINT_MAX_CHARS.--crash-teststartup flag through the actual Chrome binary. Additional live OS/session setups for Linux missing-DISPLAY and active stale Singleton lock are not part of this local proof run; the marker-specific behavior for those cases is covered by focused regressions because the code change is the bounded stderr retention/signaling layer, not platform setup or Chrome lock creation.Evidence
Environment: Windows Git Bash task worktree; Node v22.17.0; pnpm v11.2.2. After syncing current
origin/main, local proof and validation were rerun against PR head7fe9bfcf83588d142380ce1e14ef9c827414310c. The real Chrome proof used an explicit local live-proof opt-in with a prepared Windows environment and a direct managed-Chrome launch attempt.Main sync:
daily_fix.sh check-main-driftreportedsync_main_required=true;daily_fix.sh sync-mainreplayed the two PR commits onto currentorigin/main, then the validations below were rerun.Remote checks after sync: Current PR head
7fe9bfcf83588d142380ce1e14ef9c827414310csettled withFAIL 0 / PENDING 0 / PASS 69 / SKIPPED 30after the sync push.Commands run after this patch:
CI=1 NO_COLOR=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-browser.config.ts extensions/browser/src/browser/chrome.internal.test.ts --reporter=verbose— exit 0.pnpm exec oxfmt --check --threads=1 extensions/browser/src/browser/chrome.ts extensions/browser/src/browser/chrome.internal.test.ts— exit 0; output includedAll matched files use the correct format.pnpm exec oxlint extensions/browser/src/browser/chrome.ts extensions/browser/src/browser/chrome.internal.test.ts --deny-warnings— exit 0.git diff --check— exit 0.OPENCLAW_HOME,OPENCLAW_CONFIG_PATH, andOPENCLAW_REAL_CHROME_EXEset for an isolated local Chrome proof environment — exit 0. The harness importedlaunchOpenClawChromefrom the current PR head, used a locally installed real Chrome executable (not mockedchild_process.spawn), launched managed Chrome with--crash-test, and waited for CDP on an OpenClaw-managed loopback port.Real managed-Chrome launch-failure proof:
Result: expected managed Chrome launch failure.
Observed
Failed to start Chrome CDP: yes.Observed redacted
Chrome stderr:section: yes.Sanitized excerpt:
Key results / observations: The focused browser Vitest file now covers the maintainer-requested cases: early Singleton marker plus more than 64 KiB of later stderr still triggers stale-lock retry; final/newest stderr marker is displayed; split multibyte trimming does not introduce
�; early missing-display marker plus later tail rollover still produces the display hint. The real Chrome proof confirms the current head still reports managed-Chrome launch failure through the actuallaunchOpenClawChromepath with a redacted stderr section.Review findings addressed, if any:
RF-001/RF-007maintainer changes requested — fixed in code and covered by the focused browser Vitest regressions listed above.RF-002/RF-003/RF-004/RF-006real behavior proof requests — supplied via the real managed-Chrome launch-failure proof above for current head7fe9bfcf83588d142380ce1e14ef9c827414310c.RF-005availability-sensitive path — risk is called out above; focused regressions cover stale-lock recovery, missing-display hint preservation, newest stderr rendering, and UTF-8-safe trimming.Regression guardrail:
extensions/browser/src/browser/chrome.internal.test.tsnow exercises early Singleton recovery after tail rollover, missing-display hint preservation after tail rollover, newest output rendering, and UTF-8 split-boundary trimming.Patch quality notes: Production diff remains limited to
extensions/browser/src/browser/chrome.ts; tests remain in the existing browser internal test file. The addedfs.existsSyncreturn true/return falsebranches are test-only fixture path controls, and the addedcatchblocks only capture the expected launch error message for assertions. No local debug files, lockfiles, generated artifacts, or dependency changes are included.Maintainer-ready confidence: High: the maintainer-requested code repair is covered by focused current-head regressions, and the current head now includes a real managed-Chrome launch-failure proof instead of relying on mocked Vitest coverage as the behavior proof.