Skip to content

fix(browser): bound Chrome launch stderr diagnostics#101506

Merged
steipete merged 4 commits into
openclaw:mainfrom
mikasa0818:fix/chrome-stderr-tail-bound
Jul 9, 2026
Merged

fix(browser): bound Chrome launch stderr diagnostics#101506
steipete merged 4 commits into
openclaw:mainfrom
mikasa0818:fix/chrome-stderr-tail-bound

Conversation

@mikasa0818

@mikasa0818 mikasa0818 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

  • Fixes an issue where users could hit Chrome launch failures or stuck startup while OpenClaw retained the entire Chrome launch stderr stream in memory before diagnostics were rendered.
  • Affected surface / workflow: Managed Chrome startup in extensions/browser/src/browser/chrome.ts, specifically the launch path that waits for CDP readiness and includes stderr diagnostics when startup fails.
  • Root cause, in product terms: The original PR correctly moved stderr retention toward a bounded 64 KiB launch buffer, but the retained tail became the only source for stale Singleton-lock recovery, missing-display/profile-lock hints, and final rendered diagnostics. Early recovery markers could roll out of the tail, the displayed 2,000 characters came from the start of the retained tail instead of the newest failure output, and byte trimming could start inside a UTF-8 character.
  • Why it matters / User impact: Chrome startup failures should keep OpenClaw memory bounded without regressing existing retry/hint behavior or showing stale/malformed diagnostics. Users still need the latest redacted Chrome failure output plus existing recovery guidance.

Why This Change Was Made

  • Fix classification: Root cause fix.
  • Complete shipped solution: The launch path now stores stderr through a bounded diagnostics accumulator: it keeps the 64 KiB byte tail for redacted display, tracks recovery/hint signals while chunks stream, renders the newest display slice with 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.
  • Why this is root-cause fix: The memory bound remains at the stderr collection boundary, while the downstream behavior that previously depended on the full stderr stream now has independent bounded state for the facts it needs. This fixes the correctness regressions instead of widening the retained buffer or adding an after-the-fact fallback.
  • Source of truth boundary: launchOpenClawChrome remains the owner of managed-Chrome launch diagnostics and retry decisions. The source of truth for the public diagnostic size cap remains CHROME_STDERR_HINT_MAX_CHARS; this patch only changes the private launch-time stderr retention and signal tracking that feed that existing diagnostic path.
  • Scope boundary / what did not change: No dependency, workflow, public API, config, schema, launch-timeout, retry-count, Chrome launch argument, CDP readiness probing, browser selection, redaction policy, displayed diagnostic cap, or post-success Chrome stderr behavior changes. The listener is still detached and the retained diagnostics state is cleared when the launch attempt exits.
  • Compatibility, merge-risk, or maintainer-decision notes: No public API, user config, schema, protocol, wire/data format, default value, or migration contract changes. This is an internal managed-Chrome launch diagnostic behavior fix. A real managed-Chrome failure proof has now been supplied for the current head, using a locally installed Chrome executable and the actual launchOpenClawChrome implementation.
  • Risk labels considered: merge-risk: availability.
  • Risk explanation: Browser startup failure handling is availability-sensitive: a regression could disable stale-lock recovery, hide missing-display/profile-lock hints, or show stale/malformed stderr during Chrome launch failures.
  • Why acceptable: The patch narrows that availability risk by preserving recovery/hint facts independently from the bounded display tail, rendering the newest stderr slice, and adding focused regressions for the exact retry/hint/display/UTF-8 cases requested by the maintainer. It does not change launch arguments, CDP probing, retry count, timeouts, public configuration, or post-success Chrome behavior.
  • Related open PR scan / contract boundary: init-pr detected 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 remains launchOpenClawChrome.
  • Out of scope boundary: Public browser configuration semantics, Chrome executable discovery, CDP diagnostic protocol behavior, and redaction policy are out of scope for this code repair. The real binary proof below covers the managed-Chrome launch-failure diagnostic path; OS-specific stale Singleton lock and missing-DISPLAY setup remain covered by the deterministic focused regressions.

