Repository navigation
Description
Problem
The request dump shows a later LLM request carrying stale inferred actions:
- "Let me first check if there's anything relevant in the workspace..."
- "Let me start by searching for any relevant files..."
Both workspace searches had already run and returned empty results, but the summary still presents these actions as active [inferred] decisions.
The current extractor explicitly treats "let me " as an intent cue (crates/react/src/thinking/extract.rs:66,248). The lifecycle stores the action associated with a pending tool call, but the successful-result path does not use that action to retire or resolve the matching intent (crates/react/src/thinking/lifecycle.rs:263-371). prepare_injection then includes every still-live decision unless it is already present as a literal substring in recent history (lifecycle.rs:383+, history_contains near line 1006). Paraphrased versions can therefore survive the duplicate check.
This creates stale execution context and can bias the next model step toward repeating work that has already completed.
Required changes
- Do not treat conversational narration such as "let me first..." as a durable decision by default. Keep extraction focused on explicit choices, factual claims, unresolved questions, and concrete next actions.
- When a tool result resolves a pending call, retire or resolve only the intent/action that is demonstrably associated with that call. Do not mark unrelated decisions complete merely because a tool succeeded.
- Before injection, exclude completed/superseded actions and avoid relying solely on exact substring matching to detect content already represented in recent history.
- Keep the existing
ThinkingState,ThinkingSnapshot, andHostGuidancedesign. Do not replay full reasoning or redesign agent state.
Acceptance criteria
- "Let me first inspect the workspace" is not retained as a durable decision merely because it appears in reasoning.
- A concrete intent associated with a tool call is no longer injected as active after that call returns successfully.
- An unrelated successful tool call does not retire other active intents or claims.
- A failed or interrupted tool call remains unresolved; it is not marked complete.
- A multi-step test proves that a completed search action is absent from the next request's thinking summary, while a still-pending action remains present.
- A regression test covers paraphrased assistant narration already represented in history.
Evidence
The attached BSH request dump contains the two stale inferred actions after the corresponding grep calls returned empty results. The relevant implementation paths are:
crates/react/src/thinking/extract.rscrates/react/src/thinking/lifecycle.rs
This is separate from #438's verification/interruption fixes and does not change the provider-native reasoning contract.
Activity
react: retire completed thinking intents before injection (#441)