Skip to content

fix(native-sidecar): Clone cancel descriptor under single VmState borrow - #1993

Open
mittal-parth wants to merge 1 commit into
rivet-dev:mainfrom
mittal-parth:fix/panic-during-exec-cancel
Open

mittal-parth wants to merge 1 commit into
rivet-dev:mainfrom
mittal-parth:fix/panic-during-exec-cancel

Conversation

@mittal-parth

@mittal-parth mittal-parth commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • CancelExecution set deadline_task via get_mut, then called get() to clone the descriptor while that RefMut was still live.
  • This panicked with "RefCell already mutably borrowed".
  • This change clones the descriptor from the same get_mut, fixing the panic on abort / cancel.

Tests

All tests under crates/native-sidecar/tests/language_execution.rs now pass

> cargo test -p agentos-native-sidecar --test language_execution -- --test-threads=1
....

running 18 tests
test attached_execution_is_ephemeral_and_does_not_capture_by_default ... ok
test background_and_retained_events_require_valid_identity ... ok
test background_lifecycle_replays_cancels_resets_and_deletes ... ok
test background_process_records_do_not_appear_as_contexts ... ok
test context_survives_completed_operation_ttl ... ok
test contexts_are_explicit_unique_and_language_pinned ... ok
test evaluation_rejects_non_json_values_with_a_structured_result ... ok
test execution_timeout_is_enforced_by_the_sidecar ... ok
test javascript_execution_reuses_retained_context ... ok
test javascript_module_context_shares_state_through_global_this ... ok
test javascript_module_execution_accepts_inline_exports_in_a_context ... ok
test javascript_module_execution_awaits_top_level_promises_in_a_context ... ok
test package_mutations_are_exclusive_across_executions ... ok
test python_execution_reuses_retained_globals ... ok
test stderr_capture_is_independent_from_retained_event_history ... ok
test support::bridge_support::recording_bridge_rejects_symlink_cycles_when_following_metadata ... ok
test support::collect_process_output_stream_append_is_bounded ... ok
test typescript_check_reports_semantic_diagnostics ... ok

test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 10.64s

Ref

Closes #1988

CancelExecution set deadline_task via get_mut, then called get() to clone the descriptor while that RefMut was still live, which panicked with "RefCell already mutably borrowed".

This change clones the descriptor from the same get_mut, fixing the panic on abort / cancel.

@the-company-company the-company-company Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found

Reviewed commit 81ba4e7.

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.

Sidecar panics with "RefCell already mutably borrowed" when cancelling a running execution

1 participant