-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(connect): use TCP probe to verify forward health #3385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6933cf0
fix(connect): use TCP probe to verify forward health
jason-ma-nv 5a64cc4
refactor(connect): trim reachability rationale, PID-seed fixture port…
jason-ma-nv a309ec8
test(connect): merge missing-entry and dead-entry reachability cases
jason-ma-nv c3ac4cb
Merge branch 'main' into fix-3334-forward-health-tcp-probe
jyaunches File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard reachability callback errors to keep recovery path non-throwing
If
isReachable()throws, this function propagates and can abortconnect/recoverinstead of returning a health verdict. Falling back tofalsepreserves the existing recovery behavior.Suggested patch
export function classifyForwardHealthWithReachability( entries: SandboxForwardListEntry[], sandboxName: string, port: string, isReachable: () => boolean, ): Exclude<SandboxForwardHealth, null> { const verdict = classifySandboxForwardHealth(entries, sandboxName, port); if (verdict !== false) return verdict; - return isReachable() ? true : false; + try { + return isReachable() ? true : false; + } catch { + return false; + } }🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Holding off on this.
isReachableis typed() => booleanand has two concrete bindings in this PR:() => isLocalForwardReachable(port), which usesspawnSyncand explicitly returnsfalseon every error path (if (result.error) return false). It cannot throw for any normal runtime condition; only programmer-bug argv shapes would, and those would fail at parse/build time.() => true,() => false, and() => { probed = true; return false; }. None throw.Per the project's coding guidance — "Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries" — wrapping the call in try/catch would be defensive code at a non-boundary point. The boundary check already lives inside
isLocalForwardReachablewhere the actual I/O happens.If a future change wires a throwing callback into this classifier, that's a contract break we'd want to surface loudly rather than swallow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jason-ma-nv, that's a well-reasoned position — the error boundary is already atisLocalForwardReachable, and surfacing a contract break loudly is the right call. Withdrawing the suggestion.✏️ Learnings added