Skip to content

fix(tests): reduce settings publication flakes under load - #2359

Merged
bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-flake-settings-sandbox-publication
Nov 23, 2026
Merged

bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-flake-settings-sandbox-publication

Conversation

@bkudiess

Copy link
Copy Markdown
Collaborator

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 56cd925449ad7ca2c31e176e23ab239afce10ff8

Dimension Assessment Rationale
Change confidence 7.5/10 ↑ Full managed suites and repeated contention runs passed on the same patch.
↓ No local reproduction of the CI failure; CI on this head is pending.
Diagnosis confidence 6.5/10 ↑ CI timeouts and blocking ThreadPool work are consistent with starvation.
↓ Targeted injection did not reproduce the CI stack.
Evidence fit 6/10 ↑ The failing tests synchronously block callbacks while waiting for concurrent work.
↓ No trace proves starvation caused the observed failures.

What Problem This Solves

Settings publication tests have repeatedly failed on CI under load, delaying validation of unrelated changes. Two tests timed out and another observed an unexpectedly completed operation in CI run 44961910362.

User Impact

No user-visible change. Developers get tests less dependent on shared ThreadPool availability.

Why This Change Was Made

Blocking test operations run on dedicated threads. Named, configurable wait budgets keep failures bounded, and the saved-callback test explicitly checks for a swallowed callback timeout. The affected class and helper path were swept for the same pattern.

Evidence

The 10-test class passed after rebasing, and the same patch passed repeated runs with both screenshot settings and CPU contention. Diagnosis-only, not reproduced: the class-6 ThreadPool-starvation hypothesis rests on the CI log and code shape, not a local reproduction. Targeted injection attempts did not produce the CI stack, so there is no RED/GREEN claim. The issue remains on watch.

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: managed test-only change; no capacity-dependent custom Windows proof pool applies.

Validation

The full suites and contention repetitions ran on the same uncommitted patch based on 9ced24fc53041648d696a86aaf8df55c4305e65e. The intervening base changes did not touch the affected test, settings store or callback code, or timing baseline. After rebasing to 15b4276c7d2ce696918d5fa7a4cf5010db25c6a4, the build, focused class, and timing ratchet passed again.

  • .\build.ps1: passed after rebase.
  • dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: passed before rebase, 5,972 passed and 29 expected skips. An earlier invocation failed on a corrupted generated reference assembly; it was rebuilt and the suite passed.
  • dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: passed before rebase, 6,938 passed.
  • dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --filter FullyQualifiedName~OpenClaw.Tray.Tests.SettingsSandboxPublicationTests: passed after rebase, 10 passed.
  • scripts\Invoke-CiTestSoak.ps1 -SelectionPath <selection> under Invoke-WithDesktopLock.ps1: before rebase, 10 repetitions passed with screenshots off and 10 with screenshots on, including three CPU-contended runs in each matrix.
  • pwsh -NoProfile -File .\scripts\validate-test-timing-patterns.ps1: passed after rebase.
  • git --no-pager diff --check: passed after rebase.

Claude Opus 5.5 and GPT-6 Astra reviewed the patch independently. An earlier callback timeout finding was fixed and reviewed again; the final review reported no medium-or-higher findings. Two low-only suggestions were not incorporated.

Real Behavior Proof

  • Environment tested: local Windows, isolated tray data directories.
  • PR head or commit tested: same uncommitted patch as 56cd925449ad7ca2c31e176e23ab239afce10ff8, based on 15b4276c7d2ce696918d5fa7a4cf5010db25c6a4.
  • Exact steps or command run: focused class command in Validation.
  • Evidence after fix: Failed: 0, Passed: 10, Skipped: 0, Total: 10.
  • Observed result: all settings publication class tests passed.
  • Screenshot or artifact links verified? (Yes/No/N/A): N/A.
  • Not verified or blocked: original CI failure was not reproduced locally; causal diagnosis remains unconfirmed. Current-head CI is pending.

Security Impact

  • New permissions or capabilities? (Yes/No): No
  • Secrets or tokens handling changed? (Yes/No): No
  • New or changed network calls? (Yes/No): No
  • Command or tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): No
  • If any answer is Yes, explain the risk and mitigation: N/A

