fix: fallback to new session on Internal error (-32603) during session/load#30
Open
voidborne-d wants to merge 1 commit intoopenclaw:mainfrom
Open
Conversation
…n/load Some ACP agents (e.g. claude-agent-acp) cannot restore sessions after a process restart. When session/load is attempted, they return a JSON-RPC Internal error (-32603) instead of a resource-not-found error. Previously, shouldFallbackToNewSession() only recognized resource-not-found errors, causing the Internal error to propagate and break persistent session mode entirely. This change adds isAcpInternalError() and uses it in shouldFallbackToNewSession() so that -32603 errors trigger a graceful fallback to createSession, matching the existing recovery path.
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
Some ACP agents (e.g.
claude-agent-acp) cannot restore sessions after a process restart. Whensession/loadis attempted on a reconnect, they return a JSON-RPC Internal error (-32603) instead of a resource-not-found error.shouldFallbackToNewSession()only recognized resource-not-found errors, so the Internal error propagated as an unrecoverable failure — breaking persistent session mode entirely.Root Cause
claude-agent-acpreturns:{"code": -32603, "message": "Internal error", "data": {"details": "Query closed before response received"}}This error code was not in the fallback allowlist.
Fix
isAcpInternalError()helper inacp-error-shapes.tsto detect-32603shouldFallbackToNewSession()insession-runtime.tsto treat Internal errors as recoverable, falling back tocreateSessionThis matches the existing recovery path for resource-not-found errors.
Testing
Manually verified: after patching,
acpx --approve-all claude "hello"successfully falls back to a fresh session whensession/loadreturns-32603, instead of crashing with[error] RUNTIME: Internal error.