fix(cli): verify forward listener before success#1880
Conversation
PR Review StatusValidation: This PR is project-valid because it directly fixes reproducible Review findings:
Docs: Fern docs were updated under Next state: |
Re-check After Author UpdateI re-evaluated latest head Disposition: partially resolved. Resolved items:
Remaining items:
Non-blocking suggestion: consider adding a direct foreground regression test where fake Docs: Fern docs were updated under Next state: |
1678fe7 to
4583b5d
Compare
Re-check After Author UpdateI re-evaluated latest head Disposition: partially resolved. Resolved items:
Remaining items:
Docs: Fern docs remain updated under Checks: required gates are currently green, but review feedback remains unresolved. Next state: |
Author Follow-Up NudgeThis PR has been in @shiju-nv, please respond to the review comments or push an update. The remaining blocking item is the exact Current head SHA: Next state: |
Author Follow-Up NudgeThis PR is still in @shiju-nv, please update the exact Current head SHA: Checks are currently green, but gator cannot move this PR to Next state: |
PR Review StatusValidation: This PR remains project-valid because it fixes the Review findings:
Docs: Fern docs are adequate for this UX change; Checks: required gates are currently green, but review feedback remains unresolved. Next state: |
PR Review StatusValidation: This PR remains project-valid because it fixes the Review findings:
Docs: Fern docs were updated in Next state: |
Wait for a connectable local forward listener before reporting foreground forwarding success. Fail background forwarding when the forked SSH process cannot be tracked, probe the listener before writing the PID file, and terminate the tracked SSH process if the listener never opens. Document that forwarded URLs are printed only after listener health is proven. Signed-off-by: Shiju <shiju@nvidia.com>
Signed-off-by: Shiju <shiju@nvidia.com>
Signed-off-by: Shiju <shiju@nvidia.com>
4583b5d to
e4b2cb8
Compare
Re-check After Author UpdateI re-evaluated latest head Disposition: partially resolved. Resolved items:
Remaining item:
Docs: Fern docs remain adequate for this UX change; Checks: Next state: |
Require background forward cleanup to prove a candidate PID is the OpenShell-generated SSH forwarding process before reporting it active or signaling it. Match the exact -L forward argument and sandbox ID instead of by substring, so a request for port 80 cannot collide with an existing 8080 forward and terminate the wrong process. Reject legacy PID records as non-authoritative and route port-only lookup through validated live forward state. Recover the exact process argv from /proc/<pid>/cmdline on Linux so a ProxyCommand whose executable path contains whitespace is parsed correctly; other platforms keep the best-effort ps command-line parse. After listener readiness succeeds, terminate the revalidated background ssh process if the PID-file write fails, instead of returning early and leaving a reachable but untracked forward that forward stop/list cannot manage. Cover adversarial matcher cases (port and sandbox-id collisions, command spoofing, remote-command token confusion, whitespace executable paths) and the PID-file write-failure teardown path with focused tests. Signed-off-by: Shiju <shiju@nvidia.com>
e4b2cb8 to
e3e1d55
Compare
Re-check After Author UpdateI re-evaluated latest head Disposition: resolved. Resolved items:
Remaining items:
Docs: Fern docs remain adequate for this UX change; Checks: Next state: |
|
Label |
Maintainer Approval NeededGator validation and PR monitoring are complete. Validation: This PR is project-valid because it fixes the Human maintainer approval or merge decision is now required. |
Monitoring CompleteMonitoring is complete because this PR has merged. Final status: Gator had moved this PR to I removed the active |
Summary
This PR makes
openshell forwardreport success only after the local SSH forward listener is actually reachable. It also makes background forwards fail closed when the forked SSH process cannot be tracked, so OpenShell does not leave users with an unusable or unmanageable forward.Related Issue
Fixes #1878
Changes
0.0.0.0and::.forward listandforward stop.Testing
mise run pre-commitpassesChecklist