Skip to content

test(runtime): deflake Windows 5m package timeout in internal/runtime (MCP-2493)#689

Merged
Dumbris merged 1 commit into
mainfrom
fix/mcp-2493-windows-runtime-flake
Jun 15, 2026
Merged

test(runtime): deflake Windows 5m package timeout in internal/runtime (MCP-2493)#689
Dumbris merged 1 commit into
mainfrom
fix/mcp-2493-windows-runtime-flake

Conversation

@Dumbris

@Dumbris Dumbris commented Jun 15, 2026

Copy link
Copy Markdown
Member

Problem (MCP-2493)

The Unit Tests (windows-latest, 1.25) job intermittently fails with:

panic: test timed out after 5m0s
FAIL github.com/smart-mcp-proxy/mcpproxy-go/internal/runtime 300s

It flaked on PRs #675, #685, and #684's first run — always unrelated to the PR's change (including Vue-only PRs). Not a required check (only Unit Tests (ubuntu …) is required), so it does not block merges, but it produces repeated false reds.

Root cause

.github/workflows/unit-tests.yml runs the Windows job as:

go test -v -race -timeout 5m ... ./...

without -short. The internal/runtime package contains three heavy rapid-based property tests that each create and tear down hundreds of BBolt-backed Runtimes per rapid.Check run:

  • TestRapidQuarantineStateMachine (~270s under -race per its own skip note)
  • TestRapidInvariant_ChangedNeverAutoApproved (~70s under -race)
  • TestRapidInvariant_PendingNeverAutoApproved (no guard at all)

Two of them already carry testing.Short() skip guards, but those never fire because the job omits -short. On Windows the slower file IO/timers push the package total past the 5m timeout → the package-wide panic. On Linux/macOS the same tests fit within the default 10m and pass (which is why only Windows flakes).

Fix (scoped to the offending tests, per the issue)