User Impact

  • Users/operators/developers can now: Hit noisy Chrome launch failures with bounded stderr memory while still getting the newest redacted stderr tail and the existing stale-lock / missing-display guidance when those markers appeared earlier in the stream.
  • Existing behavior preserved: Stale Chromium Singleton lock recovery still runs from the original marker, missing-display/profile-lock hints still render, stderr is still redacted before display, and the displayed hint remains capped by CHROME_STDERR_HINT_MAX_CHARS.
  • What was not tested or remains unavailable: Real binary proof is complete for the managed-Chrome launch-failure reporting path on Windows using Chromium's --crash-test startup 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 head 7fe9bfcf83588d142380ce1e14ef9c827414310c. 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-drift reported sync_main_required=true; daily_fix.sh sync-main replayed the two PR commits onto current origin/main, then the validations below were rerun.

  • Remote checks after sync: Current PR head 7fe9bfcf83588d142380ce1e14ef9c827414310c settled with FAIL 0 / PENDING 0 / PASS 69 / SKIPPED 30 after 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 included All 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.
    • A one-off proof harness ran with OPENCLAW_HOME, OPENCLAW_CONFIG_PATH, and OPENCLAW_REAL_CHROME_EXE set for an isolated local Chrome proof environment — exit 0. The harness imported launchOpenClawChrome from the current PR head, used a locally installed real Chrome executable (not mocked child_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:

      Failed to start Chrome CDP on port 53652 for profile "daily-fix-proof-14652". CDP diagnostic: http_unreachable after 11ms; cdp=http://127.0.0.1:53652; fetch failed: connect ECONNREFUSED 127.0.0.1:53652.
      Chrome stderr:
      :549] Component extension Chrome PDF Viewer (mhjfbmdgcfjbbpaeojofohoefgiehjai) installing/upgrading from '' to 1
      [8088:15584:0708/114050.176:VERBOSE1:extensions\browser\extension_registrar.cc:547] AddComponentExtension Google Hangouts
      [8088:15584:0708/114050.176:VERBOSE1:extensions\browser\extension_registrar.cc:549] Component extension Google Hangouts (nkeimhogjdpnpccoofpliimaahmaaome) installing/upgrading from '' to 1.3.26
      [8088:15584:0708/114050.185:VERBOSE1:chrome\browser\profiles\profile_manager.cc:2065] ForceSigninCheck: 0, 0, 1
      DevTools listening on ws://127.0.0.1:53652/devtools/browser/822007d2-dd8e-4053-9637-8a7a57c9e7dc
      [0708/114050.201:ERROR:third_party\crashpad\crashpad\client\crashpad_client_win.cc:142] crash server failed to launch, self-terminating
      
  • 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 actual launchOpenClawChrome path with a redacted stderr section.

  • Review findings addressed, if any:

    • RF-001 / RF-007 maintainer changes requested — fixed in code and covered by the focused browser Vitest regressions listed above.
    • RF-002 / RF-003 / RF-004 / RF-006 real behavior proof requests — supplied via the real managed-Chrome launch-failure proof above for current head 7fe9bfcf83588d142380ce1e14ef9c827414310c.
    • RF-005 availability-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.ts now 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 added fs.existsSync return true / return false branches are test-only fixture path controls, and the added catch blocks 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.

@vincentkoc vincentkoc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bounded-memory goal is valid, but this implementation changes recovery behavior and can emit the wrong diagnostic text.

  1. 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.
  2. 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.
  3. 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.

@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 3:25 AM ET / 07:25 UTC.

Summary
The PR bounds managed Chrome launch stderr diagnostics with a shared UTF-8-safe tail accumulator, preserves launch recovery and hint signals outside the retained tail, reuses the helper for Chrome MCP stderr, and adds focused regressions.

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.

  • Proof Head Mismatch: proof cites 7fe9bfc; reviewed head is 40b680f. The real behavior proof is strong, but it predates the final helper refactor currently being reviewed.

Stored data model
Persistent data-model change detected: serialized state: extensions/browser/src/browser/chrome.internal.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦐 gold shrimp
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add a short current-head proof note for 40b680f, or have a maintainer mark proof override for the post-proof refactor commits.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body includes real managed-Chrome launch-failure proof, but it names the earlier 7fe9bfc head; the current reviewed head is 40b680f after maintainer refactor commits, so a current-head proof note or maintainer override would settle the proof gate. Redact private paths, IPs, tokens, profile names, and other private details before posting new proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Browser startup failure handling is availability-sensitive: a bad merge here could hide launch diagnostics, skip stale-lock recovery, or regress missing-display/profile-lock hints.

Maintainer options:

  1. Confirm Current-Head Proof (recommended)
    Ask for a short proof update or maintainer override for head 40b680f before merge, since the posted real Chrome proof names 7fe9bfc.
  2. Accept Maintainer Refactor Risk
    A maintainer may decide the two latest helper refactor commits are narrow enough that the prior real Chrome proof plus focused tests cover the final head.

Next step before merge

  • [P1] The patch appears code-correct, but maintainer review or current-head proof confirmation is needed after the maintainer-added helper refactor.

