Skip to content

fix: 话题路由和会话恢复消息修正 - #8

Merged
lishuceo merged 1 commit into
mainfrom
fix/thread-routing-and-session-resume
Feb 17, 2026
Merged

fix: 话题路由和会话恢复消息修正#8
lishuceo merged 1 commit into
mainfrom
fix/thread-routing-and-session-resume

Conversation

@lishuceo

Copy link
Copy Markdown
Owner

Summary

  • 解析 message.root_id,用户在已有话题内发消息时直接复用该话题,不再重复创建新话题和发送问候
  • 根据 conversationId 区分"新会话已创建"和"会话已恢复"问候语,避免恢复会话时显示错误提示
  • 会话过期时间从 2 小时延长到 24 小时;更新 README PM2 部署文档

Test plan

  • npm run build 编译通过
  • npm test 45 个测试全部通过
  • 飞书实测:话题内发消息只收到一条回复,无重复卡片

🤖 Generated with Claude Code

- 解析 message.root_id,在已有话题内回复时不再创建新话题
- 根据 conversationId 区分"新会话已创建"和"会话已恢复"问候语
- 斜杠命令在话题内发送时优先回复到该话题
- 会话过期时间从 2 小时延长到 24 小时
- 更新 README PM2 部署文档

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Feb 17, 2026

Copy link
Copy Markdown

Claude finished @lishuceo's task in 1m 11s —— View job


Code Review: fix/thread-routing-and-session-resume

  • Check for previous review comments — none found
  • Read project context (CLAUDE.md, architecture)
  • Review all 3 changed files in full context
  • Post review findings

✅ Approved

Overall assessment: This is a clean, well-scoped fix that addresses two concrete UX problems — duplicate thread creation and incorrect greeting text on session resume.

Changes reviewed:

  1. src/feishu/event-handler.ts — Core logic changes:

    • parseMessage now extracts message.root_id (with proper falsy-to-undefined coercion at line 443).
    • ensureThread gains a rootId parameter with correct 3-way branching: (1) reuse existing thread if rootId is present, (2) use stored thread info, (3) create new thread with appropriate greeting.
    • handleSlashCommand correctly resolves threadRootMsgId as rootId || currentSession?.threadRootMessageId, ensuring slash commands within a thread reply to the right place.
    • The isResumed check (!!session.conversationId) is correct — conversationId is only set after a successful Claude execution, so it accurately distinguishes new vs. resumed sessions.
  2. src/session/manager.ts — Session expiry changed from 2h to 24h. The cleanup interval in index.ts (30 min) remains appropriate since it's independent of the TTL.

  3. README.md — PM2 documentation expanded with common commands. No issues.

No bugs, security issues, or architectural concerns found. The rootId threading logic correctly handles all three scenarios (in-thread, out-of-thread with prior thread, and brand new) and the parameter is properly threaded through handleSlashCommand and executeClaudeTask.

@lishuceo
lishuceo merged commit a485de6 into main Feb 17, 2026
1 check passed
@lishuceo
lishuceo deleted the fix/thread-routing-and-session-resume branch February 17, 2026 10:12
lishuceo added a commit that referenced this pull request Feb 17, 2026
解决与 #8 (fix: 话题路由和会话恢复消息修正) 的合并冲突:
- QueueTask 增加 rootId 字段
- TaskQueue.enqueue 接受 rootId 参数
- processQueue 将 rootId 传递给 executeClaudeTask

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
lishuceo added a commit that referenced this pull request Apr 8, 2026
- 解析 message.root_id,在已有话题内回复时不再创建新话题
- 根据 conversationId 区分"新会话已创建"和"会话已恢复"问候语
- 斜杠命令在话题内发送时优先回复到该话题
- 会话过期时间从 2 小时延长到 24 小时
- 更新 README PM2 部署文档

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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