Skip to content

fix(ci): output-idle runner tests fail when pwsh starts slowly - #2161

Merged
bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-ci-process-idle-budget
Nov 13, 2026
Merged

bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-ci-process-idle-budget

Conversation

@bkudiess

Copy link
Copy Markdown
Collaborator

Related: #2141

What Problem This Solves

Fixes: fast-validation fails intermittently in the CI output-idle runner tests when pwsh starts slowly on a loaded host.

User Impact

User impact: no user-visible change. The always-on fast-validation job no longer needs reruns for this test.

The test now takes about 48 s instead of 16 s in that job. Setting OPENCLAW_CI_PROCESS_TEST_IDLE_SECONDS=2 restores the previous timing.

Why This Change Was Made

scripts/Test-CiProcess.Tests.ps1, called from test-ci-workflow-contract.ps1, ran every fixture with a literal -IdleTimeoutSeconds 2. Each fixture starts a cold pwsh child, and the runner's idle clock starts at launch. The descendant case also needed a second cold pwsh to print within the same 2 s window.

A cold pwsh reaches its first output in 0.44–0.48 s on an idle host, but in 3.7–7.2 s when contended. The 2 s budget therefore measured startup, not idleness, and failed with "CI process produced no output for 2 seconds" or "Descendant output lifecycle was not bounded: live-root".

Changes (test script and docs only; Invoke-CiProcess.ps1 is unchanged):

  • Idle budget: named and env-overridable, OPENCLAW_CI_PROCESS_TEST_IDLE_SECONDS (10 s by default). Every fixture duration is derived from it:
    • The progressing fixture runs for idle + 3 s, so it still proves that output resets the deadline.
    • Silent and held processes outlive the prompt bound.
  • Descendant readiness is observable: the root reports progress until the descendant signals it has printed, then the pipe is held silently. The descendant's cold start is no longer counted as idle time, and only the idle deadline can end the run.
  • Stronger assertions:
    • The test asserts that the descendant reported readiness, so a descendant that ended on its own can't pass the live-root case.
    • It asserts the runner's "root exited" note: present for the exited-root case, absent for live-root.
    • The silent fixture's prompt bound is measured on the monotonic clock from body entry.
  • Ready path: passed as data through the environment, so quotes in a temp path can't break the descendant command.

Evidence

Harness: the script pinned to one CPU with 3 owned busy-loop processes on the same core (stopped by PID afterwards).

Code Result under the harness
Original (main a88888f7) Failed 3/3: CI process produced no output for 2 seconds.
This change Passed 5/5 (88–119 s)
  • Unloaded, this change passes in 48–49 s; the original took about 16 s.
  • The full test-ci-workflow-contract.ps1 passes (109–112 s).

Review:

  • Dual-model Hanselman review: claude-opus-5.5 (high) and gpt-6-astra (long_context, high), plus two delta rounds.
  • Both reviewers confirmed that every previous proof still holds and none became vacuous.
  • Findings fixed:
    • Path quoting in the descendant command: MEDIUM from Astra, LOW from Opus.
    • The readiness wait could expire without failing.
    • The prompt bound included cold start, and then depended on the wall clock.
    • An inaccurate comment.
  • The final delta round found no issues.
  • Not taken: Opus suggested folding the silent fixture into the live-root case to save about 10 s. It's an optional cost optimization, left for a separate change.

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: this changes only a CI-script test and test documentation. The runner itself, product code, UI, MCP, Gateway and system.run are unchanged.

Validation

The final tree is byte-identical to commit 861ad744 (diff SHA256 FAFCA465…FBED against a88888f7).

  • pwsh -NoProfile -File scripts/test-ci-workflow-contract.ps1: passed (109 s), including the output-idle process tests.
  • pwsh -NoProfile -File scripts/Test-CiProcess.Tests.ps1:
    • Unloaded: passed 2/2.
    • Under the pinned-contention harness: passed 5/5 across revisions, including 2/2 on the reviewed assertions. The original failed 3/3 under the same harness.
  • ./build.ps1: passed.
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore --no-build: 5849 passed, 29 skipped, 0 failed.
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore --no-build (isolated profile): 6417 passed, 0 failed.
  • ./scripts/validate-test-timing-patterns.ps1, ./scripts/validate-docs.ps1 and git diff --check: passed.

Real Behavior Proof

  • Environment tested: local Windows 11 developer machine, 32 logical processors, PowerShell 7.
  • PR head or commit tested: the tree byte-identical to 861ad744. The full closeout ran one revision earlier; only the test script's timing source changed after it.
  • Exact steps or command run: the pinned-contention harness above, the unloaded runs, the contract script, and the closeout listed in Validation.
  • Evidence after fix: CI output-idle process tests passed: exit/output fidelity, progressing fixture, silent fixture termination, tree termination, inherited-pipe deadline., under contention and unloaded.
  • Observed result: the original failed 3/3 under contention, and this change passed every run.
  • Screenshot or artifact links verified? (Yes/No/N/A): N/A (script test; output is quoted above).
  • Not verified or blocked:
    • CI on this PR has not run yet.
    • main has since moved to 439b7cc9; a trial merge is clean.

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. The new optional test-only override is documented in docs/TEST_COVERAGE.md.
  • 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.

Test-CiProcess.Tests.ps1 runs in every fast-validation job. Each fixture
started a cold pwsh child under a literal 2 s output-idle budget, and the
descendant case needed a second cold pwsh to print inside the same
window. A cold pwsh took up to 7 s to print anything on a contended host,
so the runner reported "produced no output for 2 seconds" or the
descendant lifecycle check failed.

Use a named, environment-overridable idle budget
(OPENCLAW_CI_PROCESS_TEST_IDLE_SECONDS, 10 s) and derive every fixture
duration from it, so each case still proves output resets the deadline,
silent fixtures fail promptly, and trees are terminated. The descendant
signals readiness before going silent, and the test asserts that
readiness and whether the root had exited. The prompt bound is measured
on the monotonic clock from body entry.

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

clawsweeper Bot commented Nov 13, 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. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 13, 2026
@clawsweeper

clawsweeper Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR gives process-runner tests a configurable startup budget and waits for observable descendant readiness before testing silence.

Example: A cold PowerShell child needs 7 seconds to produce its first output on a loaded Windows host.

  • Before: The two-second idle guard aborts the fixture during startup.
  • After: The default ten-second budget admits startup, while silent fixtures still trigger the idle guard.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test repair with reported baseline reproduction, real-process coverage, and passing relevant current-head CI.
Proof confidence 🐚 platinum hermit (4/6) No shipped user behavior changes; reported Windows contention runs and successful exact-head workflow-contract CI validate the changed test fixtures.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Contributors encounter intermittent fast-validation failures when cold PowerShell startup exceeds the fixture's idle budget.
Reason: The maintainer-authored direction addresses demonstrated fixture failures while preserving the production runner and its distinct regression checks.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a concrete CI test flake still present on main, preserves the runner's lifecycle coverage, and has no actionable correctness findings.

Priority: P2
Reviewed head: 861ad7448f960a1c64221573813f213460533307

Before merge

None.

Findings

None.

Agent review details

How this fits together

Fast-validation invokes the workflow-contract suite, which launches real PowerShell fixtures through Invoke-CiProcess and checks output, exit status, timeout, and process cleanup.

flowchart TD
  A[Fast validation] --> B[Workflow contract suite]
  B --> C[Process runner tests]
  C --> D[Invoke CiProcess]
  D --> E[PowerShell fixture and descendant]
  E --> F[Output and lifecycle assertions]
Loading

Technical review

Best possible solution:

Keep the repair in the existing test script, preserving progress, silence, tree-termination, and inherited-pipe checks.

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

Source confirms startup is charged against the two-second idle deadline, and the author reports repeated baseline failures under contention; this read-only review ran no target code.

Is this the best way to solve the issue?

The smallest complete fix is confined to the existing fixtures: allow measured cold-start headroom, synchronize descendant readiness, and retain independent lifecycle assertions.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Process-runner fixture timing and lifecycle assertions keeps the original intent (6647e54: Exercise real process output, silence, tree cleanup, and inherited-pipe deadlines for the output-idle E2E runner.)
  • Cold-process timing guidance keeps the original intent (ee8edbc: Prevent short timing guards from creating intermittent failures on loaded runners.)

Security

None.

Evidence

What I checked:

Likely related people:

  • Dallin Romney: Raw commit 6647e54 adds scripts/Test-CiProcess.Tests.ps1:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6647e5497dd0; files: scripts/Test-CiProcess.Tests.ps1)
  • Barbara Kudiess: Raw commit ee8edbc adds docs/TEST_COVERAGE.md:769 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ee8edbc0bea4; files: docs/TEST_COVERAGE.md)

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.

Review metrics

Metric Value Why it matters
Introduced scope Production +0/-0; tests +50/-12; documentation +1/-1 The test growth supplies configurable durations, observable readiness, and stronger lifecycle assertions within the existing fixture.

Labels

Label changes:

  • add P2: A reproducible test-startup flake disrupts always-on CI, with no shipped application behavior affected.
  • 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: A reproducible test-startup flake disrupts always-on CI, with no shipped application behavior affected.
  • 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.

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 13, 2026, 4:59 AM ET / 09:59 UTC.

@bkudiess
bkudiess merged commit 378fd1a into openclaw:main Nov 13, 2026
53 of 55 checks passed
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.

1 participant