Repository navigation
fix(tests): degrade gracefully on restricted hosts - #436
Merged
Merged
Conversation
Three environment restrictions broke the suite on sandboxed hosts (nested sandboxes, agent harnesses, hardened CI runners) while CI stayed green: - Seatbelt confinement could not be applied from inside an outer sandbox, so every confined spawn failed. availability() now probes that a profile can actually be applied (new Unavailable::CannotApply), which makes the CLI refuse to start on such hosts and lets library callers fall back to plain execution instead of failing spawns. - The platform application-data directory was unwritable, breaking runtime-storage fallback tests. Tests that need it now use a fake-home guard that holds the test-env lock and restores $HOME. - PTY allocation and loopback listener binds were denied, panicking terminal/egress/mock-server tests. Shared helpers now detect the denial once and skip with a reason instead of unwrapping.
The two direct-completion exec_command tests raced a single 400ms yield against WSL2's slower confined spawn time and saw a still-running session instead of the final result. Apply the same write_stdin polling loop the denial-escalation test already uses. Claude-Session: https://claude.ai/code/session_01Ca1Xpr9dmAUNsCR9dnh23R
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
* fix(tests): degrade gracefully on restricted hosts Three environment restrictions broke the suite on sandboxed hosts (nested sandboxes, agent harnesses, hardened CI runners) while CI stayed green: - Seatbelt confinement could not be applied from inside an outer sandbox, so every confined spawn failed. availability() now probes that a profile can actually be applied (new Unavailable::CannotApply), which makes the CLI refuse to start on such hosts and lets library callers fall back to plain execution instead of failing spawns. - The platform application-data directory was unwritable, breaking runtime-storage fallback tests. Tests that need it now use a fake-home guard that holds the test-env lock and restores $HOME. - PTY allocation and loopback listener binds were denied, panicking terminal/egress/mock-server tests. Shared helpers now detect the denial once and skip with a reason instead of unwrapping. * fix(tests): poll exec_command to completion on slow sandbox spawns The two direct-completion exec_command tests raced a single 400ms yield against WSL2's slower confined spawn time and saw a still-running session instead of the final result. Apply the same write_stdin polling loop the denial-escalation test already uses. Claude-Session: https://claude.ai/code/session_01Ca1Xpr9dmAUNsCR9dnh23R --------- Co-authored-by: Mohit Ranka <[email protected]>
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
* fix(tests): degrade gracefully on restricted hosts Three environment restrictions broke the suite on sandboxed hosts (nested sandboxes, agent harnesses, hardened CI runners) while CI stayed green: - Seatbelt confinement could not be applied from inside an outer sandbox, so every confined spawn failed. availability() now probes that a profile can actually be applied (new Unavailable::CannotApply), which makes the CLI refuse to start on such hosts and lets library callers fall back to plain execution instead of failing spawns. - The platform application-data directory was unwritable, breaking runtime-storage fallback tests. Tests that need it now use a fake-home guard that holds the test-env lock and restores $HOME. - PTY allocation and loopback listener binds were denied, panicking terminal/egress/mock-server tests. Shared helpers now detect the denial once and skip with a reason instead of unwrapping. * fix(tests): poll exec_command to completion on slow sandbox spawns The two direct-completion exec_command tests raced a single 400ms yield against WSL2's slower confined spawn time and saw a still-running session instead of the final result. Apply the same write_stdin polling loop the denial-escalation test already uses. Claude-Session: https://claude.ai/code/session_01Ca1Xpr9dmAUNsCR9dnh23R ---------
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.
Summary
Fixes the test failures that appear on sandboxed hosts (nested sandboxes, agent harnesses) while CI stayed green. Three root causes:
sandbox_apply: Operation not permitted), so every confined spawn errored.availability()now probes that a profile can actually be applied, addingUnavailable::CannotApply. The supported CLI still refuses to start when the host cannot confine; library callers now fall back to plain execution rather than failing spawns mid-test.fake_home_guardthat redirects $HOME for the test's duration under the existing env lock and restores it on drop.pty_allocation_available,started_proxy,mock_http/servereturningOption) now detect the denial once and skip with a printed reason.Test plan
cargo test --workspace --all-targets --locked: two consecutive full runs, all 27 suites green (previously 17 failures in forge-tui alone, plus forge-core/forge-connect/forge-model/forge-storage/forge-tools).cargo fmt --all -- --checkandcargo clippy --workspace --all-targets --locked -- -D warningsclean.