Skip to content

chore: isolate every profile root for UI-test child processes - #1906

Merged
bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-split-ui-test-isolation
Oct 28, 2026
Merged

bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-split-ui-test-isolation

Conversation

@bkudiess

@bkudiess bkudiess commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: UI-test child processes can read or write the developer's real OpenClaw Companion profile when the accessibility fixture launches the app, because only some of the profile root variables were redirected and inherited OPENCLAW_* variables passed through.

User Impact

User impact: no user-visible change. For the accessibility fixture child process, the helper redirects the profile roots and drops inherited OPENCLAW_* configuration. A known residual escape remains: FunctionalUI.cs writes an error log to the real %LOCALAPPDATA%\OpenClawTray and is not redirected by environment variables.

Why This Change Was Made

AccessibilityAppFixture now builds the child environment through one helper, ApplyProfileIsolation. The helper removes every inherited OPENCLAW_* variable, then sets all four profile roots (OPENCLAW_TRAY_DATA_DIR, OPENCLAW_TRAY_APPDATA_DIR, OPENCLAW_TRAY_LOCALAPPDATA_DIR, and the legacy OPENCLAW_TRAY_LOCAL_DATA_DIR, which must equal <localroot>\OpenClawTray) to the fixture's own directories. The fixture sets its own variables after the helper call. New pure tests cover the contract and guard that the single process start uses the helper.

Evidence

Exact head 3f782f7a4dc69fd4a47a058db05ce13ac66a7025 (tree cc021aa7dc51d8d834c95e55470ccf051d17a3fb), one commit on de162ba66028681700b61b5cd106323ad78aa6e8. Scope: 2 files, +168/-1, both under tests\OpenClaw.Tray.UITests.

  • Focused AccessibilityFixtureIsolationTests executed: 4 passed, 0 failed (TRX verified).
  • Required closeout passed (counts below).
  • A dual-model adversarial review (Claude Opus 5.5 and GPT-6 Astra) of this exact head found no critical, high or medium findings.
  • Merge check against current main (c59652f9) with git merge-tree: clean, no conflicts. main did not change either touched file.

