Fix hung invoke freeze and reap OS children on chat stop - #11
Merged
Conversation
Drop the kernel write lock across WASM invoke and audit JSONL I/O so one stuck skill cannot freeze mediate/charge/court. Dispatch timeout now increments the wasmtime epoch to trap the guest; stdio uses the same 30s bound. Chat stop (llm_release_by_process) and end_process SIGKILL isolation_spawn_os children without waiting under the lock. Retarget orch_window_force to the production 6/8 window so kernel-ci can pass. Co-authored-by: wu1w <wu1w@users.noreply.github.com>
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.
One hung WASM invoke or audit write could freeze the whole host, and Stop left
isolation_spawn_oschildren running until a 600s dispatcher tick. This PR keeps the personal-desktop fail-open: no new court asks, capability gates, permission prompts, or tighter allowlists.What changed
1. A stuck invoke cannot wedge the host
wasm_invokesnapshots the compiled module, drops the kernelRwLock, runs the guest, then applies status under a short write lock.spawn_blockingcannot be cancelled).max_agestays 600s so long-running intended children are not killed early.2. Chat stop reaps OS children
llm_release_by_process(notend_process). That RPC nowisolation.drop_processand SIGKILLs the process group.end_processalready calleddrop_process;kill()no longerwait()s on the calling thread, so a wedged child cannot hold the write lock.3. kernel-ci stale test
loop_guard::tests::orch_window_forcestill expected a trip after ~3 orch rounds. Production window is ≥6 of last 8.orch_window_thrashon the 6th. Production thresholds were not loosened.What I verified
main(cfccbbb) against the C1 / H5 / H7 hypotheses. They held.cargo test -p tevarn-kernel --locked --all-targets: 117 lib + 4 abi_v1 passed (includingorch_window_force,wasm_invoke_does_not_hold_kernel_lock,epoch_increment_traps_infinite_loop,end_process_reaps_os_children,llm_release_by_process_reaps_os_children).cargo check -p tevarn-kernel-host --lockedsucceeded.Deliberately skipped (smoothness)
asklist expansion (file_edit/remote_exec/shell_session).mcp_*allowlist tightening, extra_roots rewrite, steward/_workforcechecks, or per-call policy confirmation.llm_release_by_processRPC.test_court_authority.pyadded to kernel-ci (out of scope; would not fix the cargo-first red).How to tell this is done
mainorch_window_forceend_processSIGKILLsisolation_spawn_oschildren without a new promptwasm_invokedoes not block later mediate/charge/court