Skip to content

PLANNOTATOR_PORT=0 spurious "Invalid" warning in local mode #715

@hearkenmx

Description

@hearkenmx

Repro

PLANNOTATOR_PORT=0 plannotator annotate README.md

Output:

[Plannotator] Warning: Invalid PLANNOTATOR_PORT "0", using default

Expected: no warning. Port 0 means "OS picks random port" — already the local-mode default.

Root cause

packages/server/remote.ts getServerPort() — common to both modes:

if (!isNaN(parsed) && parsed > 0 && parsed < 65536) {  // parsed > 0 rejects 0

Port 0 is rejected by validation, printed as warning, then the fallback returns... 0:

return isRemoteSession() ? DEFAULT_REMOTE_PORT : 0;  // identical to what was rejected

Fix

-    if (!isNaN(parsed) && parsed > 0 && parsed < 65536) {
+    if (!isNaN(parsed) && parsed >= 0 && parsed < 65536) {

One character, one file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions