Feature Request
Add the ability to automatically run context compaction when a context error is returned on a tool call, and then retry the tool call. This should be controlled by a configuration option:
enable-context-compaction: true
Problem
Currently, when a tool call fails due to a context error (e.g., token limit exceeded), the user must manually compact the context and retry the tool call. This is cumbersome and disrupts workflows.
Example Error
Your estimated chat context of 267,173 tokens exceeds the 230,000 token limit for openai/agentic!
Response parsing error. Model openai/agentic has hit a token limit!
Input tokens: ~267,173 of 230,000 -- possibly exhausted context window!
Output tokens: ~0 of 128,000
Total tokens: ~267,173 of 230,000 -- possibly exhausted context window!
Proposed Solution
- Detect Context Errors: Identify when a tool call fails due to context-related errors (e.g., token limit exceeded).
- Automatic Compaction: If
enable-context-compaction: true is set, automatically trigger context compaction.
- Retry Tool Call: After compaction, retry the failed tool call.
- Configuration: Add a new configuration option
enable-context-compaction to control this behavior.
Expected Behavior
If enable-context-compaction: true, the system should:
- Detect the context error.
- Run context compaction automatically.
- Retry the tool call with the compacted context.
Acceptance Criteria
Jira Task
This issue is aligned with Jira task CLI-56.
Feature Request
Add the ability to automatically run context compaction when a context error is returned on a tool call, and then retry the tool call. This should be controlled by a configuration option:
Problem
Currently, when a tool call fails due to a context error (e.g., token limit exceeded), the user must manually compact the context and retry the tool call. This is cumbersome and disrupts workflows.
Example Error
Proposed Solution
enable-context-compaction: trueis set, automatically trigger context compaction.enable-context-compactionto control this behavior.Expected Behavior
If
enable-context-compaction: true, the system should:Acceptance Criteria
enable-context-compactionconfiguration option.Jira Task
This issue is aligned with Jira task CLI-56.