Skip to content

test(lsp): de-flake broker cancel-refresh recovery on slow CI - #255

Merged
ScriptedAlchemy merged 1 commit into
masterfrom
fix/lsp-broker-cancel-flake
Jul 3, 2026
Merged

test(lsp): de-flake broker cancel-refresh recovery on slow CI#255
ScriptedAlchemy merged 1 commit into
masterfrom
fix/lsp-broker-cancel-flake

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

broker_cancels_partial_refresh_without_poisoning_warm_client (tests/hooks_lsp_suite/lsp_code_diagnostics_test.rs) is a macOS CI flake. It failed on two consecutive unrelated PRs (#253 perf/git-resolver, #254 refactor/dedup), both with:

panicked at tests/hooks_lsp_suite/lsp_code_diagnostics_test.rs:608:
next refresh should start a clean client and recover:
Config { message: "LSP server '/usr/bin/python3' initialize timed out after 3000 ms" }

Root cause

The test aborts a partial refresh, then asserts the broker isn't poisoned by driving a recovery refresh that must spin up a clean client. That recovery spawns a fresh python3 fake-LSP process; on a loaded runner its cold-start intermittently exceeds the 3s initialize floor (MIN_INITIALIZE_RESPONSE_TIMEOUT). That's a slow start, not a poisoned broker — but the single-shot .expect() treats it as a hard failure. Neither PR touches LSP runtime code.

Fix

Retry the recovery refresh a bounded number of times (5 attempts, 50ms apart), tolerating only the transient initialize timed out error and still panicking immediately on any other error. The EngineState::Ready / total_errors == 1 assertions are unchanged, so the property under test (recovery from an aborted partial refresh) is preserved. No production timeout semantics changed.

Validation

Target test 15/15 green on repeat; full hooks_lsp_suite 116 passed; fmt clean.

🤖 Generated with Claude Code

`broker_cancels_partial_refresh_without_poisoning_warm_client` asserts
that aborting a partial refresh does not poison the broker: a subsequent
refresh must spin up a clean client. On a loaded macOS CI runner the
recovery client's `python3` cold-start intermittently exceeds the 3s
initialize floor, surfacing a transient "initialize timed out" — a slow
start, not a poisoned broker — which failed the test on two consecutive
unrelated PRs (#253, #254).

Retry the recovery refresh a bounded number of times (5, 50ms apart),
tolerating only the transient initialize-timeout error and still failing
fast on any other error. The Ready/total_errors assertions are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e14f87e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@ScriptedAlchemy
ScriptedAlchemy merged commit d00eb01 into master Jul 3, 2026
25 of 27 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the fix/lsp-broker-cancel-flake branch July 4, 2026 01:13
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.

1 participant