fix(opencode): handle context overflow error by triggering compaction#15320
fix(opencode): handle context overflow error by triggering compaction#15320aniasse wants to merge 8 commits intoanomalyco:devfrom
Conversation
Display $schema field if present in auth.json Display configured providers from provider section Show whether each provider has credentials configured Fixes anomalyco#4533
…rovider fix(auth): display $schema and provider config in auth list
Use en-CA locale to ensure consistent YYYY-MM-DD output This resolves ambiguity between MM/DD/YYYY and DD/MM/YYYY formats Fixes anomalyco#12398
Use en-CA locale to ensure consistent YYYY-MM-DD output This resolves ambiguity between MM/DD/YYYY and DD/MM/YYYY formats Fixes anomalyco#12398
fix(opencode): standardize date format to ISO 8601
fix: standardize date format to ISO 8601
When a ContextOverflowError is caught, automatically trigger compaction instead of ignoring the error. This ensures the session can recover from context overflow errors without manual intervention. Fixes related to issue anomalyco#9902 - session auto-naming failures
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate PRs FoundI found several related PRs that may be addressing similar issues:
Most concerning: PR #14826 appears to be a near-duplicate of this PR, as it specifically addresses recovering from |
Cast rawAuth to Record<string, unknown> to fix TypeScript error
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Issue
Closes #9902
Type of change
What does this PR do?
Handles context overflow errors by automatically triggering compaction instead of silently ignoring them. When a
ContextOverflowErroris caught, the code now setsneedsCompaction = trueto ensure the session can recover from context overflow without manual intervention.Changes
packages/opencode/src/session/processor.tsto setneedsCompaction = truewhen aContextOverflowErroris caughtauth.tsthat was causing typecheck failuresWhy this works
The existing compaction logic already handles token overflow by compressing the conversation history. By triggering this same logic when an API returns a
ContextOverflowError, we ensure the session automatically recovers rather than failing.How did you verify my code works?
Checklist