Skip to content

fix: add contextLimitFallback for unknown context limits#359

Closed
tobwen wants to merge 1 commit intoOpencode-DCP:masterfrom
tobwen:hotfix/contextLimitFallback
Closed

fix: add contextLimitFallback for unknown context limits#359
tobwen wants to merge 1 commit intoOpencode-DCP:masterfrom
tobwen:hotfix/contextLimitFallback

Conversation

@tobwen
Copy link
Contributor

@tobwen tobwen commented Feb 6, 2026

summary

When a model's context window is unknown and percentage-based contextLimit is used, fall back to contextLimitFallback (default: 100k tokens) instead of disabling context management entirely.

changes

  • Add contextLimitFallback config option
  • Use fallback in resolveContextLimit when modelContextLimit is undefined
  • Add validation and merge logic for the new option

example (optional)

{
  "tools": {
    "settings": {
      "contextLimit": "60%",
      "contextLimitFallback": 100000
    }
  }
}

Fixes #358

### summary
When a model's context window is unknown and percentage-based contextLimit is used, fall back to contextLimitFallback (default: 100k tokens) instead of disabling context management entirely.

### changes
- Add contextLimitFallback config option
- Use fallback in resolveContextLimit when modelContextLimit is undefined
- Add validation and merge logic for the new option

### example (optional)
```json
{
  "tools": {
    "settings": {
      "contextLimit": "60%",
      "contextLimitFallback": 100000
    }
  }
}
```
@tobwen tobwen closed this by deleting the head repository Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] edge-case: token limit for model not defined

1 participant