Repository navigation
Allow curl, chmod, kill and source in Terminal when the OS sandbox is active - #18003
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…eject extglobs in chmod [skip ci]
|
@codex security review |
…d, end proxy tunnels on close [skip ci]
… clustered -X [skip ci]
…eep the proxy socket test under the macOS path limit
|
@codex review |
1 similar comment
|
@codex review |
…the egress tests portable to macOS and Windows runners [skip ci]
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 02c38e3e57
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| forward = "\r\n".join( | ||
| [f"{method} {path} {version}", *kept, "Connection: close", "", ""] | ||
| ).encode("latin-1") | ||
| upstream = _dial(host, port) |
There was a problem hiding this comment.
Bound pending DNS and dial work across proxy cleanup
If a download times out or is cancelled while getaddrinfo() or connect() is pending, cleanup shuts down only tracked sockets and joins only the accept thread; the handler keeps running because its upstream socket is registered only after _dial() returns. A delayed-DNS probe retained one backend thread per closed proxy and opened upstream connections after closure once DNS resumed. Since _MAX_CONNECTIONS is per proxy, repeated short-lived calls can exhaust host threads and file descriptors despite cancellation. Put a process-wide bound on pending resolution/dial work and check closure before opening upstream connections.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Bounded, not a leak: a stalled handler lives at most the resolver timeout plus 15 s per address, and after close() _track() refuses the upstream so no bytes are forwarded. Exhausting host threads needs thousands of concurrent stalled downloads, which one chat's sequential tool calls cannot produce.
|
@codex review |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…t alias (teardown errors since #18080) (#18097) Since #18080 the Studio CPU shards (`rest`, `g-l`, `m-r`) error at teardown on any worker that imported `torch._dynamo` earlier. Seen on the staging runs of #18003, #18080 and #18090, e.g.: ``` ERROR at teardown of test_torchao_export_rejected_early_when_stubbed[torchao_fp8] torch/overrides.py:1778: has_torch_function = _add_docstr( RuntimeError: function '_has_torch_function' already has a docstring ERROR at teardown of test_versions_are_checked_before_imports AssertionError: imported a package the version check already rejected ERROR at teardown of test_a_broken_torch_import_is_retried_once_per_detection_epoch OSError: libcudart.so.12: cannot open shared object file ``` ## Cause The `_restore_dynamo_process_knobs` fixture from #18080 snapshots and restores `cache_size_limit`. On torch 2.6+ that entry is an alias of `recompile_limit`, and torch resolves an alias read with `importlib.import_module("torch._dynamo.config")`. Several tests take torch out of `sys.modules` and block imports to exercise the no-torch paths (`test_torchao_select.py`, `test_mlx_stack_blockers.py`, `test_polled_probe_costs.py`, `test_warm_window_review_fixes.py`, `test_hub_download_transport_auto.py`, `test_mlx_repair.py`). The fixture teardown runs before their monkeypatches are undone, so the alias read re-imported torch under the blocker. Those tests are correct, and the reset itself is still wanted; only the alias read was wrong. ## Fix `_dynamo_own_knobs(cfg)` keeps only the config's own entries (`_config[k].alias is None`). Restoring `recompile_limit` already covers `cache_size_limit` on new torch, and on older torch, where `cache_size_limit` is a real entry, it is still restored. Reading an own entry never imports. New `test_conftest_teardown_imports_nothing.py` imports `torch._dynamo`, takes torch out of `sys.modules` and makes `importlib.import_module` fail for torch, so any conftest teardown that imports torch errors. ## Verification Run locally with `torch._dynamo` already imported on the worker, as in CI: - main conftest: 14 teardown errors across `test_torchao_select.py`, `test_mlx_stack_blockers.py`, `test_polled_probe_costs.py`, `test_warm_window_review_fixes.py`, `test_hub_download_transport_auto.py` and `test_mlx_repair.py` (the CI ones), and the new test errors too. - this branch: all pass (196 and 188 passed in the two runs). - `test_process_state_reset_between_tests.py` still passes, so the knob reset still works.
…roxied launches [skip ci]
|
@codex review |
1 similar comment
|
@codex review |
…s head_dim 8) (#18101) `tests/test_tp_native_oracle.py` fails on main in the CPU `rest` shard (seen on the staging run of #18003, reproduces on main): ``` test_plan_covers_every_layer[phi3] assert parts["qkv_proj"] == (...) E assert (32, 16, 16) == (8, 4, 4) test_fused_qkv_under_a_packed_plan_keeps_the_gqa_layout E AssertionError: {'o_proj': (8,), 'qkv_proj': (32, 16, 16)} ``` ## Cause No Unsloth change. `trl-internal-testing/tiny-Phi3ForCausalLM-3` has a new revision whose config sets `head_dim: 8` next to `hidden_size: 8` and 4 heads (the previous revision had no `head_dim`). The fused `qkv_proj` weight is now `[64, 8]`, so its parts really are `(4 * 8, 2 * 8, 2 * 8) = (32, 16, 16)`, which is what the TP plan derives. The tests computed the head size as `hidden_size // num_attention_heads = 2`, which only held for the old config. The plan is right, and the packed-plan test's logits check still matches the unsharded model with the new shapes, so tensor parallel handles a head_dim that is not `hidden_size // heads`. ## Fix A `_head_dim(text)` helper reads the config's `head_dim` and falls back to `hidden_size // num_attention_heads` when it is unset, so both repo revisions give the right expectation. Both call sites use it. ## Verification - main: 2 failed, 46 passed. - this branch: 48 passed, 1 skipped.
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…imports (order-dependent m-r failure) (#18112) `studio/backend/tests/test_research_connection_context.py::test_window_probe_reads_the_connection_under_its_config_guard` fails on some workers in the Studio `m-r` shard on unrelated PRs (staging runs of #18003 and #18087): ``` assert guarded and all(guarded) E assert ([False, False, False, False, False, False, ...] and False) ``` ## Cause The test looks up held locks in `provider_credentials._provider_config_locks` after `from routes import provider_credentials`. Several other test files (`test_credential_routes.py`, `test_provider_max_output_tokens_contract.py`, `test_provider_model_capabilities.py`, ...) load private copies of `routes.provider_credentials` and pop it from `sys.modules`. On a worker where the real module had been imported before that, the `routes` package attribute still points at the old module while `sys.modules` has none. The probe's lazy `from routes.provider_credentials import provider_config_guard` then imports a fresh copy and locks that copy's table, while the test inspects the old one, so every read looks unguarded. The probe does take the guard; only the test was looking at the wrong module. ## Fix The test resolves `routes.provider_credentials` through `importlib.import_module` (the same `sys.modules` lookup the probe's import uses) and patches `get_provider_api_key` on the `credential_secrets` module `core.research_runs` actually calls. ## Verification - With a preceding test that imports `routes.provider_credentials` and pops it from `sys.modules` (the state those files leave): - main: fails with the CI assertion (`[False, False, ...]`). - this branch: passes. - Alone: 7 passed. - Sabotage: dropping `async with provider_config_guard(...)` from `_guarded_connection_client` makes the test fail on this branch, so it still checks the guard.
A user asked the model to build a Go app. Go wasn't installed in the sandbox, so the model tried
curl -LO https://go.dev/dl/...and gotBlocked command(s) for safety: curl. It gave up.That block doesn't protect anything inside the OS sandbox. Under bubblewrap or Seatbelt, everything outside the chat folder is read-only and
killcan't see processes outside the sandbox. Python could already download, chmod and kill freely.Now allowed when the call actually runs in the OS sandbox:
curl,wgetkill,pkill,killallsource,.chmod(e.g.chmod +x run.sh)If the launch falls back to software safeguards, they're blocked again.
Still blocked:
rm,rsync,evalchmodwith-R, globs,$, or viaxargs/find -execPlatform notes
pkillandkillallstay blocked. Seatbelt denies the process list they need (sysmond for pkill,sysctl(KERN_PROC)for killall), so they could only fail there.killworks on both.