plano/crates/brightstaff
Adil Hafeez 421bff03ac fix: prevent index-out-of-bounds panic in signal analyzer follow-up
The signals analyzer preprocesses messages by filtering out any message
without extractable text (tool calls, tool results, empty content), but
it stores each surviving entry's ORIGINAL conversation index in the
tuple. `analyze_follow_up` then used that stored index to look up
previous user messages inside `normalized_messages`, which panicked
("index out of bounds: the len is N but the index is M") whenever any
message was filtered out before the current turn — a common pattern for
Anthropic conversations containing <tool_use_error> blocks.

The panic is caught at the tokio task boundary so requests still
complete with the default model, but every affected request logs a
noisy stack trace and silently skips signal analysis, which can degrade
routing decisions.

Fix by walking the normalized list with `iter().enumerate()` and using
the inner position for index lookups. The stored original index is kept
only for display ("Turn N") strings.

Includes a regression test that reproduces the exact panic shape via the
public `analyze` entry point.
2026-04-17 18:21:57 -07:00
..
src fix: prevent index-out-of-bounds panic in signal analyzer follow-up 2026-04-17 18:21:57 -07:00
Cargo.toml Redis-backed session cache for cross-replica model affinity (#879) 2026-04-13 19:30:47 -07:00