Skip to content

fix(dev-cli): handle shared-port services in status command#1302

Open
evan-claw wants to merge 1 commit intoKilo-Org:improvement/kiloclaw-dev-clifrom
evan-claw:fix/status-shared-ports
Open

fix(dev-cli): handle shared-port services in status command#1302
evan-claw wants to merge 1 commit intoKilo-Org:improvement/kiloclaw-dev-clifrom
evan-claw:fix/status-shared-ports

Conversation

@evan-claw
Copy link

Problem

The pnpm kilo status command checks whether each service is running by probing its registered port. However, the service registry assigns the same port to multiple services:

  • Port 8792: auto-fix and db-proxy
  • Port 8795: kiloclaw and git-token

When either process in a shared-port pair is running, status falsely reports both services as running — producing false positives.

Proof the Issue Is Real

The registry (dev/cli/src/services/registry.ts) explicitly declares:

  • auto-fix → port 8792, db-proxy → port 8792
  • kiloclaw → port 8795, git-token → port 8795

The old status.ts iterates all port-having services and calls isPortListening(svc.port!) independently for each. Since both services in a shared-port pair resolve to the same port number, a single listening process causes both to show green.

The existing registry.test.ts already documents these conflicts with a console.warn — confirming they are known and intentional in the registry.

Proof This Is Not a Band-Aid

The port conflicts originate in upstream wrangler.jsonc files. The registry correctly mirrors those configs. These services are not intended to run simultaneously (as noted in the registry test), so changing the ports would be incorrect.

The status command is the presentation layer responsible for showing accurate information. It is the correct place to handle shared-port ambiguity — not the registry, and not the upstream wrangler configs.

What Changed

dev/cli/src/commands/status.ts

  • Group services by port before probing
  • For unique ports: behavior unchanged (green ● or dim ○)
  • For shared ports: when listening, show a yellow ● with all service names and (shared — cannot distinguish) instead of falsely marking each as independently running. When not listening, show each service as not running individually.

dev/cli/test/status.test.ts (new)

3 tests covering the shared-port grouping logic:

  1. Detects known shared ports (8792, 8795) with correct service names
  2. Confirms unique-port services are not grouped
  3. Verifies all port-having services are accounted for in groups

All 18 tests pass (15 existing + 3 new).

Addresses review comment: #1142 (comment)

Services that share a port (auto-fix/db-proxy on 8792, kiloclaw/git-token
on 8795) were each shown as 'running' when only one was active, producing
false positives.

Group services by port before checking. For shared ports, show an
ambiguous indicator (yellow) with '(shared — cannot distinguish)' instead
of falsely marking both services as running. For unique ports, behavior
is unchanged.

Adds status.test.ts with 3 tests covering shared-port grouping logic.

describe('status: shared-port detection', () => {
test('identifies services that share a port', () => {
const portServices = services.filter(s => s.port && s.type !== 'infra');
Copy link
Contributor

Choose a reason for hiding this comment

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

WARNING: These tests don't exercise the status() behavior that changed

Each test rebuilds the port-grouping map directly from services, so they still pass even if status.ts regresses to probing every service independently again. The shared-port fix in dev/cli/src/commands/status.ts needs at least one behavior-level assertion on the command output or isPortListening call pattern to prevent that regression.

Copy link
Contributor

Choose a reason for hiding this comment

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

@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 19, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
dev/cli/test/status.test.ts 6 New tests only recompute registry groupings, so the shared-port behavior change in status.ts remains untested.

Fix these issues in Kilo Cloud

Other Observations (not in diff)

N/A

Files Reviewed (4 files)
  • dev/cli/src/commands/status.ts - 0 issues
  • dev/cli/test/status.test.ts - 1 issue
  • dev/cli/src/services/registry.ts - 0 issues
  • dev/cli/test/registry.test.ts - 0 issues

Reviewed by gpt-5.4-20260305 · 144,913 tokens

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