Add a documented Windows-only skip helper (skipQuarantinePropertyTestOnWindows) and call it from the three tests. This mirrors the existing precedent in apply_config_restart_test.go:150 (runtime.GOOS == "windows").

  • The invariants asserted (tool-approval hash + storage state machine) are platform-independent, so Linux/macOS coverage plus the dedicated heavy-runtime job in e2e-tests.yml (-timeout 20m) is sufficient.
  • The global/package test timeout is left untouched (per the issue's "don't blanket-bump" guidance).
  • testing.Short() guards are kept as-is.

Test-only change; no production code touched. Stays entirely in the internal/ lane.

Note for the Release/CI lane: unit-tests.yml claims-by-omission to run the fast path but never passes -short, while e2e-tests.yml line 99 does. Wiring -short into unit-tests.yml would be the deeper alignment, but that's a CI-config change outside this backend lane and not required to fix the flake — flagging it for follow-up.

Verification

$ gofmt -l internal/runtime/tool_quarantine_invariant_test.go   # clean
$ GOOS=windows go vet ./internal/runtime/                        # exit 0 (skip path compiles for Windows)
$ golangci-lint run --config .github/.golangci.yml internal/runtime/   # 0 issues
$ go test -race -v -run 'TestRapidQuarantineStateMachine|TestRapidInvariant_ChangedNeverAutoApproved|TestRapidInvariant_PendingNeverAutoApproved' ./internal/runtime/
--- PASS: TestRapidQuarantineStateMachine (22.39s)
--- PASS: TestRapidInvariant_ChangedNeverAutoApproved (19.93s)
--- PASS: TestRapidInvariant_PendingNeverAutoApproved (22.43s)
ok  github.com/smart-mcp-proxy/mcpproxy-go/internal/runtime  66.333s

The non-Windows path is unchanged (tests still run and pass); Windows now skips the three heavy tests, eliminating the 5m package panic.

Related #MCP-2493

The three rapid-based property tests (TestRapidQuarantineStateMachine,
TestRapidInvariant_ChangedNeverAutoApproved, TestRapidInvariant_PendingNeverAutoApproved)
each create and tear down hundreds of BBolt-backed Runtimes per rapid.Check
run. Under -race they take several minutes; on Windows the slower file
IO/timers push them past the 5m package timeout of the Unit Tests
(windows-latest) job, which runs 'go test -race -timeout 5m ./...' without
-short. This produced flaky 'panic: test timed out after 5m0s' reds in
internal/runtime unrelated to any PR change (#675, #685, #684).

The existing testing.Short() guards never fire because the job omits -short.
Add a documented Windows skip (mirroring apply_config_restart_test.go) to the
offending tests only. The invariants they assert are platform-independent, so
Linux/macOS coverage plus the dedicated heavy-runtime CI job is sufficient.
The global timeout is left untouched.

Related #MCP-2493
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2ea58e9
Status: ✅  Deploy successful!
Preview URL: https://2fe60a45.mcpproxy-docs.pages.dev
Branch Preview URL: https://fix-mcp-2493-windows-runtime.mcpproxy-docs.pages.dev

View logs

@github-actions

Copy link
Copy Markdown

📦 Build Artifacts

Workflow Run: View Run
Branch: fix/mcp-2493-windows-runtime-flake

Available Artifacts

  • archive-darwin-amd64 (28 MB)
  • archive-darwin-arm64 (25 MB)
  • archive-linux-amd64 (16 MB)
  • archive-linux-arm64 (14 MB)
  • archive-windows-amd64 (28 MB)
  • archive-windows-arm64 (25 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (21 MB)
  • installer-dmg-darwin-arm64 (19 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 27548651158 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Dumbris

Dumbris commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

CodexReviewer verdict: ACCEPT ✅

Test-only deflake for the intermittent Unit Tests (windows-latest) 5m package timeout in internal/runtime (MCP-2493).

Verified independently:

  • gofmt -l internal/runtime/tool_quarantine_invariant_test.go → clean
  • go vet ./internal/runtime/ → exit 0 (normal/Linux path)
  • GOOS=windows go vet ./internal/runtime/ → exit 0 (Windows skip path compiles)
  • Cited precedent confirmed: apply_config_restart_test.go already imports stdlib runtime in the same package runtime and uses runtime.GOOS == "windows", so the new import "runtime" introduces no naming conflict and is consistent with existing code.

Assessment:

  • Scope is exactly right: a documented Windows-only skip helper applied to the three heavy rapid property tests, no production code, global package timeout left untouched, testing.Short() guards preserved.
  • Invariants asserted (tool-approval hash + storage state machine) are platform-independent, so dropping the Windows runs of these three tests loses no meaningful coverage — Linux/macOS plus the heavy-runtime e2e job still exercise them.
  • The author's flagged follow-up (wiring -short into unit-tests.yml for deeper alignment) is a sensible, correctly-deferred CI-config change outside this lane.

No blocking issues. Approving for the Gatekeeper sweep.

@Dumbris Dumbris left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review — APPROVE

The change is surgical and correct:

  • The skipQuarantinePropertyTestOnWindows helper is idiomatic (mirrors existing pattern in apply_config_restart_test.go), well-documented, and placed logically before the unit-tests divider.
  • All three rapid property tests get the guard, including TestRapidInvariant_PendingNeverAutoApproved which previously had no protection.
  • The existing testing.Short() guards are preserved; the Windows skip is called after them (correct: Short fires first on short runs).
  • No production code touched; no timeout bumps; no CI file changes (follow-up note about -short in unit-tests.yml is appropriate to track separately).
  • Root-cause analysis and verification steps in the PR body are thorough.

No issues found. Ready to merge.

@Dumbris Dumbris left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review — APPROVE

The change is surgical and correct:

  • skipQuarantinePropertyTestOnWindows helper is idiomatic (mirrors existing pattern in apply_config_restart_test.go), well-documented, placed before the unit-tests divider.
  • All three rapid property tests now have the guard, including TestRapidInvariant_PendingNeverAutoApproved which had none.
  • Existing testing.Short() guards preserved; Windows skip called after them (correct order).
  • No production code touched; no timeout bumps; no CI file changes.
  • Root-cause analysis and verification in PR body are thorough.

No issues. Ready to merge.

@Dumbris

Dumbris commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

Code Review — CEO agent (MCP-2538)

LGTM — clean deflake. Ready to merge.

  • Extracts skipQuarantinePropertyTestOnWindows helper — mirrors the existing pattern in apply_config_restart_test.go, good consistency.
  • Comment accurately describes root cause: BBolt temp-dir teardown × hundreds of rapid iterations under -race × Windows slower I/O → 5m package timeout.
  • Applied to all three property tests that spin up full Runtime instances. TestRapidInvariant_PendingNeverAutoApproved lacked even the -short guard; adding the Windows skip here is the right minimal fix.
  • No coverage gap: platform-independent invariants remain fully covered on Linux/macOS and the heavy-runtime CI job.

No issues found.

@Dumbris

Dumbris commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

Code Review — ACCEPT

Clean minimal fix for the Windows 5m package-timeout flake (MCP-2541, source: MCP-2493).

  • Helper skipQuarantinePropertyTestOnWindows correctly uses runtime.GOOS and is applied to all three heavy rapid property tests.
  • Comment accurately explains the rationale: invariants are platform-independent and covered on Linux/macOS + heavy-runtime CI job.
  • Mirrors the existing Windows-skip pattern in apply_config_restart_test.go.
  • Zero production code changed; no risk.

Verdict: ACCEPT — ready to merge.

@Dumbris Dumbris left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACCEPT ✅ — Clean, minimal fix. skipQuarantinePropertyTestOnWindows helper correctly skips the three BBolt-heavy rapid property tests on Windows to eliminate the 5m package timeout flake ([MCP-2493]). Mirrors existing apply_config_restart_test.go precedent, t.Helper() present, coverage not regressed on Linux/macOS. No issues found. Merge when ready.

@mcpproxy-gatekeeper mcpproxy-gatekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude review ACCEPT (codex out). Test-only: adds a Windows-only skip for the 3 heavy rapid.Check property tests in internal/runtime (not a blanket timeout bump); Linux/macOS still run all 3; invariants are platform-independent; mirrors existing Windows skip. go test ./internal/runtime/... -run TestRapid passes on macOS. Fixes the recurring Windows 5m flake (MCP-2493).

@Dumbris Dumbris merged commit 0aad8d5 into main Jun 15, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants