Skip to content

fix(ci): Build and Test flakes when Workspace keyboard input or console tail polling runs late - #1597

Merged
RomneyDa merged 7 commits into
mainfrom
fix/main-ci-flakes
Oct 2, 2026
Merged

RomneyDa merged 7 commits into
mainfrom
fix/main-ci-flakes

Conversation

@larroy

@larroy larroy commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes timing-dependent Build and Test failures when console-tail continuations run after another poll or Workspace tests interact during sidebar rebuilds and native window activation.

User Impact

No product behavior change. Current-head CI is green. This PR does not claim that every main-branch CI failure or the underlying intermittent keyboard-delivery issue is resolved.

Why This Change Was Made

  • Snapshot console-tail cursors inside the message callback so late continuations cannot observe another poll.
  • Wait through missing/stale sidebar items during selection transitions.
  • Use UI Automation Invoke for session/draft-preservation proof, retaining native foreground/focus readiness before invocation.
  • Keep mandatory Space activation and focus-transfer coverage in NativePagesAndOwnerLinks_KeepCompanionIndependent. Collapse and reopen keyboard paths use the existing foreground/focus helper. No keyboard retries, fallback activation, or COM-error suppression were added.

The original focus assertion proved focus before sending Space, not key delivery. Remaining uncertainty and unrelated failures are tracked in docs/CI_FAILURES.md.

Evidence

Current head 843d4f5f: Build and Test passed, including UI, functional, accessibility, tray/setup/integration, and CI Gate. CodeQL passed.

The preceding head bef916a9 passed local required validation and 12/12 focused Workspace cases, but its CI run exposed a COM exception after the activation barrier was removed. 843d4f5f restores that barrier and passes CI without suppressing the error.

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 changes covered by existing hosted UI and tray jobs; no new capacity-dependent product proof requirement.

Validation

Current-head hosted CI:

  • ./scripts/Invoke-CiTest.ps1 -Project tests/OpenClaw.Tray.UITests -ResultsDirectory TestResults\TrayUI -TrxFileName OpenClaw.Tray.UITests.trx -Runtime win-x64 -Filter "Category!=Accessibility&Category!=NativeOnboardingProof" -HangTimeoutSeconds 300: 441 passed, 14 skipped, 0 failed.
  • ./scripts/Invoke-CiTest.ps1 -Project tests/OpenClawTray.FunctionalUI.Tests -ResultsDirectory TestResults\FunctionalUI -TrxFileName OpenClawTray.FunctionalUI.Tests.trx -Runtime win-x64: 19 passed, 0 failed.
  • dotnet test tests/OpenClaw.Tray.UITests --no-build -c Debug -r win-x64 --verbosity normal --results-directory TestResults\Accessibility --logger "trx;LogFileName=Accessibility.trx" --filter Category=Accessibility: 23 passed, 0 failed.
  • Tray/setup/integration job and CodeQL: passed. Non-selected core, E2E, and release lanes were skipped by the existing change classifier, not run.

Last completed local closeout, bef916a9, native Windows ARM64, isolated tray roots and OPENCLAW_REPO_ROOT set:

  • .\build.ps1: passed, all projects.
  • dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: 4,223 passed, 34 skipped, 0 failed.
  • dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: 3,862 passed, 0 failed.
  • dotnet build .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-arm64 --no-restore: passed, one existing obsolete-API warning.
  • dotnet test .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj --no-build -c Debug -r win-arm64 --filter "FullyQualifiedName~WorkspaceWindowProofTests.SidebarSessions_SelectOriginalKeys_AndKeepCompanionDraft|FullyQualifiedName~WorkspaceWindowProofTests.NativePagesAndOwnerLinks_KeepCompanionIndependent": three consecutive runs, 4/4 each (12/12).

Local revalidation of these commands on 843d4f5f is still running, separately from the completed hosted CI. An earlier shared-suite run hit the known MCP disposal flake; its isolated rerun and subsequent full suite passed. Local GitVersion abandoned-mutex failures were resolved for prior closeout by setting MSBUILDDISABLENODEREUSE=1; no build configuration was committed.

python .agents\skills\autoreview\scripts\autoreview --mode commit --commit HEAD was attempted on 21e31d1c, but Codex exited 1 on both attempts. No clean automated-review result is claimed.

Real Behavior Proof

  • Environment tested: GitHub-hosted Windows x64; additional local Windows ARM64 proof as distinguished above.
  • PR head or commit tested: 843d4f5ffddcac71e404b663209980bfe6c1e396 in successful CI run 36987876649.
  • Exact steps or command run: hosted Tray UI command in Validation, exercising real isolated app processes through native UI Automation and keyboard input.
  • Evidence after fix: hosted Tray UI reports Test Run Successful, 441 passed, 14 skipped; accessibility 23/23; functional UI 19/19.
  • Observed result: current-head session/draft preservation and separate keyboard/focus tests pass in the previously failing CI lane.
  • Screenshot or artifact links verified? Yes, current successful run logs inspected; prior failing run's test-results-ui downloaded and TRX inspected. No screenshot proof of the latest correction is claimed.
  • Not verified or blocked: current-head local revalidation still running; underlying intermittent keyboard delivery in the session-selected state remains unexplained; automated Codex review unavailable. A single green run does not prove all flakes eliminated.

Historical console-tail proof from e205c75f: a temporary 1,500 ms continuation delay made old tests fail 3/3 with extra cursors and fixed tests pass 3/3. The delay was removed before commit; this is historical rather than newly repeated proof.

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) No product changes; local validation disabled MSBuild node reuse.
  • 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.

…le tail polling runs late

