fix(core): handle unknown ChatResponse variant gracefully in tier_loop#4786
Merged
Conversation
5d457d5 to
700e475
Compare
Replace `unreachable!()` in the `ChatResponse::ToolUse` let-else branch with `tracing::warn!(?chat_result, ...)` and `Ok(Some(()))` early exit. `ChatResponse` is `#[non_exhaustive]`, so `unreachable!()` would panic on any future variant addition — exactly the scenario the attribute is meant to enable safely. The return value matches all other terminal early-exits in `process_single_native_turn`. Closes #4778.
700e475 to
43e4ef6
Compare
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.
Summary
unreachable!()in theChatResponse::ToolUselet-else branch inprocess_single_native_turn(tier_loop.rs:2569) with atracing::warn!(?chat_result, ...)log andOk(Some(()))early exit.ChatResponseis#[non_exhaustive](added in refactor: add #[non_exhaustive] to remaining pub enums (workspace sweep) #4759), makingunreachable!()a latent panic on any future variant addition.Ok(Some(()))matches all other terminal early-exits in the same function (timeout, budget, Text branch).Test plan
cargo +nightly fmt --check— cleancargo clippy -p zeph-core --all-targets -- -D warnings— cleancargo nextest run --workspace --lib --bins— 10450 passed, 21 skippedRUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked— cleanCloses #4778.