feat(cli): add port ownership diagnosis before serve startup - #329
Open
dggyey wants to merge 4 commits into
Open
feat(cli): add port ownership diagnosis before serve startup#329dggyey wants to merge 4 commits into
dggyey wants to merge 4 commits into
Conversation
added 3 commits
July 28, 2026 15:38
…onAI#228) - Add areno/cli/port_diag.py with diagnose_port() function - Integrate diagnostic into serve startup before model init - Support IPv4/IPv6, permission-denied, stale metadata, bind races - Add 'areno port-check' CLI command with --host/--port/--json options - Add 17 CPU-only tests covering success, failure, and edge cases - Add documentation for port-check command and troubleshooting guide
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds a port ownership diagnostic that runs before
areno serve/areno proxystartup. The diagnostic checks if the target(host, port)is available for binding. If occupied, it identifies the owning process viapsutil, classifies it as an AReno child process or an unrelated external service, and prints a safe, actionable suggestion — without terminating any process.Changes
areno/cli/port_diag.py: core diagnostic logic (diagnose_port(),format_diagnosis(),PortDiagnosisdataclass)areno/cli/serve.py: integrated diagnostic before model/worker initializationareno/cli/diagnostics.py: addedareno port-checkCLI command with--host/--port/--jsonoptionsareno/cli/main.py: registeredport-checkcommand in the CLI grouptests/test_port_diag_cpu.py: 17 CPU-only testsdocs/cli/diagnostics.rst: CLI reference documentationdocs/troubleshooting/port-conflict.rst: troubleshooting guide with minimal runnable exampleRelated issue
Fixes #228
Type of change
How was it tested?
Automated tests
Result: 17 passed.
Manual tests on Linux (Kaggle)
Test 1: Free port
Exit code: 0
Test 2: Occupied port — PID and process detected
Exit code: 1
Test 3:
areno serveauto-diagnostic before model load (port occupied)Exit code: 1 — no model download or loading occurred; diagnostic intercepted startup before
resolve_model_ref().Checklist
pytest tests/ -k cpu).Breaking change details
No breaking changes. The
port-checkcommand is additive. Inareno serve, the diagnostic runs before model initialization but only exits early when the port is occupied by an unrelated process — when the port is available, the existing serve flow is unchanged.