Repository navigation
fix(sandbox): wait out OpenShell 0.1.2's first settings poll before network use - #7922
Conversation
…etwork use OpenShell 0.1.2's supervisor polls its settings every 10 s, and its first poll needlessly reloads the policy and closes connections in flight (NVIDIA/OpenShell#3809, fixed upstream by #3819 after 0.1.2). The sandbox log shows it as "L7 tunnel closed before inspection because policy changed: policy generation is stale". A run's first network request usually lands around then: the GitHub pre-flight check saw EOF, and pi's first model request saw "terminated" and had to retry. Before the pre-flight check, wait until 12 s have passed since the sandbox became Ready. Bootstrap already uses most of that, so a run typically waits 3-5 s. Remove this once fullsend pins an OpenShell release with #3819. Verified on OpenShell 0.1.2 (macOS arm64): with the wait, two pi triage runs opened their first connection at +12.4 s / +12.9 s and neither retried. Without it, one of four control runs had the first OpenAI request closed at +10.1 s by the stale-policy denial and retried. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
PR Summary by QodoWait out OpenShell’s first policy poll before sandbox network use
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
|
🤖 Finished Review · ✅ Success · Started 3:31 PM UTC · Completed 3:43 PM UTC Commit: Runtime: pi · Model: openai/gpt-6.1-sol → gpt-6.1-sol · Effort: high · Cost: $2.25 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Code Review by Qodo
1.
|
|
Risk Assessment: moderate (2/5) DetailsSmall scoped bug fix with test coverage and no protected path changes, but touches the high-churn CLI runner without a toggle mechanism. Previous runRisk Assessment: moderate (2/5) DetailsSmall, well-tested bug fix addressing OpenShell connection terminations, with risk moderated to level 2 due to touching high-churn run.go and modifying startup timing without a feature flag toggle. Previous run (2)Risk Assessment: moderate (2/5) DetailsSmall, well-tested bug fix addressing OpenShell connection terminations, with risk moderated to level 2 due to touching high-churn run.go and modifying startup timing without a feature flag toggle. |
|
Looks good to me Previous runLooks good to me Previous run (2)ReviewFindingsMedium
Low
Labels: This fixes an OpenShell sandbox startup defect, matching the repository's type/bug and component/sandbox labels. Next steps:
|
Review follow-ups: - waitForOpenShellFirstPoll takes the run's context and waits on a timer or ctx.Done(), so a cancelled run no longer sits out up to 12 s before cleanup. runAgent returns the cancellation instead of continuing into the pre-flight check. Tests cover an already-cancelled context and cancellation during the wait. - Rename the test seams to settleNowFn and settleAfterFn with their own doc comments, per the repository's injectable-function convention. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 3:49 PM UTC · Completed 3:58 PM UTC Commit: Runtime: pi · Model: openai/gpt-6.1-sol → gpt-6.1-sol · Effort: high · Cost: $1.52 |
Superseded by updated review
Review follow-up: waitForOpenShellFirstPoll returned success as soon as the 12 s window had passed, before looking at the context, so a run cancelled during a slow bootstrap carried on into the pre-flight check. Check the context first, and say in the doc comment that the 12 s assumes the default poll interval, which fullsend never changes. Assisted-by: Claude (fix), Codex (review) Signed-off-by: Wayne Sun <gsun@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 4:03 PM UTC · Completed 4:14 PM UTC Commit: Runtime: pi · Model: openai/gpt-6.1-sol → gpt-6.1-sol · Effort: high · Cost: $2.29 |
Superseded by updated review
Summary
On OpenShell 0.1.2 the sandbox supervisor polls its settings every 10 s (
OPENSHELL_POLICY_POLL_INTERVAL_SECS, default 10). Its first poll treats the unchanged provider environment as changed, reloads the policy, and closes any connection in flight. This is NVIDIA/OpenShell#3809, fixed upstream by #3819, which is not in any stable release yet (0.1.3 is pending).A run's first network request usually lands right at that poll, which caused:
EOF(Pre-flight GitHub check fails on EOF under OpenShell 0.1.x (not retried) #7862; fix(#7862): retry GitHub preflight on EOF and reset #7865 added a retry);terminatedand retrying.This PR waits, before the pre-flight check, until 12 s have passed since the sandbox became Ready: the 10 s interval plus a margin for supervisor startup. Bootstrap already uses most of that time, so a run typically waits only 3–5 s.
Temporary: remove
openShellFirstPollSettleand its call when fullsend pins an OpenShell release that includes #3819.Changes
internal/cli/openshell_settle.go:waitForOpenShellFirstPollsleeps only for what remains of 12 s since Ready, logs the wait, and returns immediately if the time has passed. Test seams for the clock and sleep.internal/cli/run.go: records when the sandbox becomes Ready after create and waits before the pre-flight check (step 9b-1). Nothing before that step uses the network: bootstrap and copies go over the OpenShell exec channel.Testing
go test ./internal/cli/passes, and package time is unchanged.main, 4 runs): 1 run had its first OpenAI request (opened at +9.6 s) closed at +10.1 s withL7 tunnel closed before inspection because policy changed: policy generation is stale, and pi retried. The other 3 happened to miss the poll.