Skip to content

fix(test): prevent Chromium crashes under deep temporary roots - #196509

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-deep-tmpdir-chromium-socket-path-20260919
Nov 10, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-deep-tmpdir-chromium-socket-path-20260919

Conversation

@steipete

@steipete steipete commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes Chromium aborting with “Socket path too long” when agents run UI tests with TMPDIR beneath a deeply nested worktree.

User Impact

UI tests can launch Chromium from deep worktrees. Workspace-only file guidance now distinguishes disposable output files from native tools’ inherited temporary directories. No configuration changes are needed.

Why This Change Was Made

The Vitest process owner now reserves 45 bytes for Unix socket suffixes and the terminating NUL within the portable 104-byte limit. It uses /tmp when the canonical inherited path exceeds that budget, while keeping the inherited owner's claim, process-group settlement, neutral package scope, and cleanup behavior. Windows keeps its existing path handling.

Chromium creates its singleton socket under its temporary directory (source); its POSIX temp resolver reads TMPDIR (source). Playwright supports a launch env override, but the test-process owner fixes the shared boundary for all subprocesses without per-browser workarounds.

Evidence

  • Linux ARM64, Node 26.12.1, Playwright 1.64.1, Chromium 156: real node scripts/run-vitest.mjs ui/src/e2e/chat-flow.messaging.e2e.test.ts --maxWorkers=1 aborts before the fix with a 142-byte singleton socket path. Both fixed trials pass 10/10 tests with a 62-byte socket path; no owned temp directories remain.
  • New runner regression fails before the fix for oversized ASCII and multibyte roots; safe-boundary, inherited-claim, socket-binding, and cleanup cases pass afterward. Existing cleanup/cache suites: 87 passed, one Windows-only skip; 259.16 seconds including the existing process-lifecycle matrix. Original prompt/read/prefix-stability suites: 53 passed in 62.73 seconds including cold compilation. After integrating the shared recovery-hint owner from fix: give root-aware recovery when file tools reject another repository #194473, all 63 affected prompt, read, patch/worktree, sandbox, and prefix-stability tests pass in 53.26 seconds. Tooling test typecheck passed.
  • Thirty real owner spawns per A/A trial: before 376.9–402.3 ms wall, 51.1–54.9 ms owner CPU, 2.33–2.42 MB sampled allocations; after 341.5–359.7 ms, 43.3–44.0 ms, 2.22–2.25 MB. Local measurement only. The successful full UI runs take 22.4–23.7 seconds because they now reach the build and tests; startup aborts took 2.1–2.4 seconds.
  • Fixture: 62,000 synthetic files / 1.1 GB plus a sparse 35 GiB placeholder. Docker uses overlayfs; this does not qualify btrfs or populated database performance. The changed owner neither scans workspace contents nor opens the database.
  • Isolated Codex autoreview: no actionable findings through P2. pnpm check:changed completed: all checks passed except the dead-export scan (32 production and 10 full-tree entries in unchanged owners). The same signatures reproduce on both exact main parents; source-history attribution is below. This remains a failed gate, not a passing result.

Production LOC net 0; tooling +7; tests +56; docs +10. The test-line allocation covers byte-boundary/socket ownership regressions and the prompt-policy assertion. Existing retention fixtures use explicit short roots so they continue testing nested containment; the new regression tests relocation. Changelog remains release-owned.

Inherited main dead-export regression: exact-parent proof and source attribution

node --import tsx scripts/check-deadcode-exports.mts fails identically on original parent baccc7e152916c7f4a48596b5cb544c12264ac54 and final parent cdd7ee54ee8df226291bb97a1077731f40fbd273: 32 production and 10 full-tree findings, zero signature differences; the script scan passes. The isolated baseline uses the same existing dependency installation. A first baseline attempt with missing workspace module links was discarded as a setup failure; the qualified results use all workspace dependency links.

These are real main maintenance regressions. Attribution comes from commit diffs and commit-tree consumer references, not a claimed whole-gate bisect at every introducing commit.

Unused export group Introducing export or production-consumer cutover
nestRequiredSummaryHeadings #196207, c7152f3bda8e
models-config, auth-storage, model-registry, client-cap and OOM facades #192552, 625945b7ae01
MCP tool-directory constant and sanitizer #196252, 80ba593b8b14
replyWithBillingRouteWarnings #191326, 56617cd00086
Six provider auth/catalog barrel exports #190205, f63e5cd0f6d3
Four provider auth type barrel exports #190544, cf1ae7bb6a72
BROWSER_PAIR_CODE_LENGTH #191513, d85ebfe8daad
Dashboard authorDisplayName 832bbf926fc55ec102bde3fb1a1b5e4341b848b6
Provider failover and external-auth barrel exports #132716, 964fa991c0af
External-auth facade #139911, 071f606eae77
resolveProviderRuntimePlugin barrel a7436c8b4a93bff59d099661d2b206bb0627ac2b
resolveProviderModernModelRef production caller moved into test helpers #129184, 33d8f24c9926
isLaunchctlNotLoaded caller moved to concrete owner #130634, b4262689db5d
parseLaunchAgentEnabled exported with only an internal production call #103537, 7713e8fb749e
resolveLaunchAgentPlistPath caller moved to concrete owner #151777, 5e5912058286

Final-head CI and inherited test-line debt

On head 8daf57c672d28223e92eaa01aa8bff4467d91b84, all selected test, type, lint, documentation and UI e2e shards passed. Codex review is clean; ClawSweeper revision 2 reports zero open items on this exact head. OpenGrep and CodeQL quality/security initially failed when GitHub exhausted its installation API quota during upload. Only failed jobs were retried after newer runs showed recovery; all three workflows passed attempt 2.

CI run 42778351212 remains red solely for the test-line ratchet and its aggregate gate. Its tested merge is 22f24153e6478b18affb6b9cfd9cd2aa22925c5f, with ordered parents main d3027457406b7c694ba00dd0f1cd506567f43878 and this PR head. The merge has 6,619,045 test lines against a 6,618,752 ceiling: 293 over, with this PR's +56 covered by its separate 56-line allocation.

The exact main parent already has 6,618,989 lines against a 6,618,696 ceiling, also 293 over. Native reproduction on that tree against the immutable pre-debt base (e6afc3c54002^) exits 1. Comparing main to itself or its zero-growth immediate parent exits 0 because the checker tolerates debt when delta is zero; those passing comparisons are not presented as failed reproductions. Source LF counts attribute the debt to #194996 (e6afc3c54002, +71 without allocation), #188748 (441b6139039d, +223 without allocation), and #194429 (baccc7e15291, -1). This is a real inherited main budget regression, separate from the local unused-export failures above. No ceiling or unrelated tests were changed to hide it.

@clawsweeper

clawsweeper Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T07:55:00.457607Z 8daf57c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts docker Docker and sandbox tooling agents Agent runtime and tooling labels Nov 10, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

Please review the final candidate at b1e8470384b52f5ae9c3ea0926a9c2985a8b2d4c, particularly inherited resource-owner claims when a long temporary root relocates. The real Linux UI e2e reproduces the fatal Chromium startup abort on the parent and passes after this change. Local dead-export findings in unchanged owners are under exact-parent attribution; they are disclosed in the PR body.

@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the clawsweeper:intake:bug Preliminary submission classification; full source review pending. label Nov 10, 2026
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR relocates oversized POSIX test temporary directories to /tmp and clarifies workspace output guidance.

Example: Run the Chromium chat-flow tests with TMPDIR beneath a deep worktree.

  • Before: The reported singleton socket path is 142 bytes and Chromium aborts.
  • After: The reported socket path is 62 bytes, all 10 tests pass, and owned temporary directories are removed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused repair with relevant reported end-to-end proof and no actionable findings; hosted analysis remains incomplete because of GitHub rate limits.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied Linux ARM64 report exercises scripts/run-vitest.mjs through actual Chromium startup: the parent aborts on an oversized socket path, both fixed trials pass all 10 tests, and cleanup leaves no owned directories.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Chromium aborts before UI tests start when inherited temporary paths exceed Unix socket limits.
Reason: The maintainer-authored change addresses an observed launch failure through the existing shared owner without new settings or ownership machinery.

Merge readiness

✅ Ready for maintainer review

This PR fixes a concrete test-runner failure without adding another ownership path; the earlier merge conflict is resolved, and no actionable patch defects were found.

Priority: P2
Reviewed head: 8daf57c672d28223e92eaa01aa8bff4467d91b84

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Vitest process owner receives subprocess specifications and inherited environment variables, allocates temporary storage, launches children, and releases storage after process and resource completion.

