-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug: "continue" sent without compaction after session error recovery
Summary
When session recovery handles certain errors (thinking block, tool result missing), it sends "continue" to resume the session without any compaction occurring. This can be confusing to users who see "Continue" appear unexpectedly.
Root Cause
src/index.ts lines 604-612:
if (event.type === "session.error") {
// ...
if (recovered && sessionID && sessionID === getMainSessionID()) {
await ctx.client.session
.prompt({
path: { id: sessionID },
body: { parts: [{ type: "text", text: "continue" }] },
query: { directory: ctx.directory },
})
.catch(() => {});
}
}Affected Error Types
thinking_block_order- thinking block structure errorsthinking_disabled_violation- thinking blocks when thinking is disabledtool_result_missing- missing tool results after ESC/abort
Flow
- Session error occurs (e.g., thinking block issue)
sessionRecovery.handleSessionRecovery()fixes the message structure- If recovery succeeds → "continue" is sent
- No compaction happened, but user sees "Continue" appear
Potential Duplicate Issue
Additionally, when experimental.auto_resume is enabled:
session-recovery/index.tslines 396-400, 403-407 already callresumeSession()which sends"[session recovered - continuing previous task]"- Then
index.tsline 608 ALSO sends"continue" - This could result in double resume messages
Questions to Resolve
- Should "continue" be sent after session error recovery at all?
- If yes, should it be conditional on
experimental.auto_resume? - Should the duplicate with
resumeSession()insidehandleSessionRecovery()be resolved?
Suggested Fix Options
Option A: Remove the "continue" from index.ts entirely, rely on auto_resume in session-recovery
// Remove lines 604-612 from index.ts
// Let session-recovery handle resumption when auto_resume is enabledOption B: Make it conditional on NOT having auto_resume
if (recovered && sessionID && sessionID === getMainSessionID()) {
// Only send continue if auto_resume didn't already handle it
if (!pluginConfig.experimental?.auto_resume) {
await ctx.client.session.prompt({...})
}
}Option C: Add a toast notification so user understands what happened
if (recovered && sessionID && sessionID === getMainSessionID()) {
await ctx.client.tui.showToast({
body: {
title: "Session Recovered",
message: "Fixed message structure issue. Resuming...",
variant: "success",
duration: 2000,
},
}).catch(() => {});
await ctx.client.session.prompt({...})
}Environment
- oh-my-opencode version: latest (dev branch)
- Discovered: 2025-01-01
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working