Repository navigation
improve(ci): new tests can pass once on their pull request and then fail intermittently on main - #2191
Conversation
…ail intermittently on main Add a pull-request-only new-test-soak job. It selects the Shared, Tray and Tray UI tests that the pull request adds or changes (method level, with type and file fallbacks; UI tests method level only) and runs them ten times, three under CPU contention. Any failure blocks CI Gate. Pull requests that change no tests skip it. Settings are environment variables only, and the step keeps a shared 40-minute budget. Co-authored-by: Copilot App <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesAdds a required pull-request job that repeatedly runs selected changed tests, including runs under CPU contention. Example: SoakMutationProbeTests.IntermittentProbe fails every third execution.
Review scores
ProductKind: Maintenance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR adds useful CI coverage absent from main, and no blocking introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGitHub Actions passes the PR merge diff through test selection, builds selected projects, collects repeated test results, and feeds the job outcome into CI Gate. flowchart LR
A[PR merge diff] --> B[Changed test selector]
B --> C[Selected project builds]
C --> D[Repeated test runs]
E[CPU contention workers] --> D
D --> F[TRX results]
F --> G[CI Gate]
Technical reviewBest possible solution: Land the supplemental changed-test soak with its documented limits while preserving all existing required test lanes. Do we have a high-confidence way to reproduce the issue? This is preventive CI coverage rather than a deterministic product bug; the supplied mutation scenario demonstrates a test passing initially and failing on its third execution. Is this the best way to solve the issue? The selector and bounded runner form a coherent supplemental lane, reuse the existing budget helper and gate, and retain ordinary coverage instead of retrying failed tests into success. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bf61595e68f1. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 13, 2026, 4:18 PM ET / 21:18 UTC. |
What Problem This Solves
Fixes: a new or changed test can pass its single pull request run and then fail intermittently on main. #1681's
DesktopCompanionWindowTests.Notification_UsesExistingMascot...did exactly that: it passed its one PR run (43475422208) and then failed on main fbc0287.User Impact
No product change. Contributors now see an intermittent new or changed test fail on their own pull request, where it is cheap to fix, instead of on main for everyone. Pull requests that change tests gain one Windows job (
new-test-soak) that CI Gate requires; pull requests that change no tests pass it after a short selection step.Why This Change Was Made
A new pull-request-only job runs the tests the pull request adds or changes ten times, three of them while CPU burner processes load the runner. Any failed run fails the job, and CI Gate requires it.
scripts/Get-CiChangedTests.ps1,scripts/CiChangedTests.ps1): diffs the merge commit against its first parent and maps changed lines in Shared, Tray and Tray UI test files to xUnit methods. A line inside a test (including a string or comment edit) selects that test. A helper change selects the tests of the nearest enclosing type with tests, or the whole file. Removed code counts, so deleting or commenting out helper code is not missed. Tray UI tests are soaked only for method-level hits (a helper edit in a large UI file would otherwise run many native tests the PR did not write). Caps: 30 tests per project and 8 UI tests; anything left out is listed with a reason.scripts/Invoke-CiTestSoak.ps1): builds each project once the way its lane does, then runsdotnet test --no-buildwith a name filter plus the existing lane exclusions. Each run gets freshOPENCLAW_TRAY_*data folders and must produce exactly one TRX. Hang detection is on, without dumps. A 40-minute step budget is shared fairly: every selected project gets its first run, and repeat runs stop at the project's share of the time left. A budget-limited soak passes with a warning.OPENCLAW_CI_SOAK_*); the runner takes only-SelectionPathand-ResultsDirectory. The job is skipped outsidepull_request, so alpha promotion is unaffected.The workflow contract pins the job shape, the runner parameters and tokens, the UI preparation steps (identical to the UI lane), and the CI Gate wiring.
docs/TEST_COVERAGE.mddocuments selection, settings, budget, exclusions and blind spots.Known limits (documented)
Evidence
SoakMutationProbeTests.IntermittentProbe) was selected (has_tests=true, method level) and the soak failed:::error title=New-test soak::shared run 3 of 10 failed: OpenClaw.Shared.Tests.SoakMutationProbeTests.IntermittentProbe(run 2 ran under CPU contention).has_tests=false, ui_tests=false, and the runner exited successfully with "no added or changed tests were selected"; no build or test ran.-r win-x64after its WinUI prebuild; both projects passed 2 of 2. The step used 1.8 of 40 minutes, and no burner processes were left afterwards.vstest --ListFullyQualifiedTestsfor the current tree: Shared 3557, Tray 4310, Tray UI 899 names, 0 differences.test-ci-workflow-contract.ps1at its intended check: an extra runner parameter, removing the job from CI Gateneeds, removing the PR-onlyif, and removing--blame-hang-dump-type nonefrom the runner.Change Type
Scope
winnodeRequired proof pools
none: CI workflow and runner scripts only. No product behavior or capacity-dependent Windows proof is affected.Validation
Local, head 6dd3bf3 on main bf61595, PowerShell 7, isolated
OPENCLAW_TRAY_*profile:scripts\test-ci-changed-tests.ps1(new)scripts\test-ci-workflow-contract.ps1scripts\test-ci-gate-results.ps1scripts\test-alpha-promotion.ps1,test-ci-change-classifier.ps1,validate-test-timing-patterns.ps1validate-docs.ps1,validate-agent-skills.ps1,test-agent-skills-validator.ps1,git diff --check./build.ps1dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restoredotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restoreCiNugetCacheWorkflowTestsat 12 cache lanes)Review: Hanselman dual review (claude-opus-5.5 high; gpt-6-astra long_context high), a first pass plus four delta passes; both models confirmed the final head 6dd3bf3 with no open CRITICAL, HIGH or MEDIUM findings. The accepted findings were fixed and have regression tests:
The LOW items not fixed are listed under Known limits.
Real Behavior Proof
OPENCLAW_TRAY_*roots; disposable git worktree for the mutation and skip proofs.scripts\Get-CiChangedTests.ps1 -BaseRef <base> -OutputPath <json>thenscripts\Invoke-CiTestSoak.ps1 -SelectionPath <json> -ResultsDirectory <dir>, with default soak settings for the mutation proof.Security Impact
contents: readandactions: read, checks out withpersist-credentials: false, and only restores the NuGet cache).Yes, explain the risk and mitigation: N/ACompatibility and Migration
OPENCLAW_CI_SOAK_*step variables with defaults; seedocs/TEST_COVERAGE.md.Review Conversations