Skip to content

fix(runtime): align sandbox execution, timeout control, and observability#14

Open
xwyftjk wants to merge 1 commit intomainfrom
fix/runtime-exec-timeout-tierb
Open

fix(runtime): align sandbox execution, timeout control, and observability#14
xwyftjk wants to merge 1 commit intomainfrom
fix/runtime-exec-timeout-tierb

Conversation

@xwyftjk
Copy link
Collaborator

@xwyftjk xwyftjk commented Mar 23, 2026

Summary

  • Align runtime execution paths to improve timeout/cancellation behavior and reduce stuck command scenarios in sandboxed workflows.
  • Update Tier-B/sandbox-adjacent runtime behavior and observability-related plumbing across runtime executors, permissions, and host policy checks.
  • Refresh related bindings and regression tests to match the updated runtime execution and validation behavior.

Test plan

  • Run runtime unit/integration tests (runtime/tests/*) and verify pass rate against current main baseline
  • Validate representative sandbox command execution paths (timeout, cancel, process cleanup)
  • Verify host-policy/permissions checks for non-regression in restricted mode

Made with Cursor

Summary by CodeRabbit

  • Refactor
    • Standardized code formatting and structure for improved readability across the codebase.
    • Reorganized imports and normalized whitespace throughout the project.
    • Applied consistent multi-line formatting to expressions and test assertions.
    • No functional or behavioral changes.

…lity

Harden runtime execution behavior with Tier-B identity/elevation updates, timeout and cancellation handling improvements, and supporting test/documentation adjustments for stable tool execution paths.

Made-with: Cursor
@coderabbitai
Copy link

coderabbitai bot commented Mar 23, 2026

📝 Walkthrough

Walkthrough

This pull request applies extensive formatting and whitespace normalization across the OpenSkills runtime codebase. Changes include reordering imports, converting expressions between single-line and multi-line formats for readability, normalizing trailing whitespace, and reformatting test assertions. No functional logic, API signatures, or control flow are altered.

Changes

Cohort / File(s) Summary
Python and TypeScript Bindings
bindings/python/src/lib.rs, bindings/ts/src/lib.rs
Reordered imports, collapsed multi-line expressions into single-line forms (and vice versa), reformatted method chains and argument lists. No functional changes.
Core Runtime Module
runtime/src/audit.rs, runtime/src/context.rs, runtime/src/deps_check.rs, runtime/src/errors.rs, runtime/src/executor.rs, runtime/src/hook_runner.rs, runtime/src/host_policy.rs, runtime/src/lib.rs, runtime/src/manifest.rs, runtime/src/native_runner.rs, runtime/src/permission_callback.rs, runtime/src/permissions.rs, runtime/src/registry.rs, runtime/src/skill_parser.rs, runtime/src/validator.rs, runtime/src/wasm_runner.rs
Reformatted imports, adjusted indentation and method chaining, normalized whitespace, converted expressions between single and multi-line formats, updated test assertions. Module declarations reordered internally. All changes are cosmetic.
Build System and Plugins
runtime/src/bin/openskills-runtime.rs, runtime/src/build/config.rs, runtime/src/build/mod.rs, runtime/src/build/plugins/adapter.rs, runtime/src/build/plugins/assemblyscript.rs, runtime/src/build/plugins/javy.rs, runtime/src/build/plugins/mod.rs, runtime/src/build/plugins/quickjs.rs, runtime/src/build/registry.rs
Reordered imports, reformatted multi-line expressions, adjusted formatting of CLI output construction and plugin initialization logic. No semantic changes.
Test Suite
runtime/tests/always_loaded_tests.rs, runtime/tests/claude_official_skills_tests.rs, runtime/tests/compatibility_tests.rs, runtime/tests/deps_check_tests.rs, runtime/tests/edge_case_tests.rs, runtime/tests/error_handling_tests.rs, runtime/tests/file_io_tests.rs, runtime/tests/hook_tests.rs, runtime/tests/host_policy_tests.rs, runtime/tests/integration_tests.rs, runtime/tests/linux_sandbox_tests.rs, runtime/tests/registry_tests.rs, runtime/tests/resource_tests.rs, runtime/tests/sandbox_command_tests.rs, runtime/tests/seatbelt_tests.rs, runtime/tests/skill_session_tests.rs, runtime/tests/spec_conformance_tests.rs, runtime/tests/system_prompt_tests.rs, runtime/tests/target_execution_tests.rs, runtime/tests/wasm_tests.rs
Reformatted assertions and test call sites using multi-line formatting, reordered imports, normalized whitespace. Test logic and conditions unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Poem

🐰 Hopping through code with formatting care,
Aligning our imports, removing spare space,
Multi-line chains now breathe cleaner air,
Every bracket and newline in its rightful place.
No logic was changed, just whitespace delight—
Our warren of tests now formats just right! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title claims to address sandbox execution, timeout control, and observability improvements, but the changeset consists almost entirely of formatting, whitespace, import reordering, and assertion restructuring with no functional changes to logic or signatures. Update the title to accurately reflect that this is a formatting and code style improvement (e.g., 'style: format runtime code for consistency'), not a functional fix for sandbox execution or timeout control.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Important

Merge conflicts detected (Beta)

  • Resolve merge conflict in branch fix/runtime-exec-timeout-tierb
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/runtime-exec-timeout-tierb

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
runtime/src/permissions.rs (1)

78-83: Optional: Avoid string allocation in the hot path.

The format!(".{}", allowed) creates a new String on each iteration. While the performance impact is minimal for small allow lists and infrequent permission checks, you could eliminate the allocation:

♻️ Optional optimization to avoid format!() allocation
-        Ok(self
-            .wasm_config
-            .network
-            .allow
-            .iter()
-            .any(|allowed| host == allowed || host.ends_with(&format!(".{}", allowed))))
+        Ok(self
+            .wasm_config
+            .network
+            .allow
+            .iter()
+            .any(|allowed| {
+                host == allowed
+                    || (host.len() > allowed.len()
+                        && host.ends_with(allowed)
+                        && host.as_bytes()[host.len() - allowed.len() - 1] == b'.')
+            }))
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@runtime/src/permissions.rs` around lines 78 - 83, The network allow check in
the wasm_config (the expression using wasm_config.network.allow.iter().any(...)
with host.ends_with(&format!(".{}", allowed))) allocates a temporary String each
iteration; change the logic in that permission check to avoid format! by testing
either host == allowed, or host ends with allowed and the character immediately
before the matching suffix is '.' (i.e., ensure host.len() > allowed.len() and
the byte at host.len()-allowed.len()-1 is '.'), so you compare suffixes without
allocating; update the closure passed to .any() where host and allowed are used
to implement this allocation-free suffix check.
runtime/tests/skill_session_tests.rs (1)

257-257: Consider consistent formatting for start_skill_session calls.

This call is formatted as single-line, while in runtime/tests/integration_tests.rs (lines 195-199), an identical start_skill_session call with similar arguments was reformatted to multi-line. Consider applying consistent formatting direction across the test suite.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@runtime/tests/skill_session_tests.rs` at line 257, The call to
start_skill_session in skill_session_tests.rs is formatted as a single-line
while a similar call in runtime/tests/integration_tests.rs uses a multi-line
style; update the start_skill_session("fork-test", Some(json!({ "test": "data"
})), None) invocation to match the multi-line formatting used elsewhere so test
formatting is consistent (locate the call to start_skill_session in the test
function and break the arguments across lines similar to the integration_tests
example).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@runtime/src/permissions.rs`:
- Around line 78-83: The network allow check in the wasm_config (the expression
using wasm_config.network.allow.iter().any(...) with
host.ends_with(&format!(".{}", allowed))) allocates a temporary String each
iteration; change the logic in that permission check to avoid format! by testing
either host == allowed, or host ends with allowed and the character immediately
before the matching suffix is '.' (i.e., ensure host.len() > allowed.len() and
the byte at host.len()-allowed.len()-1 is '.'), so you compare suffixes without
allocating; update the closure passed to .any() where host and allowed are used
to implement this allocation-free suffix check.

In `@runtime/tests/skill_session_tests.rs`:
- Line 257: The call to start_skill_session in skill_session_tests.rs is
formatted as a single-line while a similar call in
runtime/tests/integration_tests.rs uses a multi-line style; update the
start_skill_session("fork-test", Some(json!({ "test": "data" })), None)
invocation to match the multi-line formatting used elsewhere so test formatting
is consistent (locate the call to start_skill_session in the test function and
break the arguments across lines similar to the integration_tests example).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b524232e-40db-4f7d-a6c9-79072b78b6e2

📥 Commits

Reviewing files that changed from the base of the PR and between ed36049 and 7eb3be3.

📒 Files selected for processing (47)
  • bindings/python/src/lib.rs
  • bindings/ts/src/lib.rs
  • runtime/src/audit.rs
  • runtime/src/bin/openskills-runtime.rs
  • runtime/src/build/config.rs
  • runtime/src/build/mod.rs
  • runtime/src/build/plugins/adapter.rs
  • runtime/src/build/plugins/assemblyscript.rs
  • runtime/src/build/plugins/javy.rs
  • runtime/src/build/plugins/mod.rs
  • runtime/src/build/plugins/quickjs.rs
  • runtime/src/build/registry.rs
  • runtime/src/context.rs
  • runtime/src/deps_check.rs
  • runtime/src/errors.rs
  • runtime/src/executor.rs
  • runtime/src/hook_runner.rs
  • runtime/src/host_policy.rs
  • runtime/src/lib.rs
  • runtime/src/manifest.rs
  • runtime/src/native_runner.rs
  • runtime/src/permission_callback.rs
  • runtime/src/permissions.rs
  • runtime/src/registry.rs
  • runtime/src/skill_parser.rs
  • runtime/src/validator.rs
  • runtime/src/wasm_runner.rs
  • runtime/tests/always_loaded_tests.rs
  • runtime/tests/claude_official_skills_tests.rs
  • runtime/tests/compatibility_tests.rs
  • runtime/tests/deps_check_tests.rs
  • runtime/tests/edge_case_tests.rs
  • runtime/tests/error_handling_tests.rs
  • runtime/tests/file_io_tests.rs
  • runtime/tests/hook_tests.rs
  • runtime/tests/host_policy_tests.rs
  • runtime/tests/integration_tests.rs
  • runtime/tests/linux_sandbox_tests.rs
  • runtime/tests/registry_tests.rs
  • runtime/tests/resource_tests.rs
  • runtime/tests/sandbox_command_tests.rs
  • runtime/tests/seatbelt_tests.rs
  • runtime/tests/skill_session_tests.rs
  • runtime/tests/spec_conformance_tests.rs
  • runtime/tests/system_prompt_tests.rs
  • runtime/tests/target_execution_tests.rs
  • runtime/tests/wasm_tests.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant