Title: Add automatic context compaction and retry on context errors · Issue #603 · cecli-dev/cecli · GitHub
Open Graph Title: Add automatic context compaction and retry on context errors · Issue #603 · cecli-dev/cecli
X Title: Add automatic context compaction and retry on context errors · Issue #603 · cecli-dev/cecli
Description: 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 P...
Open Graph Description: 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 o...
X Description: 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 o...
Opengraph URL: https://github.com/cecli-dev/cecli/issues/603
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add automatic context compaction and retry on context errors","articleBody":"## Feature Request\n\nAdd 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:\n\n```yaml\nenable-context-compaction: true\n```\n\n### Problem\n\nCurrently, 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.\n\n### Example Error\n\n```\nYour estimated chat context of 267,173 tokens exceeds the 230,000 token limit for openai/agentic!\nResponse parsing error. Model openai/agentic has hit a token limit!\nInput tokens: ~267,173 of 230,000 -- possibly exhausted context window!\nOutput tokens: ~0 of 128,000\nTotal tokens: ~267,173 of 230,000 -- possibly exhausted context window!\n```\n\n### Proposed Solution\n\n1. **Detect Context Errors**: Identify when a tool call fails due to context-related errors (e.g., token limit exceeded).\n2. **Automatic Compaction**: If `enable-context-compaction: true` is set, automatically trigger context compaction.\n3. **Retry Tool Call**: After compaction, retry the failed tool call.\n4. **Configuration**: Add a new configuration option `enable-context-compaction` to control this behavior.\n\n### Expected Behavior\n\nIf `enable-context-compaction: true`, the system should:\n1. Detect the context error.\n2. Run context compaction automatically.\n3. Retry the tool call with the compacted context.\n\n### Acceptance Criteria\n\n- [ ] Detect context errors (e.g., token limit exceeded) during tool calls.\n- [ ] Add `enable-context-compaction` configuration option.\n- [ ] Automatically compact context and retry the tool call if the option is enabled.\n- [ ] Ensure the feature is backward-compatible (disabled by default).\n- [ ] Add tests for the new functionality.\n- [ ] Update documentation to describe the new feature.\n\n### Jira Task\n\nThis issue is aligned with Jira task [CLI-56](https://team-16702636586024.atlassian.net/browse/CLI-56).","author":{"url":"https://github.com/szmania","@type":"Person","name":"szmania"},"datePublished":"2026-07-14T17:49:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/603/cecli/issues/603"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:cfb4648c-b396-4b25-7fbf-fce4e1232b41 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D84C:3D3167:451EA0:5AFD3D:6A61527D |
| html-safe-nonce | c9556571c282632d8faabb4d715580b94cf913c3b2364c68b9b8ef27e2da2a47 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODRDOjNEMzE2Nzo0NTFFQTA6NUFGRDNEOjZBNjE1MjdEIiwidmlzaXRvcl9pZCI6IjkxNDcwMDQ4NzAxMjE4MzcxODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | db65d1baf844e18211da2ff2c247eaaa2c7fdf3dd326ddf7e8afc89d7e9a57ec |
| hovercard-subject-tag | issue:4885661541 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/cecli-dev/cecli/603/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1691e62cb38203c2d32895d7026f76e958a3de001176caa4929f3de98ae3e2a2/cecli-dev/cecli/issues/603 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1691e62cb38203c2d32895d7026f76e958a3de001176caa4929f3de98ae3e2a2/cecli-dev/cecli/issues/603 |
| og:image:alt | 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 o... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | szmania |
| hostname | github.com |
| expected-hostname | github.com |
| None | 35b919fdb8e6752d2ed95a144e761ca5e924557563e2ed0a5ebf6c4430cdeeb6 |
| turbo-cache-control | no-preview |
| go-import | github.com/cecli-dev/cecli git https://github.com/cecli-dev/cecli.git |
| octolytics-dimension-user_id | 250452847 |
| octolytics-dimension-user_login | cecli-dev |
| octolytics-dimension-repository_id | 1030985330 |
| octolytics-dimension-repository_nwo | cecli-dev/cecli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 638629097 |
| octolytics-dimension-repository_parent_nwo | Aider-AI/aider |
| octolytics-dimension-repository_network_root_id | 638629097 |
| octolytics-dimension-repository_network_root_nwo | Aider-AI/aider |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1e22b08b60ccb67c3791f565bed248565260e611 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width