fix: trigger compaction before continue after session error recovery (fixes #390)#2766
Merged
code-yeongyu merged 1 commit intodevfrom Mar 23, 2026
Merged
fix: trigger compaction before continue after session error recovery (fixes #390)#2766code-yeongyu merged 1 commit intodevfrom
code-yeongyu merged 1 commit intodevfrom
Conversation
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 2/5
- There is a high-confidence, user-facing failure in
src/plugin/event.ts: thesummarizerequest body omitsproviderIDandmodelID, which is expected to trigger a 400 Bad Request. - Given the severity (9/10) and certainty (10/10), this is likely to break core summarize behavior rather than a minor edge case, so merge risk is high until addressed.
- Pay close attention to
src/plugin/event.ts- missing required payload fields for the summarize API call can cause immediate request failures.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/plugin/event.ts">
<violation number="1" location="src/plugin/event.ts:507">
P0: Custom agent: **Opencode Compatibility**
The `summarize` API call will fail with a 400 Bad Request because `providerID` and `modelID` are missing from the request body payload.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Comment on lines
+507
to
+511
| // Trigger compaction before sending "continue" to avoid double-sending continuation | ||
| await pluginContext.client.session | ||
| .summarize({ | ||
| path: { id: sessionID }, | ||
| body: { auto: true }, |
There was a problem hiding this comment.
P0: Custom agent: Opencode Compatibility
The summarize API call will fail with a 400 Bad Request because providerID and modelID are missing from the request body payload.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/plugin/event.ts, line 507:
<comment>The `summarize` API call will fail with a 400 Bad Request because `providerID` and `modelID` are missing from the request body payload.</comment>
<file context>
@@ -502,6 +504,17 @@ export function createEventHandler(args: {
sessionID === getMainSessionID() &&
!hooks.stopContinuationGuard?.isStopped(sessionID)
) {
+ // Trigger compaction before sending "continue" to avoid double-sending continuation
+ await pluginContext.client.session
+ .summarize({
</file context>
Suggested change
| // Trigger compaction before sending "continue" to avoid double-sending continuation | |
| await pluginContext.client.session | |
| .summarize({ | |
| path: { id: sessionID }, | |
| body: { auto: true }, | |
| // Trigger compaction before sending "continue" to avoid double-sending continuation | |
| const providerID = resolveFallbackProviderID(sessionID, props?.providerID as string | undefined); | |
| const modelID = (props?.modelID as string | undefined) || lastKnownModelBySession.get(sessionID)?.modelID || getSessionModel(sessionID)?.modelID || "claude-opus-4-6"; | |
| await pluginContext.client.session | |
| .summarize({ | |
| path: { id: sessionID }, | |
| body: { providerID, modelID, auto: true }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After session error recovery, "continue" is sent to resume without compaction, potentially causing duplicate continuation or oversized context.
Fix
Trigger compaction before sending "continue" in the session error recovery handler.
Fixes #390
Automated fix by Sisyphus (oh-my-opencode)
Summary by cubic
Trigger compaction before resuming after session error recovery to prevent duplicate continuation and oversized context. If compaction fails, we still resume. Fixes #390.
session.summarizebeforesession.promptin the recovery path; log failures without blocking resume.Written for commit 4c4760a. Summary will update on new commits.