Skip to content

fix: stop Consul Windows service before starting dev agent#77

Draft
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1774373588-fix-consul-windows-service
Draft

fix: stop Consul Windows service before starting dev agent#77
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1774373588-fix-consul-windows-service

Conversation

@devin-ai-integration
Copy link
Contributor

Summary

The choco install consul command registers Consul as a Windows service, which races with the subsequent Start-Process consul agent -dev for port binding. When the service wins the race and binds to the configured port first, the dev agent silently fails to start, causing all Consul integration tests in downstream repos to fail with 500 No known Consul servers.

This was observed as a flaky failure in python-server-sdk#411 — only windows (3.14) lost the race on that run, but the issue is non-deterministic and affects all Windows matrix entries.

This PR:

  1. Stops and disables the Consul Windows service immediately after choco install, before starting the dev agent.
  2. Adds a readiness poll against /v1/status/leader (up to 30s) so the step only completes once Consul has elected a leader and is actually ready to serve requests.

Review & Testing Checklist for Human

  • Verify that Stop-Service consul fully terminates the service process and releases the port (not just a pause) — if it doesn't, a Stop-Process consul -Force may also be needed before Start-Process.
  • Test end-to-end by pointing a consumer repo (e.g. python-server-sdk#412) at this commit SHA and confirming all Windows Consul tests pass across all Python versions.
  • Confirm no unintended impact on Linux/macOS steps — the change is scoped to the runner.os == 'Windows' conditional, but worth a glance.

Notes

  • The -ErrorAction SilentlyContinue on Stop-Service / Set-Service is intentional: if a future chocolatey package version stops registering a Windows service, these calls will no-op gracefully instead of failing.
  • This action has no CI of its own — changes can only be validated by running a downstream consumer's CI against the commit SHA.

Link to Devin session: https://app.devin.ai/sessions/218fb7de91864819adbc8746029f7331
Requested by: @keelerm84

The chocolatey package registers Consul as a Windows service which
races with the dev agent for port binding. Stop and disable the
service before starting the dev agent, and add a readiness check
that polls the leader endpoint to confirm the agent is ready.

Co-Authored-By: mkeeler@launchdarkly.com <keelerm84@gmail.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration bot added a commit to launchdarkly/python-server-sdk that referenced this pull request Mar 24, 2026
Point the Windows persistent-stores action at the commit that stops
the Consul Windows service before starting the dev agent, replacing
the local workaround.

See: launchdarkly/gh-actions#77
Co-Authored-By: mkeeler@launchdarkly.com <keelerm84@gmail.com>
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