flowchart TD
A[Vitest CLI] --> B[Process owner]
B --> C[Inherited resource claim]
B --> D[Short temporary namespace]
D --> E[Vitest and Chromium]
E --> F[Process and resource settlement]
F --> G[Cleanup and claim release]
Loading

Technical review

Best possible solution:

Keep the byte-budget check in the existing Vitest process owner while preserving inherited claims and shared workspace recovery guidance.

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

Main propagates arbitrarily deep inherited roots into child TMPDIR; the supplied Linux reproduction identifies Chromium's overlong singleton socket, but this review executed no target code.

Is this the best way to solve the issue?

This is the smallest complete shared fix: shorten allocation at the process owner, retain lifecycle ownership, and distinguish reusable outputs from native temporary directories.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d3027457406b.

Provenance checked

  • Vitest allocation and nested cleanup keeps the original intent (1cf0c31: Require positive nested-resource release before deleting containing namespaces, including after worker crashes or swallowed cleanup errors.)
  • Workspace-only prompt guidance keeps the original intent (9445960: Keep outputs needed by workspace-contained file tools inside the workspace without relaxing containment.)
  • Shared recovery-hint owner keeps the original intent (5d5c90e: Centralize file-tool recovery and distinguish configuration, recorded-session, and required-root boundaries.)
  • Neutral fixture package scope keeps the original intent (300b020: Prevent temporary fixtures from inheriting an enclosing checkout's package scope.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 1cf0c31 adds scripts/lib/vitest-process.mts:57 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1cf0c31f305e; files: scripts/lib/vitest-process.mts)
  • Jason O'Neal: Raw commit 5d5c90e adds src/agents/apply-patch-containment-hint.ts:43 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5d5c90e1e4e5; files: src/agents/apply-patch-containment-hint.ts)
  • tianxiaochannel-oss88: Raw commit 9445960 adds src/agents/system-prompt.ts:930 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 9445960d9de5; files: src/agents/system-prompt.ts)

PR surface

Source 0, Tests +56, Docs +10, Other +9. Total +75 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 2 2 0
Tests 3 66 10 +56
Docs 2 10 0 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 2 10 1 +9
Total 9 88 13 +75

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: The failure blocks Chromium-based development tests under deep temporary roots, with limited impact outside that workflow.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The failure blocks Chromium-based development tests under deep temporary roots, with limited impact outside that workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-10T07:41:31.135Z sha b1e8470384b52f5ae9c3ea0926a9c2985a8b2d4c :: needs changes before merge. :: none

Reviewed November 10, 2026, 2:58 AM ET / 07:58 UTC (Revision 2).

Keep test TMPDIR paths within the Unix socket budget while retaining containing-owner claims and cleanup. Clarify that workspace-local scratch guidance applies to output files, not process temporary directories. Linux UI e2e reproduces the startup abort before the fix and passes afterward.
@steipete
steipete force-pushed the steipete/perf-micro-deep-tmpdir-chromium-socket-path-20260919 branch from b1e8470 to 8daf57c Compare November 10, 2026 07:52
@steipete

Copy link
Copy Markdown
Contributor Author

Addressed item 1 — resolve the merge conflict in 8daf57c672d28223e92eaa01aa8bff4467d91b84, rebased onto cdd7ee54ee8df226291bb97a1077731f40fbd273.

The output-file wording now lives in the shared withWorkspaceRecoveryHint owner. The read wrapper keeps main's delegation to that owner; the superseded local helper was not restored. All 63 affected prompt, read, linked-worktree, sandbox, and prefix-stability tests pass after integration, and fresh isolated Codex review has no actionable P0–P2 findings.

The updated body also contains exact-parent reproduction and causal attribution for the unchanged dead-export failure. Every other pnpm check:changed gate passed on the final candidate.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 7cba067 into main Nov 10, 2026
164 of 176 checks passed
@steipete
steipete deleted the steipete/perf-micro-deep-tmpdir-chromium-socket-path-20260919 branch November 10, 2026 08:18
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 11, 2026
…law#196509)

Keep test TMPDIR paths within the Unix socket budget while retaining containing-owner claims and cleanup. Clarify that workspace-local scratch guidance applies to output files, not process temporary directories. Linux UI e2e reproduces the startup abort before the fix and passes afterward.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:intake:bug Preliminary submission classification; full source review pending. docker Docker and sandbox tooling docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant