Skip to content

Preserve PortScanner probe defects#3282

Merged
juliusmarminge merged 1 commit into
mainfrom
codex/preserve-port-scanner-defects
Jun 20, 2026
Merged

Preserve PortScanner probe defects#3282
juliusmarminge merged 1 commit into
mainfrom
codex/preserve-port-scanner-defects

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • recover only expected typed ProcessRunner failures from platform port probes
  • retain defects and interruption instead of silently falling back
  • log the structured process error with probe and host-platform context before fallback

Validation

  • vp test apps/server/src/preview/PortScanner.test.ts
  • vp check
  • vp run typecheck

Note

Low Risk
Localized preview port-scan error handling with clearer failure semantics; no auth, data, or security surface changes.

Overview
Port discovery no longer treats every process-probe failure the same: lsof / Windows listener probes used a broad catchCause that turned any failure (including defects and cancellation) into a silent fallback to common-port scanning.

They now catchTags only the expected ProcessRunner failures (ProcessSpawnError, stdin/output/read/timeout errors). Those paths log debug context (probe name, platform, error) via recoverProcessProbeFailure and still fall back to common-port probes. Defects and interruptions propagate instead of being swallowed.

Tests add makeProbeFailureLayer and assert scan() fails with dies/interrupts-only causes when the injected probe does.

Reviewed by Cursor Bugbot for commit ac9be89. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Preserve PortScanner probe defects and interruptions instead of swallowing them

  • Replaces broad catchCause handlers in PortScanner.ts with targeted catchTags covering only specific process failures (ProcessSpawnError, ProcessStdinError, ProcessOutputLimitError, ProcessReadError, ProcessTimeoutError).
  • Defects and interruptions from the Windows powershell and lsof probes now propagate to callers instead of being silently swallowed.
  • Adds a recoverProcessProbeFailure helper that logs a debug message (with probe type, platform, and error) before returning null to trigger fallback to common-port probing.
  • Adds two new tests in PortScanner.test.ts verifying that defects and interruptions from process probes are preserved in the failure cause.
  • Behavioral Change: any code that previously relied on PortDiscovery.scan succeeding despite probe defects or interruptions will now see those failures propagate.

Macroscope summarized ac9be89.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: dae067c1-e720-4532-9543-46f567fbe53c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/preserve-port-scanner-defects

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

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Straightforward bug fix that replaces overly broad error catching with specific error types, allowing defects and interruptions to properly propagate instead of being silently swallowed. Well-tested and self-contained to PortScanner error handling.

You can customize Macroscope's approvability policy. Learn more.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge
juliusmarminge force-pushed the codex/preserve-port-scanner-defects branch from 0f7a5a8 to ac9be89 Compare June 20, 2026 20:26
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 20:26

Dismissing prior approval to re-evaluate ac9be89

@juliusmarminge
juliusmarminge merged commit a76b7bb into main Jun 20, 2026
16 checks passed
@juliusmarminge
juliusmarminge deleted the codex/preserve-port-scanner-defects branch June 20, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant