Skip to content

fix: session restart state handling improvements#19

Open
lzw-git-all wants to merge 1 commit into
Wechat-ggGitHub:mainfrom
lzw-git-all:fix/session-restart-state-clearing
Open

fix: session restart state handling improvements#19
lzw-git-all wants to merge 1 commit into
Wechat-ggGitHub:mainfrom
lzw-git-all:fix/session-restart-state-clearing

Conversation

@lzw-git-all

Copy link
Copy Markdown

Fixes two issues related to session restart:

Problem 1: SDK session ID persists after restart

  • After daemon crash/restart, sdkSessionId still points to stale server-side session
  • Resume causes SDK to continue processing old task instead of new request
  • Fix: Clear sdkSessionId on startup, backup to previousSdkSessionId

Problem 2: Permission timeout uses wrong context

  • sharedCtx.lastContextToken gets overwritten by concurrent messages
  • Timeout message sent to wrong user/context
  • Fix: Store contextToken/fromUserId in PendingPermission itself

Also includes: Code block protection when splitting long messages

Problem 1: SDK session ID persists after restart
- After daemon crash/restart, sdkSessionId still points to stale
  server-side session
- Resume causes SDK to continue processing old task instead of new
  request
- Fix: Clear sdkSessionId on startup, backup to previousSdkSessionId

Problem 2: Permission timeout uses wrong context
- sharedCtx.lastContextToken gets overwritten by concurrent messages
- Timeout message sent to wrong user/context
- Fix: Store contextToken/fromUserId in PendingPermission itself

Also: Protect code blocks when splitting long messages
@lzw-git-all lzw-git-all force-pushed the fix/session-restart-state-clearing branch from 4071596 to dc6c63f Compare March 29, 2026 12:00
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