fix(core): compact on request byte envelope - #35687
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Potential Related PRs FoundBased on the search, I found several related PRs that involve compaction and request sizing in the core package:
These PRs are related to compaction and request size management, which is the core concern of the current PR (#35687). However, they don't appear to be duplicates—rather, they're part of an evolving compaction strategy for handling request size limits. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #35013
Type of change
What does this PR do?
Adds an optional
compaction.max_request_bytesguard for proactive compaction. The existing token-based behavior remains unchanged unless the setting is configured; when it is configured, the serialized request envelope can trigger compaction before a provider rejects the request for size.This keeps the fallback conservative for providers/routes that can hit request-size limits before the token context threshold.
How did you verify your code works?
bun typecheckfrompackages/corebun test --timeout 30000 test/session-compaction.test.ts test/config/config.test.tsfrompackages/corebun test --timeout 30000 test/session-runner.test.ts --grep 'compaction|overflow'frompackages/corebunx prettier --check packages/core/src/config/compaction.ts packages/core/src/session/compaction.ts packages/core/test/config/config.test.ts packages/core/test/session-compaction.test.tsgit diff --checkbun turbo typecheckcompleted successfully: 30/30 tasksScreenshots / recordings
N/A
Checklist