Known limits:

  • FunctionalUI.cs writes an error log to the real %LOCALAPPDATA%\OpenClawTray. Environment variables cannot redirect it, so it is out of scope here.
  • Unfixed low-severity review notes: the source guard does not catch multi-line Environment[ writes or alias writes, the stripping test samples three keys, and a renamed helper gives an unclear guard error. Debug switches such as OPENCLAW_TRAY_TRACE no longer reach the child by design.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • none: test-only change to UI-test fixture environment setup. Get-CiChangeClassification.ps1 classifies both paths as targeted (recognized-paths) with lane ui_tests; it lists candidate pools only as inventory, and none claim applicability (no installer, signing, MXC, GPU, ARM64, Gateway or user-visible UI behavior changed).

Validation

Run on the exact head with a clean worktree, opt-ins (OPENCLAW_RUN_E2E, OPENCLAW_RUN_MXC_E2E) unset, and task-owned temp profile roots:

  • ./build.ps1: exit 0.
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj: 4644 passed, 25 skipped, 0 failed.
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj: 4507 passed, 0 failed.
  • dotnet test tests/OpenClaw.Tray.UITests/OpenClaw.Tray.UITests.csproj -p:Platform=x64 --filter "FullyQualifiedName~AccessibilityFixtureIsolationTests": 4 passed, 0 failed. These tests are pure and launch no app.

The full UI suite was not run locally. The planner configures a hosted ui-tests lane for these paths; at the last check (11:23 local) CI had not completed (change-classification and Advanced setup gate passed; fast-validation and Proof-pool contracts pending; ui-tests completion not observed).

Real Behavior Proof

  • Environment tested: local Windows 11 dev machine, task-owned temp profile roots, no app or Gateway launched.
  • PR head or commit tested: 3f782f7a4dc69fd4a47a058db05ce13ac66a7025
  • Exact steps or command run: the focused dotnet test command above.
  • Evidence after fix: TRX shows 4 executed tests: TwoRunsReceiveDistinctRootsForEveryVariable, ChildEnvironmentOverridesConflictingInheritedRootsAndLegacyAlias, FixtureLaunchPathsAllUseTheIsolationHelper, ChildEnvironmentDropsEveryInheritedOpenClawVariable.
  • Observed result: all 4 passed.
  • Screenshot or artifact links verified? N/A
  • Not verified or blocked: no screenshot or runtime UI proof, because this is a test-only change with no UI claim. The tests exercise the helper and a source guard, not a live fixture-launched app. The real-profile metadata comparison during the run showed no roaming change; four files under the real local profile (attachment-metadata.json, last-chat-state.json, openclaw-tray.log, tool-metadata.json) changed during the observation window. Attribution is not established: no process-owned evidence was collected, and the focused test process ran for 1.9 seconds and is designed to start no app.

Security Impact

  • New permissions or capabilities? No
  • Secrets or tokens handling changed? No
  • New or changed network calls? No
  • Command or tool execution surface changed? No
  • Data access scope changed? No (test child processes now read less of the developer's environment and profile)
  • If any answer is Yes, explain the risk and mitigation: N/A

Compatibility and Migration

  • Backward compatible? Yes
  • Config or environment changes? No (UI-test child environment only; no product configuration changes)
  • Migration needed? No
  • If yes, list the exact upgrade steps: N/A

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

Add ApplyProfileIsolation so the fixture child gets run-owned DATA, APPDATA, LOCALAPPDATA and legacy LOCAL_DATA roots, with pure regression tests.

Co-authored-by: Copilot App <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 28, 2026
@clawsweeper

clawsweeper Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codex review: needs changes before merge.

What this changes

The PR clears inherited OpenClaw environment variables and redirects four profile overrides before accessibility-test child processes start.

Example: A fixture run uses C:\Temp\OpenClaw.Tray.Axe.123 while inheriting OPENCLAW_TRAY_LOCAL_DATA_DIR=C:\Users\Ada\AppData\Local\OpenClawTray.

  • Before: The child retains the inherited setup-local directory.
  • After: The child receives C:\Temp\OpenClaw.Tray.Axe.123\local-root\OpenClawTray instead.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A useful, focused fixture repair with unit-level evidence, one small test-owner violation, and an exact-head UI check whose failure could not be classified through the available network.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored, test-only PR is outside the ordinary contributor proof gate; its reported helper tests do not establish live child-process isolation, and the unattributed real-profile changes are not treated as proof.
Patch quality 🐚 platinum hermit (4/6) 1 actionable review finding remain.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Developers running accessibility tests can expose their real Companion profile through inherited child-process configuration.
Reason: The maintainer-authored direction repairs an established isolation contract; the body explicitly limits its claim to environment-overridable roots and discloses the existing direct-known-folder logger.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this maintainer-authored PR addresses a real fixture-isolation gap still present on main; no P0-P2 defect was found.

Priority: P2
Reviewed head: 3f782f7a4dc69fd4a47a058db05ce13ac66a7025

Before merge

  • Reuse the authoritative temporary-directory helper (P3) - The new tests introduce NewRunDirectory and DeleteOwned plus repeated try/finally cleanup even though OpenClaw.TestSupport.TempDirectory already owns precisely this lifecycle and is referenced by this project. The root test-authoring route requires reusing that helper, and the architecture ledger names it authoritative. Use disposable TempDirectory instances and their Path values instead of adding a competing allocation and cleanup implementation.

Findings

  • [P3] Reuse the authoritative temporary-directory helper — tests/OpenClaw.Tray.UITests/AccessibilityFixtureIsolationTests.cs:18-19

Tests

  • Low-value test tests/OpenClaw.Tray.UITests/AccessibilityFixtureIsolationTests.cs: Remove TwoRunsReceiveDistinctRootsForEveryVariable: the exact-root assertions already require every output to derive from the supplied run directory, so comparing two generated inputs adds no distinct failure coverage.
  • Missing end-to-end proof: The supplied evidence does not show a base-fail/head-pass control or a fixture-launched child resolving these paths; the reported four passing checks exercise the helper and source guard only.
Agent review details

How this fits together

AccessibilityAppFixture launches the real Companion executable for startup and deep-link navigation, supplying child environment variables consumed by application and setup profile resolvers.

flowchart LR
  A[Parent environment] --> B[AccessibilityAppFixture]
  B --> C[Clear inherited OpenClaw variables]
  C --> D[Set run-owned profile roots]
  D --> E[Launch Companion child]
  E --> F[Application and setup path resolvers]
Loading

Technical review

Best possible solution:

Keep isolation in the existing StartProcess owner, preserve the narrow environment-override contract, and use the shared temporary-directory owner in its tests.

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

Source shows that main forwards inherited setup-local overrides into the child while the corresponding resolvers consume them; no runtime reproduction was executed during this read-only review.

Is this the best way to solve the issue?

The existing process-launch owner is the right repair boundary, and setting the modern roots plus legacy alias addresses the demonstrated environment leak without changing shipped defaults.

Full review comments:

  • [P3] Reuse the authoritative temporary-directory helper — tests/OpenClaw.Tray.UITests/AccessibilityFixtureIsolationTests.cs:18-19
    The new tests introduce NewRunDirectory and DeleteOwned plus repeated try/finally cleanup even though OpenClaw.TestSupport.TempDirectory already owns precisely this lifecycle and is referenced by this project. The root test-authoring route requires reusing that helper, and the architecture ledger names it authoritative. Use disposable TempDirectory instances and their Path values instead of adding a competing allocation and cleanup implementation.
    Confidence: 0.97

Overall correctness: patch is correct
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: unit tests only.

Security

None.

Evidence

Acceptance criteria:

  • ./build.ps1
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore
  • dotnet test ./tests/OpenClaw.Tray.UITests/OpenClaw.Tray.UITests.csproj -p:Platform=x64 --filter FullyQualifiedName~AccessibilityFixtureIsolationTests

What I checked:

Likely related people:

  • Karen: Raw commit e0a2301 adds tests/OpenClaw.Tray.UITests/AccessibilityAppFixture.cs:31 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e0a2301ce2e8; files: tests/OpenClaw.Tray.UITests/AccessibilityAppFixture.cs)
  • Scott Hanselman: Raw commit 588df90 adds tests/OpenClaw.Tray.UITests/AccessibilityAppFixture.cs:34 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 588df9071f0f; files: tests/OpenClaw.Tray.UITests/AccessibilityAppFixture.cs)
  • Barbara Kudiess: Raw commit ad47224 adds tests/OpenClaw.Tray.UITests/AccessibilityAppFixture.cs:32 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ad472243bcb8; files: tests/OpenClaw.Tray.UITests/AccessibilityAppFixture.cs)
  • Paul Campbell: Raw commit f5f1033 adds tests/OpenClaw.Tray.UITests/AccessibilityAppFixture.cs:54 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f5f10336eb87; files: tests/OpenClaw.Tray.UITests/AccessibilityAppFixture.cs)

Review metrics

Metric Value Why it matters
Change footprint Shipped production +0/-0; fixture +25/-1; regression tests +143/-0 The environment repair is focused; the test addition includes avoidable temporary-directory scaffolding and a redundant uniqueness case.

Labels

Label changes:

  • add P2: Protecting developer profile state during accessibility runs is a useful, limited-scope test-infrastructure repair.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: Protecting developer profile state during accessibility runs is a useful, limited-scope test-infrastructure repair.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Use TempDirectory and remove the redundant two-run uniqueness test.
  • Inspect the failing UI job's TRX or logs to establish whether its failure is attributable to this diff.

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.

Reviewed October 28, 2026, 11:39 AM ET / 15:39 UTC.

@bkudiess
bkudiess merged commit 326884e into openclaw:main Oct 28, 2026
52 of 54 checks passed
larroy pushed a commit to larroy/openclaw-windows-node that referenced this pull request Oct 30, 2026
…nclaw#1906)

Isolate inherited OpenClaw environment variables and all profile roots for accessibility UI-test child processes. Add focused regression coverage for child environment isolation.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant