Repository navigation
fix: keep release panic=unwind so filter catch_unwind fails open - #2401
amitgaur-zengineer wants to merge 2 commits into
Conversation
panic = "abort" in [profile.release] made std::panic::catch_unwind a no-op in shipped binaries, so a panic inside any filter (core::stream, cmds::system::pipe_cmd) aborted the whole process with SIGABRT instead of degrading to raw passthrough. Tests did not catch it because cargo test builds with unwind. Add a manifest-level regression guard. Closes rtk-ai#2400
|
|
run_fallback applied the matched TOML filter via core::toml_filter::apply_filter with no catch_unwind, unlike the streaming and pipe paths. Wrap it in a filter_or_passthrough helper so a filter panic degrades to raw passthrough (and prints the panic location) instead of propagating out of the fallback. Refs rtk-ai#2400
- Conflict list: drop rtk-ai#2579/rtk-ai#2590/rtk-ai#2615 (already flagged 07-17), add rtk-ai#2401/rtk-ai#2453 and the chunk-7 conflict cluster; note top-pick rtk-ai#2401 is a hand-port (issue #54). - Next-wave: restore recovered candidate rtk-ai#2256 (gh prompt-injection scan) dropped in distillation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The diagnosis here matches what I found independently in an audit of v0.44.2 ( Provenance: AI-assisted source audit, human-directed; the two points below are read from source at 1. A fourth filter path still has no guard:
|
|
Closing stale PR — superseded or no longer planned. Happy to reopen if this work is picked back up. |
Summary
[profile.release]setspanic = "abort", which makesstd::panic::catch_unwinda no-op — so the filter fail-open recovery incore::streamandcmds::system::pipe_cmd("filter panicked — passing through raw output") is dead code in release builds. Any panic inside a filter aborts the whole process with SIGABRT instead of degrading to raw passthrough (rtk crashes (SIGABRT) ongcloud compute instances list --format=…— poisoned Once cascade #2400; seen in the wild ongcloud … list --format=…).[profile.release] panic = "unwind"so the existingcatch_unwindactually fails open. Adds a manifest-level regression guard (the normal suite can't catch this —cargo testalways builds with unwind, which is why it shipped).run_fallbackapplied the matched TOML filter (core::toml_filter::apply_filter) with nocatch_unwind, unlike the streaming/pipe paths. Wrapped it in afilter_or_passthroughhelper so a filter panic there also fails open (and the default panic hook prints the location, which helps diagnose the underlying filter bug).Test plan
cargo fmt --all && cargo clippy --all-targets && cargo test— fmt clean, clippy clean, 2153 passed / 0 failed (stable 1.96.0)cargo test --test release_profile_panic— passes; verified it FAILS whenpanicis flipped back toabortcargo test filter_or_passthrough— new fallback fail-open tests (panic → passthrough; normal → filtered value)cargo test test_panicking_filter_returns_passthrough— existing fail-open test still passesCloses #2400