Maintainer decision needed

  • Question: Should this PR be treated as proof-sufficient for head 40b680f even though the posted real managed-Chrome proof names 7fe9bfc, or should the author add a current-head proof note?
  • Rationale: The latest maintainer commits changed the shared helper used by the proved path after the PR body’s real Chrome proof was recorded, so automation should not silently treat stale proof as current-head proof.
  • Likely owner: steipete — steipete authored the post-proof helper refactor commits and is the current assignee, so he is best placed to judge whether prior proof covers the final head.
  • Options:
    • Request Current-Head Proof (recommended): Ask for a short rerun or proof note against 40b680f before merge so the real behavior evidence matches the reviewed code.
    • Accept Prior Proof For Refactor: A maintainer can decide the two latest helper refactor commits are narrow enough that the earlier real Chrome proof plus focused tests cover the final head.

Security
Cleared: No dependency, workflow, permission, lockfile, secret-handling, or executable-source change is introduced by this patch.

Review details

Best 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 changes

Label changes:

  • add merge-risk: 🚨 availability: The diff changes the failure path that reports managed Chrome launch errors and triggers stale-lock/missing-display recovery guidance.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body includes real managed-Chrome launch-failure proof, but it names the earlier 7fe9bfc head; the current reviewed head is 40b680f after maintainer refactor commits, so a current-head proof note or maintainer override would settle the proof gate. Redact private paths, IPs, tokens, profile names, and other private details before posting new proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: Managed Chrome startup diagnostics and recovery are important but the change is scoped to browser-plugin launch failure handling.
  • merge-risk: 🚨 availability: The diff changes the failure path that reports managed Chrome launch errors and triggers stale-lock/missing-display recovery guidance.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body includes real managed-Chrome launch-failure proof, but it names the earlier 7fe9bfc head; the current reviewed head is 40b680f after maintainer refactor commits, so a current-head proof note or maintainer override would settle the proof gate. Redact private paths, IPs, tokens, profile names, and other private details before posting new proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +91, Tests +136. Total +227 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 131 40 +91
Tests 2 143 7 +136
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 274 47 +227

What I checked:

  • Repository policy read: Root and extension AGENTS.md were read fully; the review applied the guidance to inspect the whole browser plugin surface, sibling Chrome MCP stderr handling, tests, history, and proof rather than reviewing only the diff. (AGENTS.md:28, 67630e897357)
  • Current main behavior: Current main retains every Chrome launch stderr chunk in an array until launch success/failure, then concatenates the full stream for diagnostics and recovery checks. (extensions/browser/src/browser/chrome.ts:1058, 67630e897357)
  • Current main renders oldest retained diagnostic slice: Current main renders redactedStderrOutput.slice(0, CHROME_STDERR_HINT_MAX_CHARS), so a full retained stream can display older output instead of the newest launch failure tail. (extensions/browser/src/browser/chrome.ts:1116, 67630e897357)
  • PR helper owns bounded UTF-8 tail storage: The reviewed head adds createBoundedUtf8Tail, which stores at most maxBytes, copies caller-owned buffers, and decodes from a UTF-8 boundary. (extensions/browser/src/browser/bounded-utf8-tail.ts:19, 40b680f735bd)
  • PR preserves recovery facts outside the tail: The reviewed head tracks singleton-in-use and missing-display signals while chunks stream, then uses those facts for retry/hints even if the text rolls out of the retained tail. (extensions/browser/src/browser/chrome.ts:145, 40b680f735bd)
  • PR renders newest diagnostics: The reviewed head renders redactedStderrOutput.slice(-CHROME_STDERR_HINT_MAX_CHARS), preserving the newest bounded stderr text in the launch failure message. (extensions/browser/src/browser/chrome.ts:1170, 40b680f735bd)