Compatibility and Migration

  • Backward compatible? (Yes/No): Yes
  • Config or environment changes? (Yes/No): Yes, optional test-only OPENCLAW_TRAY_TEST_CONCURRENCY_TIMEOUT_SECONDS.
  • Migration needed? (Yes/No): 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.

@clawsweeper

clawsweeper Bot commented Nov 23, 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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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 Nov 23, 2026
@clawsweeper

clawsweeper Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR moves blocking settings-publication test work onto dedicated threads and replaces short waits with configurable budgets.

Example: A loaded CI runner executes SavedCallbacksRunOutsideSettingsSerialization.

  • Before: The second save uses Task.Run with a 5-second wait and can be delayed by shared ThreadPool pressure.
  • After: The save uses a dedicated thread with a default 15-second wait, and a callback timeout explicitly fails the test.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct test repair with passing current-head validation, although causal proof of the original flake remains limited.
Proof confidence 🦐 gold shrimp (3/6) No shipped behavior changes; the author reports focused and contention runs, and GitHub confirms passing current-head test-soak and Tray-suite jobs.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Developers encounter intermittent settings-publication failures while validating unrelated changes.
Reason: The maintainer-authored direction follows established timing policy and improves the existing tests without expanding product scope.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR makes a focused test-reliability improvement, preserves the concurrency contracts, and has no actionable introduced defects.

Priority: P2
Reviewed head: 56cd925449ad7ca2c31e176e23ab239afce10ff8

Before merge

None.

Findings

None.

Agent review details

How this fits together

Tray tests exercise SettingsManager persistence and SettingsStore notifications, checking that committed snapshots publish correctly while callbacks and concurrent edits overlap.

flowchart LR
  A[Concurrency tests] --> B[Dedicated workers]
  B --> C[SettingsManager]
  C --> D[Settings file and policy snapshot]
  C --> E[Saved callbacks]
  E --> F[SettingsStore notifications]
Loading

Technical review

Best possible solution:

Land the focused scheduling repair while retaining all existing publication, rollback, ordering, and origin assertions.

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

GitHub records the affected test failures, but the author explicitly reports that local injection did not reproduce them and ThreadPool starvation remains a hypothesis.

Is this the best way to solve the issue?

Dedicated workers remove the identified scheduling dependency without changing production owners or weakening assertions, and the timeout setting reuses an existing test convention.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Settings-publication concurrency tests keeps the original intent (932bc0e: Protect committed policy publication, callback lock release, rollback, and detached notification snapshots for Sandbox-backed transfers.)
  • Timing-pattern baseline keeps the original intent (ee8edbc: Ratchet existing timing-sensitive patterns downward while rejecting new occurrences.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Barbara Kudiess: Raw commit 932bc0e adds tests/OpenClaw.Tray.Tests/SettingsSandboxPublicationTests.cs:125 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 932bc0e3c7b7; files: tests/OpenClaw.Tray.Tests/SettingsSandboxPublicationTests.cs)

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: Recurring settings-publication test failures disrupt developer validation without an established shipped-user regression.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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: Recurring settings-publication test failures disrupt developer validation without an established shipped-user regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 November 23, 2026, 2:59 PM ET / 19:59 UTC.

@bkudiess
bkudiess merged commit 72a67f3 into openclaw:main Nov 23, 2026
38 checks passed
vincentkoc added a commit that referenced this pull request Nov 24, 2026
…ersion7-coordinated-2355-20261124

* commit 'f86e395d5c8edbc968d8d6e789d1ac16a1124a80':
  fix(tests): read chat text from complete UIA snapshots (#2364)
  fix: reduce typing lag in long chats (#2343)
  fix(tests): wait for the Sessions gallery window (#2337)
  fix(migration): keep the shutdown request until the receiver reads it (#2360)
  fix(tests): isolate settings publication tests from ThreadPool pressure (#2359)
  fix: keep candidate builds from contending on GitHub environment exports
  fix(tests): prevent stale chat ink captures (#2357)
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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant