Skip to content

fix(qa-lab): stop matrix probe re-polling at the deadline - #124684

Merged
steipete merged 1 commit into
mainfrom
steipete/matrix-probe-deadline
Aug 16, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/matrix-probe-deadline

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where Matrix QA health discovery could sleep and start a doomed extra poll when the per-request timeout won a race with the overall discovery timeout at the same deadline. The race caused unrelated CI jobs to flake with an observed sleepImpl(1) call.

Related: https://github.com/openclaw/openclaw/actions/runs/31954674724

Why This Change Was Made

The probe loop now owns each request timeout signal and records when that timeout represents the remaining discovery budget, so the re-poll decision comes from the deadline rather than timer ordering. The outer harness timeout uses an internal typed error instead of a message-prefix contract. Fast candidate failures still re-poll, while either deadline-owned timeout ordering stops immediately.

The tests force the outer-timeout-wins and request-timeout-wins orderings independently. This supersedes the temporary residual-sleep tolerance added in #124656 with a production repair and restores the zero-extra-poll assertion.

AI-assisted: yes.

User Impact

No normal Matrix harness behavior changes. QA runs retain fast-failure retries but no longer spend an extra poll cycle after the discovery budget is exhausted, eliminating this timing-dependent CI flake.

Evidence

  • Pre-fix deterministic regression: does not re-poll when the request timeout wins at the discovery deadline failed with exactly one sleepImpl(1) call.
  • Final focused proof: node scripts/run-vitest.mjs extensions/qa-lab/src/live-transports/matrix/substrate/harness.runtime.test.ts passed 20/20 consecutive runs (15 tests per run).
  • Changed gate: the full check:changed plan passed in an isolated native-arm64 Linux container after Blacksmith/AWS capacity was unavailable (local-container, lease cbx_ddea227e302e, exit 0), including extension production/test typechecks, lint, runtime-sidecar loading, and import-cycle checks.
  • git diff --check origin/main...HEAD passed.
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --stream-engine-output reported no accepted/actionable findings.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 16, 2026 16:13
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 16, 2026
@steipete
steipete merged commit 56f594a into main Aug 16, 2026
175 checks passed
@steipete
steipete deleted the steipete/matrix-probe-deadline branch August 16, 2026 16:20
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 12:20 PM ET / 16:20 UTC.

ClawSweeper review

What this changes

This PR prevents the Matrix QA harness from starting a residual retry after its discovery deadline when either the request timer or outer deadline timer fires first.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open. The patch records deadline ownership at the Matrix probe owner instead of inferring it from timer ordering, preserves fast-failure retries, and adds deterministic coverage for both timeout orders; no blocking correctness finding was found.

Priority: P3
Reviewed head: f06ac35039b1ebed940b3de79f0f503fc325e33d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused owner-boundary repair with deterministic coverage for both timer orders.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable to this maintainer-authored PR; its body nevertheless records repeated focused harness runs and a changed-gate run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable to this maintainer-authored PR; its body nevertheless records repeated focused harness runs and a changed-gate run.
Evidence reviewed 6 items Current race location: Current main only treats the outer timeout's message as deadline consumption; a request timeout can therefore return false and reach the residual-sleep branch before the next loop condition.
Owner-boundary repair: The PR creates the request timeout signal at the discovery-loop owner, records an aborted deadline-owned signal, and uses a typed outer-timeout error rather than matching error text.
Caller and contract: Harness startup enters the multi-candidate discovery loop only after the initial host probe fails, then performs the normal final health check on the selected endpoint.
Findings None None.
Security None None.

How this fits together

The QA Lab Matrix harness starts a temporary homeserver and probes its candidate URLs before scenarios run. Each probe combines a request timeout with an overall discovery budget, then either retries, selects a reachable endpoint, or reports startup failure.

flowchart LR
  A[Matrix QA startup] --> B[Candidate URL probes]
  B --> C[Per-request timeout]
  B --> D[Discovery deadline]
  C --> E[Deadline ownership decision]
  D --> E
  E --> F[Retry or fail]
  B --> G[Reachable Matrix endpoint]
Loading

Before merge

  • Resolve merge risk (P1) - The branch is behind current main, so landing still needs exact-head checks on the actual clean three-way merge.
  • Resolve merge risk (P2) - Production is net +4 lines; the added typed timeout and explicit signal state are justified because they replace brittle message-prefix classification, but restart and cleanup timeout behavior should remain covered when the branch is refreshed.
  • Complete next step (P2) - No actionable automated repair remains; this maintainer-owned PR needs normal exact-head validation after base drift.
Agent review details

Security

None.

PR surface

Source +4, Tests +36. Total +40 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 13 9 +4
Tests 1 74 38 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 87 47 +40

Review metrics

Metric Value Why it matters
Production versus test LOC production +4, tests +36 The small production increase replaces string-based timeout classification with explicit deadline ownership; the larger test change controls both timer orders.

Root-cause cluster

Relationship: canonical
Canonical: #124684
Summary: This PR is the canonical production repair for the temporary test tolerance merged earlier.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep deadline ownership in the Matrix probe loop, retain the typed timeout classification, and land after an exact-head current-main validation confirms the clean merge.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep deadline ownership in the Matrix probe loop, retain the typed timeout classification, and land after an exact-head current-main validation confirms the clean merge.

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

Yes—source-reproducible: on current main, a request timeout at the remaining discovery budget returns false without recording deadline consumption, allowing the residual-sleep branch before the next deadline check.

Is this the best way to solve the issue?

Yes. The patch records the deadline fact where the request signal is created and removes the message-prefix coupling; the generic QA fetch contract already accepts the supplied signal.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2b8e94ea4dba.

Labels

Label changes:

  • add P3: This is a focused internal QA-harness reliability repair with no reported production user workflow impact.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable to this maintainer-authored PR; its body nevertheless records repeated focused harness runs and a changed-gate run.

Label justifications:

  • P3: This is a focused internal QA-harness reliability repair with no reported production user workflow impact.
  • 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: Not applicable to this maintainer-authored PR; its body nevertheless records repeated focused harness runs and a changed-gate run.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the merged temporary tolerance and the proposed deadline-owner repair. (role: recent area contributor; confidence: high; commits: 43e910142f19, f06ac35039b1; files: extensions/qa-lab/src/live-transports/matrix/substrate/harness.runtime-internals.ts, extensions/qa-lab/src/live-transports/matrix/substrate/harness.runtime.test.ts)
  • joshavant: Recent history shows three focused Matrix harness and fault-proxy test commits in this area. (role: Matrix test contributor; confidence: medium; commits: db4ad84d7f0b, dd4728305f20, fe654eaacddc; files: extensions/qa-lab/src/live-transports/matrix/substrate/harness.runtime.test.ts)

Rank-up moves

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

  • Refresh exact-head CI after the current-main merge result is available.

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: qa-lab maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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