- WizardConsoleTailTests: snapshot cursors inside onMessage so a late test continuation cannot record the next 500 ms poll.
- WorkspaceWindowProofTests: wait for selection state across sidebar rebuilds instead of one-shot re-finds; foreground the Hub and wait for keyboard focus before SendKeys.
- AccessibilityAppFixture: add EnsureHubForegroundAsync.
@clawsweeper

clawsweeper Bot commented Oct 2, 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 P2 Normal priority bug or improvement with limited blast radius. 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. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed October 2, 2026, 6:26 AM ET / 10:26 UTC (Revision 8).

ClawSweeper review

What this changes

The PR stabilizes console-tail and native Workspace tests with callback-time snapshots, selection and activation waits, pane-readiness synchronization, and a documented CI failure backlog.

Merge readiness

⛔ Needs changes before merge - 1 item remains

This PR remains useful: current main retains the timing-sensitive assertions, and the stacked correction landed into this branch rather than main. No introduced correctness defect was found.

Priority: P2
Reviewed head: 00fa1cf42ac58ed78cc8f4d6d3f2c1b699acdea7

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test-stabilization patch with preserved keyboard assertions and no identified blocking code defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this collaborator-authored PR. The native fixture exercises the real isolated app, but successful linked validation covers 843d4f5; the new pane-readiness helper at 00fa1cf has current-head hosted validation in progress. Required local closeout remains pending. No stored-data contract changes occur.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this collaborator-authored PR. The native fixture exercises the real isolated app, but successful linked validation covers 843d4f5; the new pane-readiness helper at 00fa1cf has current-head hosted validation in progress. Required local closeout remains pending. No stored-data contract changes occur.
Evidence reviewed 9 items Verified introduced scope: The pinned introduced diff changes three test files and one documentation file. There are no production, workflow, dependency, permission, or stored-data changes.
Snapshot preserves the intended assertion: The production polling loop invokes message callbacks sequentially before advancing its cursor and delaying another poll. Capturing the cursor list in that callback prevents a late test continuation from observing subsequent polls.
Keyboard coverage remains mandatory: The dedicated native navigation test retains Space activation, focus-transfer assertions, and Tab coverage. The session-preservation test uses UI Automation Invoke after activation readiness, without suppressing invocation errors or adding keyboard fallback.
Findings None None.
Security None None.

How this fits together

Console-tail tests verify how onboarding receives new Gateway output. Workspace tests drive an isolated Windows app through navigation, session selection, keyboard activation, and draft preservation.

flowchart TD
 A[Gateway console output] --> B[Console tail polling]
 B --> C[Callback snapshot assertions]
 D[Isolated Windows app] --> E[Foreground and pane readiness]
 E --> F[Workspace interactions]
 F --> G[Selection and draft assertions]
 C --> H[CI results]
 G --> H
Loading

Before merge

  • Complete next step (P2) - Complete and record local validation on 00fa1cf: ./build.ps1, the required shared and tray test suites with non-zero test counts, and focused Workspace tests; replace the stale current-head and pending validation notes.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test LOC production +0/-0; tests +110/-37; docs +52/-0 The patch improves test synchronization without growing production behavior.

Root-cause cluster

Relationship: canonical
Canonical: #1597
Summary: This PR is the landing branch for the combined test stabilization; the related stacked PR contributes a complementary pane-readiness correction.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep deterministic test synchronization and dedicated native keyboard coverage, while investigating the documented session-selected keyboard uncertainty separately.

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

Yes for the console-tail assertion race: a delayed continuation can observe another poll in the mutable cursor list. Native activation failures are documented, but their intermittent mechanism remains unresolved.

Is this the best way to solve the issue?

Yes for the bounded stabilization goal: callback snapshots and readiness waits preserve the existing assertions, while separate native keyboard coverage remains mandatory.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded test-reliability improvement without an established urgent product regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this collaborator-authored PR. The native fixture exercises the real isolated app, but successful linked validation covers 843d4f5; the new pane-readiness helper at 00fa1cf has current-head hosted validation in progress. Required local closeout remains pending. No stored-data contract changes occur.

Evidence

What I checked:

Likely related people:

  • karkarl: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • paulcam206: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Record completion of the required local build and shared/tray suites on 00fa1cf, with non-zero test counts, plus focused Workspace results.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (7 earlier review cycles)
  • reviewed 2026-10-02T06:27:30.092Z sha e205c75 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-02T06:48:59.635Z sha 3ee08ee :: needs maintainer review before merge. :: none
  • reviewed 2026-10-02T07:37:18.626Z sha 142e7d4 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-02T08:18:26.060Z sha 142e7d4 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-02T08:51:33.087Z sha bef916a :: needs maintainer review before merge. :: none
  • reviewed 2026-10-02T09:13:21.656Z sha 843d4f5 :: needs changes before merge. :: none
  • reviewed 2026-10-02T09:27:11.118Z sha 843d4f5 :: needs changes before merge. :: none

@karkarl karkarl added the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Oct 2, 2026
karkarl and others added 3 commits October 2, 2026 01:23
Retain Space activation and focus-transfer coverage in the dedicated native navigation test. Document the remaining session-selected keyboard uncertainty.

Co-authored-by: Copilot App <[email protected]>
Use the existing foreground-and-focus helper for reopen-button Space and Tab. Local validation remains in progress; push requested to run CI in parallel.

Co-authored-by: Copilot App <[email protected]>
Restore the foreground/focus barrier when switching from SendKeys to UIA Invoke. CI exposed a COM failure without that barrier. Do not suppress or retry invocation errors.

Co-authored-by: Copilot App <[email protected]>
@karkarl karkarl removed the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Oct 2, 2026
@RomneyDa
RomneyDa merged commit 9ab23fc into main Oct 2, 2026
23 checks passed
@RomneyDa
RomneyDa deleted the fix/main-ci-flakes branch October 2, 2026 10:44
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: 🐚 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants