Skip to content

TRT-2678: sippy-dev MCP: sippy_serve reports server ready before HTTP API is available - #138

Open
openshift-trt-agent[bot] wants to merge 1 commit into
eval/case-004-basefrom
fix-TRT-2678-eval-20260810-195947
Open

TRT-2678: sippy-dev MCP: sippy_serve reports server ready before HTTP API is available#138
openshift-trt-agent[bot] wants to merge 1 commit into
eval/case-004-basefrom
fix-TRT-2678-eval-20260810-195947

Conversation

@openshift-trt-agent

Copy link
Copy Markdown

TRT-2678: sippy_serve MCP reports server ready before HTTP API is available

Summary

  • The sippy_serve MCP tool now polls the HTTP endpoint before reporting an existing backend process as ready, instead of relying solely on PID detection.
  • When the API is not yet accepting requests (e.g. during go run compilation), the tool waits up to 120 seconds and returns a clear error if the backend never becomes ready.
  • Adds _pid_alive() and _wait_for_url() helpers with unit tests.

Problem

During local dev startup, go run ./cmd/sippy serve takes 30-60+ seconds to compile. The MCP tool would detect the go run process and report "already running" even though the HTTP server hadn't bound yet. This caused a cascading failure:

  1. sippy_serve detects the compiling process and reports ready
  2. sippy_ng_start starts the frontend on :3000
  3. Frontend fetches /api/releases against an unready backend
  4. Fetch fails, app enters degraded state

Changes

mcp/server.py:

  • Added _pid_alive(pid) helper — uses os.kill(pid, 0) to check process existence without sending a signal.
  • Added _wait_for_url(url, timeout, pids) — polls a URL until it responds or the timeout elapses, checking PID liveness each iteration. Same pattern as the existing _wait_for_ready but takes PIDs instead of a subprocess.Popen.
  • Modified sippy_serve early-return path: when existing processes are found and restart=False, polls the HTTP endpoint before reporting "already running". Returns a descriptive error if the API doesn't respond or the process exits.

mcp/test_server.py:

  • Added TestPidAlive — tests with own PID (alive) and invalid PID (dead).
  • Added TestWaitForUrl — tests immediate success (mocked urlopen), process-exit detection, and timeout behavior.

Test plan

  • _pid_alive unit tests pass (own PID alive, nonexistent PID dead)
  • _wait_for_url unit tests pass (immediate success, process exit, timeout)
  • All pre-existing tests continue to pass
  • Manual: start sippy_serve and verify it waits for the HTTP API before reporting ready
  • Manual: call sippy_serve while go run is compiling — verify it polls and eventually reports ready
  • Manual: call sippy_serve with a dead process PID — verify it reports the process exited

Always review AI generated responses prior to use.
Generated with Claude Code via openshift-developer plugin


Generated with Claude Code

The sippy_serve MCP tool reported the backend as running based solely on
process detection. During local dev startup, go run takes 30-60+ seconds
to compile, so the process exists but the HTTP server hasn't bound yet.
Downstream tools (sippy_ng_start) would start against an unready backend,
causing fetch failures and app crashes.

Now when an existing sippy serve process is detected, the tool polls the
HTTP endpoint (up to 120s) before reporting ready. If the API never
responds or the process exits during the wait, a clear error is returned.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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.

0 participants