Likely related people:

  • QiuYuang: git blame attributes the current main Chrome launch stderr collection and Chrome MCP drainStderr implementation to merge commit b62c796 from fix(agents): keep truncation surrogate-safe #102332. (role: introduced behavior; confidence: medium; commits: b62c796e51d9; files: extensions/browser/src/browser/chrome.ts, extensions/browser/src/browser/chrome-mcp.ts)
  • steipete: The live PR head includes steipete-authored commits that refactor the proposed browser fix into the shared bounded UTF-8 tail helper and buffer-ownership adjustment. (role: recent area contributor; confidence: high; commits: 6b529970b435, 40b680f735bd; files: extensions/browser/src/browser/bounded-utf8-tail.ts, extensions/browser/src/browser/chrome.ts, extensions/browser/src/browser/chrome-mcp.ts)
  • vincentkoc: vincentkoc requested the exact recovery-marker, newest-tail, UTF-8, regression, and real-proof changes that define this PR’s current acceptance boundary. (role: reviewer; confidence: high; files: extensions/browser/src/browser/chrome.ts, extensions/browser/src/browser/chrome.internal.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • 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.
Review history (7 earlier review cycles)
  • reviewed 2026-07-07T09:08:02.864Z sha b24a635 :: needs real behavior proof before merge. :: [P1] Preserve recovery markers outside the stderr tail | [P2] Show the newest failure output | [P3] Avoid splitting UTF-8 while trimming
  • reviewed 2026-07-08T01:14:51.563Z sha 0bf188f :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-08T01:23:51.214Z sha 0bf188f :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-08T03:43:12.038Z sha 0bf188f :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T04:05:40.046Z sha 7fe9bfc :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T04:14:56.112Z sha 7fe9bfc :: needs maintainer review before merge. :: none
  • reviewed 2026-07-09T07:09:10.356Z sha fca5198 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 7, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 8, 2026
@mikasa0818
mikasa0818 force-pushed the fix/chrome-stderr-tail-bound branch from 0bf188f to 7fe9bfc Compare July 8, 2026 03:49
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 8, 2026
@mikasa0818

Copy link
Copy Markdown
Contributor Author

The bounded-memory goal is valid, but this implementation changes recovery behavior and can emit the wrong diagnostic text.

  1. 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.
  2. 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.
  3. 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.

Thanks for the detailed review —I addressed the launch-diagnostics regressions you called out.

Changes made:

  • The 64 KiB stderr bound is still enforced for rendered diagnostics, but stale-lock / missing-display signals are now tracked independently while stderr streams, so early markers are not lost when they roll out of the retained tail.
  • The displayed Chrome stderr: section now renders the newest capped slice from the retained tail instead of the oldest part of the retained buffer.
  • UTF-8 trimming now avoids decoding from a leading continuation byte, so a byte-level tail trim should not introduce a leading replacement character.
  • Added focused regressions for:
    • early Singleton/profile-in-use marker rolling out of the stderr tail while still triggering stale-lock recovery,
    • early missing-display marker rolling out of the stderr tail while still producing the launch guidance,
    • newest/final stderr marker rendering,
    • split multibyte UTF-8 chunks across the trim boundary.

I also added real managed-Chrome launch-failure proof for the current head: the proof harness imported the actual launchOpenClawChrome implementation, used a locally installed real Chrome executable rather than a mocked spawn,
launched with Chromium's --crash-test startup flag, and observed the expected Failed to start Chrome CDP error with a redacted Chrome stderr: section.

After syncing current origin/main, I reran the focused validation and proof:

  • focused browser Vitest: pass
  • oxfmt --check: pass
  • oxlint --deny-warnings: pass
  • git diff --check: pass
  • real managed-Chrome failure proof: pass
  • remote checks settled with FAIL 0 / PENDING 0

ClawSweeper now marks proof: sufficient and status: 👀 ready for maintainer look.

Could you please re-review when you have a chance?

@steipete
steipete force-pushed the fix/chrome-stderr-tail-bound branch from 7fe9bfc to 6b52997 Compare July 9, 2026 06:53
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 9, 2026
@steipete
steipete force-pushed the fix/chrome-stderr-tail-bound branch from fca5198 to 40b680f Compare July 9, 2026 07:17
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 9, 2026
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Land-ready maintainer proof for 40b680f735bdb5d9d6661f98a9e85ffab4830824:

  • Rebased the contributor stack onto current main and preserved the later strict remote-CDP discovery policy.
  • Refactored managed Chrome launch and Chrome MCP diagnostics onto one browser-local, byte-bounded UTF-8 tail implementation.
  • Preserved early singleton-lock and missing-display signals independently from the evicting display tail, so recovery and launch hints survive more than 64 KiB of later stderr.
  • Accepted and fixed autoreview's backing-allocation finding: retained stderr now lives in one owned fixed-capacity Buffer rather than caller Buffer views. Fresh branch autoreview on the final code head reported no findings (correctness 0.96).
  • Added regressions for stale-lock recovery after rollover, missing-display hints after rollover, newest-tail rendering, split UTF-8 boundaries, oversized chunks, clear behavior, and caller-buffer ownership.
  • run_edad8e3a544b on sanitized AWS Crabbox passed the three focused browser files, 107/107 tests.
  • run_838b8d760f27 on sanitized AWS Crabbox passed pnpm check:changed, including extension typechecks, lint, repository guards, and the runtime import-cycle check.
  • run_91046d36f6f1 installed and launched real Chromium through launchOpenClawChrome, reached loopback CDP headlessly, then stopped cleanly with exit code 0.
  • Those Crabbox runs used code-identical tree fca5198cc9a2f67df4c4eb928200171b9755d21f; the only later difference was removal of a release-owned CHANGELOG.md commit required by the native prepare gate.
  • Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/29000111068 (attempt 2).
  • Native prepare: OPENCLAW_TESTBOX=1 scripts/pr prepare-run 101506 completed; hosted exact-head gates passed and the prepared/head SHA remained 40b680f735bdb5d9d6661f98a9e85ffab4830824 despite unrelated main drift.

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.

@steipete
steipete merged commit a522e43 into openclaw:main Jul 9, 2026
218 of 287 checks passed
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 9, 2026
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants