Skip to content

fix: fallback to new session on Internal error (-32603) during session/load#30

Open
voidborne-d wants to merge 1 commit intoopenclaw:mainfrom
voidborne-d:fix/session-load-internal-error-fallback
Open

fix: fallback to new session on Internal error (-32603) during session/load#30
voidborne-d wants to merge 1 commit intoopenclaw:mainfrom
voidborne-d:fix/session-load-internal-error-fallback

Conversation

@voidborne-d
Copy link

Problem

Some ACP agents (e.g. claude-agent-acp) cannot restore sessions after a process restart. When session/load is 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-acp returns:

{"code": -32603, "message": "Internal error", "data": {"details": "Query closed before response received"}}

This error code was not in the fallback allowlist.

Fix

  • Add isAcpInternalError() helper in acp-error-shapes.ts to detect -32603
  • Update shouldFallbackToNewSession() in session-runtime.ts to treat Internal errors as recoverable, falling back to createSession

This 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 when session/load returns -32603, instead of crashing with [error] RUNTIME: Internal error.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant