sandbox_forward() previously returned Ok(()) in background mode even
when find_ssh_forward_pid() could not discover the forked SSH process
and no local TCP listener was reachable on the forwarded port. This
left users with a reported forward that could not be stopped by
OpenShell and might not be serving traffic.
Changes:
- Return an error when PID discovery fails in background mode instead
of printing a warning and succeeding.
- Add probe_listener() in openshell-core::forward that attempts a TCP
connect with retries to confirm the local listener is reachable
before writing the PID file.
- If the listener probe fails but a PID was found, kill the orphaned
SSH process and return an error with a descriptive message.
- Add kill_process() helper for best-effort PID cleanup.
- Add integration test reproducing the issue with the fake SSH binary.
- Update existing sandbox_create_keeps_sandbox_with_forwarding test
to expect the forward to fail closed (sandbox is still kept).
Note: Rust toolchain was not available in the sandbox environment.
Unit and integration tests could not be run locally. Manual
verification of the test suite is required.
Closes #4
Signed-off-by: fullsend-code <289857995+devtest-coder[bot]@users.noreply.github.com>
sandbox_forward() previously returned Ok(()) in background mode even when find_ssh_forward_pid() could not discover the forked SSH process and no local TCP listener was reachable on the forwarded port. This left users with a reported forward that could not be stopped by OpenShell and might not be serving traffic.
Changes:
of printing a warning and succeeding.
connect with retries to confirm the local listener is reachable
before writing the PID file.
SSH process and return an error with a descriptive message.
to expect the forward to fail closed (sandbox is still kept).
Note: Rust toolchain was not available in the sandbox environment. Unit and integration tests could not be run locally. Manual verification of the test suite is required.
Closes #4
Post-script verification
agent/4-forward-listener-probe)09bd32f35a3b539e6aec895d4dec87d4ec030369..HEAD)