Hmbown/CodeWhale · error
repaired result
Error message
repaired result
What it means
A panic from `prepared.messages.last().expect("repaired result")` in the dangling-tool-call repair test. The test asserts the LAST prepared message is the repaired user-role tool result; the expect fires when the prepared message list is empty — i.e. projection produced no messages at all, so the repair path emitted nothing.
Solutions
- Dump prepared.messages (length and roles) before the assertion to see whether repair emitted anything.
- Verify the repair matcher still expects tool_use_id "call-secret-test" and content containing "crashed_and_repaired" after refactors.
- Check recent edits to the repair-before-adapter-projection path for early-return or filtering that drops the repaired message.
- Confirm client_with_config_secret_sentinels still constructs a client whose model routes through the repairing adapter.
Example fix
// before
assert_eq!(prepared.messages.last().expect("repaired result").role, "user");
// after
let last = prepared.messages.last().unwrap_or_else(|| panic!("no repaired message, prepared = {prepared:#?}"));
assert_eq!(last.role, "user"); Defensive patterns
Strategy: validation
Validate before calling
// rust: check the repair actually emitted a message before asserting role assert!(!prepared.messages.is_empty(), "repair produced no messages");
Try / catch
let last = prepared.messages.last()
.unwrap_or_else(|| panic!("empty prepared.messages: {prepared:#?}"));
assert_eq!(last.role, "user"); Prevention
- Keep repair matchers (tool_use_id, sentinel content) as shared constants used by both producer and test.
- Assert on prepared message count before positional assertions like .last().
- After touching the repair path, run its targeted test and inspect the prepared dump, not just pass/fail.
When it happens
Trigger: `prepared.messages.last()` returns None because the model-bound repair produced zero messages — usually after projection/repair refactors that drop the dangling tool-call's repaired user message, or when the input request's tool_use_id/content guards no longer match.
Common situations: Changes to the dangling tool-call repair that skip emission when the sentinel content 'crashed_and_repaired' or tool_use_id 'call-secret-test' matching changes; upstream projection filtering out user messages for the configured model.
Related errors
- Absolute path should not warn
- child assignment
- child-local search
- configured Web evidence tool
- expected authentication error, got
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/e036ebdfab00255a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/client.rs:8421
let prepared = client.prepare_model_bound_request(request);
assert!(prepared.messages.iter().any(|message| {
message.content.iter().any(|block| {
matches!(
block,
ContentBlock::ToolResult {
tool_use_id,
content,
is_error: Some(true),
..
} if tool_use_id == "call-secret-test"
&& content.contains("crashed_and_repaired")
)
})
}));
assert_eq!(
prepared.messages.last().expect("repaired result").role,
"user"
);
assert!(!prepared.messages.iter().any(|message| {
message.content.iter().any(|block| {
matches!(
block,
ContentBlock::Text { text, .. }
if text.contains("[tool_history_repair]")
)
})
}));
}
#[test]
fn model_bound_tool_results_keep_ordinary_code_byte_exact() {
// #5546: key-only hits in source files must reach the model unchanged
// so exact-match edits and read-back verification keep working.
let client = client_with_config_secret_sentinels();View on GitHub (pinned to 73e0f67d83)