-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Feature Request: Option to preserve conversation context when retrying on failure (reset_context: false) #8298
Description
Background & Problem
Currently, when a retry operation is triggered (e.g., following a failure in automated checks or system commands), Goose resets the conversation context. While a clean slate can be useful for isolated, independent retries, it is not ideal for iterative problem solving.
When an operation fails—such as a compiler error or failing tests—the error output and the context of the actions that led up to the error are vital for diagnosing the problem. Developers and agents often need to fix these errors sequentially within the same context, rather than having the operation restart from a completely new conversation.
If the conversation context is wiped out during a retry, the agent cannot access the very stdout/stderr it needs to self-correct based on immediate feedback.
Proposed Solution
We propose introducing a reset_context configuration field to the retry and failure logic natively within the agent session. Setting reset_context: false would allow users to specify that the conversation history should be preserved when executing failure handlers or retrying.
When reset_context is configured to false:
- The session history remains intact.
- The failure output (like stdout/stderr and exit codes) is gracefully appended to the conversation as an agent-only context/feedback message.
- The agent can actively analyze the specific feedback, self-correct its earlier output, and attempt the task again iteratively within the exact same session.
This feature enables a much tighter and elegant feedback loop. It empowers the agent for multi-step tasks (e.g., resolving a broken test or fixing a syntax issue that it just introduced) to learn from its immediate mistakes and continue smoothly towards the overarching goal.
References
- This issue is associated with the proposal and prior implementation attempt in PR refactor: enhance retry mechanism with flexible context management #8284