fix(shell): recover every lock a panic poisoned instead of failing until restart (2/4) #227
<!-- codex-pull-request-review-summary -->
<!-- codex-review-state:v1 {"code_review":{"commit_sha":"38eeddc3341b7fe3064c308ae584432c877995c4","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} -->
<details>
<summary><strong>Codex Review Summary</strong>: ✅ Completed</summary>
This comment shows the latest Codex review activity on this pull request.
| Review | Status | Commit | Review trigger |
| --- | --- | --- | --- |
| 📝 Code Review | ✅ Completed <relative-time datetime="2026-11-30T13:53:32.000384Z">2026-11-30T13:53:32.000384Z</relative-time> | 38eeddc | PR opened |
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Your 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.
</details>
</details>
<sub><sub>!P1 Badge</sub></sub> Clear poison before relying on self-exit reapers
When children has ever been poisoned, recovering it with PoisonError::into_inner does not clear the mutex's poison flag, so every current and future self-exit reaper still reaches the TryLockError::Poisoned panic in try_reap. observe can reap one child when explicitly called, but normal adapter launches wait on the subscribed output channel for the reaper's final state frame and do not continuously call observe; a naturally exiting run can therefore remain stuck, and the same happens to subsequent runs until restart. Recover the poisoned guard in try_reap or clear the poison flag after recovery.
Useful? React with 👍 / 👎.
<!-- codex-code-review-finding:v1 -->
<!-- codex-review-receipt:v1 -->
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38eeddc334
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Your 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".
</details>
Fixed in 219ee2d. try_reap now takes a poisoned children table with into_inner, as every other accessor does, instead of panicking. Regression test: a_child_that_exits_by_itself_after_the_children_table_was_poisoned_ends_its_run. Before the fix, the reaper panicked and the run never got its final state.
constant1n0
Later work left by the reviews of #222–#225: a panic while a lock is held no longer leaves the shell or the supervisor failing until restart.
Chain context
size:exceptionis requested. It is one rule applied to every lock in two crates, plus 15 tests that each poison a table.What changes
- On the async side, the run, candidate, active-workspace, wrong-root and publication tables were locked with
.expect.- A lock poisoned by an earlier panic made the command panic, and Tauri never settled it.
- These locks now recover their data with
PoisonError::into_inner, as the adapter state already did.-
with_gateand the supervisor's tables (children,settling,stopping,lingering,terminals, outputs) used to answer an error on every call until the app restarted.- Now a running child can still be observed and stopped.
- Recovery cannot lose an approval or a child: the gate holds no in-memory state, and the child table is only written in place.
- The self-exit reaper recovers the child table too, so a child that exits by itself still ends its run. Recovering a lock does not clear its poison flag, so the reaper used to panic on every later poll (Codex review, 219ee2d).
-
ExecutableState's gate and candidates are private behind recovering accessors.-
active_workspacedelegates toactive_workspace_in, so it can be tested without anAppHandle.run-{seconds}-…, with unpadded seconds), so it keeps passing once PR 3/4 parses run names strictly.Checks
-
cargo test -p omnifrons-supervisor: 199 passed.-
cargo test -p omnifrons-shell: all passed.- clippy: clean, also cross-target for the supervisor.
expectbefore the fix. The self-exit test ended with no final state (left: None) while the reaper panicked.pick_workspacerefusal: an earlier review asked for a test. It is already pinned bya_workspace_pick_is_refused_while_a_switch_step_holds_the_slot, and two mutations fail it.Risk
Out of scope (later work)