Skip to content

fix(im-bot): create new Claw session on IM pairing instead of resuming old one#405

Merged
bobleer merged 1 commit intoGCWing:mainfrom
bobleer:fix/im-bot-create-new-session-on-pairing
Apr 14, 2026
Merged

fix(im-bot): create new Claw session on IM pairing instead of resuming old one#405
bobleer merged 1 commit intoGCWing:mainfrom
bobleer:fix/im-bot-create-new-session-on-pairing

Conversation

@bobleer
Copy link
Copy Markdown
Collaborator

@bobleer bobleer commented Apr 14, 2026

Summary

  • After successful IM QR code pairing (WeChat/Telegram/Feishu), always create a new Claw session instead of resuming the most recent one
  • Prevents topic drift caused by the user being unable to see prior conversation context in the IM channel
  • BitFun restart auto-reconnection is unaffected — it restores the persisted BotChatState (including current_session_id) via restore_chat_state, so no duplicate sessions are created on reconnect

Changes

Modified bootstrap_im_chat_after_pairing in command_router.rs:

  • Removed logic that looked up and resumed the latest Claw session via PersistenceManager
  • After successful pairing, always call handle_new_session to create a fresh Claw session
  • Cleaned up unused imports (PersistenceManager, PathManager, PathBuf)

Test plan

  • Pair via WeChat QR code — verify a new Claw session is created (not resuming the old one)
  • Pair via Feishu — verify the same behavior
  • Pair via Telegram — verify the same behavior
  • Restart BitFun and auto-reconnect IM — verify no new session is created, the previous session is preserved
  • Send a message from the IM client — verify it is forwarded to the newly created session correctly

…g old one

When a user pairs via WeChat/Telegram/Feishu QR code and sends a message
without selecting a session, the bot previously resumed the most recent
Claw session. This caused topic drift because the user cannot see the
prior conversation context in the IM channel.

Now a fresh Claw session is always created after successful pairing.
Reconnections after BitFun restart are unaffected — they restore the
persisted BotChatState (including current_session_id) directly via
restore_chat_state, so no duplicate sessions are created on reconnect.
@bobleer bobleer merged commit f76144c into GCWing:main Apr 14, 2026
4 checks passed
@bobleer bobleer deleted the fix/im-bot-create-new-session-on-pairing branch April 15, 2026 11:44
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