Skip to content

fix(dev-server): reuse already-running dev server instead of port-colliding#266

Merged
jacsamell merged 2 commits into
mainfrom
fix/dev-server-reuse-running
Jun 2, 2026
Merged

fix(dev-server): reuse already-running dev server instead of port-colliding#266
jacsamell merged 2 commits into
mainfrom
fix/dev-server-reuse-running

Conversation

@jacsamell
Copy link
Copy Markdown
Contributor

@jacsamell jacsamell commented Jun 2, 2026

If operator already has dev server running, the spawn would port-collide → exit → cube reports unavailable. Detect already-running via HEAD-poll and reuse.

Dev Server Reuse Detection

python/cube/core/dev_server.py: Implemented detection of an already-running dev server before spawning a new one. The start() function now calls _poll_url(config.url) early in its flow; if the URL responds with 2xx/3xx status, it logs the reuse and returns a DevServerHandle with process=None, url=config.url, unavailable=False, and _stopped=True. This prevents port collisions when operators have the dev server running in another session and makes stop() a safe no-op for handles pointing to externally-managed servers.

tests/core/test_dev_server.py: Added test_start_reuses_already_running_server to verify the reuse path. The test monkeypatches _poll_url to return True, asserts the handle has process=None and unavailable=False, and confirms stop() is idempotent even when no subprocess exists.

Peer Review Summary Rendering

python/cube/commands/peer_review.py: Fixed the summary message when no judge decisions are found (ran == 0). Previously this case fell through to the default "0 judge(s) requested changes" message, which contradicted the INCONCLUSIVE gate outcome. Now explicitly renders a clearer "No judge decisions found" message that better reflects the panel's inability to produce a verdict.

jacsamell added 2 commits June 3, 2026 08:49
…l produced nothing

The summary builder rendered ``❌ 0 judge(s) requested changes.`` when
``ran == 0`` — i.e. no judge produced a decision file at all. That
message lies in two ways:

1. Zero judges actually rejected (none ran).
2. The gate body (``compute_review_event``) immediately below it says
   "INCONCLUSIVE: No judge decisions found. Re-run the panel." Two
   contradictory lines in the same review body.

Fix: render an explicit "No judge decisions found" line when ran=0 so
the summary and the gate body agree. The "❌ N judge(s) requested
changes" wording stays for the genuine all-RC case (ran > 0 AND
approvals == 0).

715/715 tests pass.
…liding

If the operator already has the dev server running in another tab
(very common during active development), the previous spawn-then-
poll-for-ready path would collide on the port, the new process would
exit, and cube reported the dev server as unavailable.

Detect an already-running server via the same HEAD-poll the ready
check uses. When the URL responds, return a handle pointing at it
with ``process=None`` so ``stop()`` is a no-op — we don't tear down a
server we didn't start.

716/716 tests pass. New test covers the reuse path.
@jacsamell jacsamell merged commit 7041352 into main Jun 2, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 31d07b8b-b918-42ab-a483-f036923e5091

📥 Commits

Reviewing files that changed from the base of the PR and between 2e2bb5e and 986217c.

📒 Files selected for processing (3)
  • python/cube/commands/peer_review.py
  • python/cube/core/dev_server.py
  • tests/core/test_dev_server.py

Walkthrough

This pull request makes two independent changes: it adds explicit summary handling in peer review when no judge decision files are found (displaying an inconclusive verdict rather than zero requested changes), and it implements server reuse detection in the dev server startup—polling the configured URL before spawning a new process and returning a no-op handle when a server is already running. A corresponding test verifies the reuse path correctly returns a handle with no spawned process.

Possibly related PRs


Comment @coderabbitai help to get the list of available commands and usage tips.

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