Skip to content

Fix ACP reconnect fallback for internal session-not-found errors#22

Merged
osolmaz merged 5 commits intoopenclaw:mainfrom
osolmaz:fix/claude-reconnect-not-found-fallback
Feb 25, 2026
Merged

Fix ACP reconnect fallback for internal session-not-found errors#22
osolmaz merged 5 commits intoopenclaw:mainfrom
osolmaz:fix/claude-reconnect-not-found-fallback

Conversation

@dutifulbob
Copy link
Contributor

Summary

  • fix reconnect recovery when ACP adapters return -32603 Internal error with session-missing details in error.data
  • improve reconnect load strategy to try agentSessionId first, then fallback candidates, before creating a new session
  • add regression coverage for both error classification and reconnect behavior

What changed

  • src/error-normalization.ts
    • expanded resource-not-found detection to include nested ACP data fields (for example data.details: "Session not found")
  • src/session-runtime.ts
    • added load-session candidate resolution (agentSessionId, then sessionId)
    • retries load across candidates on recoverable not-found errors
    • falls back to createSession only after candidates are exhausted
  • test/mock-agent.ts
    • added test flags to emulate load-session internal-not-found error shapes and required load target IDs
  • test/error-normalization.test.ts
    • regression test for -32603 + data.details: Session not found
  • test/cli.test.ts
    • regression test: prompt falls back to new session on internal-not-found load errors
    • regression test: prompt prefers agentSessionId on reconnect load

Verification

  • npm test
  • npm run lint
  • npm run typecheck
  • npm run format:check
  • manual smoke (real Claude adapter):
    • command: timeout 45 node dist/cli.js --approve-all --timeout 120 --format text claude -s oc-claude-smoke "Reply exactly FIX_OK"
    • output contained FIX_OK and [done] end_turn (previously this path failed with Internal error / Session not found)

@osolmaz osolmaz merged commit 3637248 into openclaw:main Feb 25, 2026
1 check passed
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.

2 participants