Skip to content

[Fix] stabilize conversation ordering and bump alpha.6#831

Merged
dingyi222666 merged 2 commits intov1-devfrom
fix/conversation-system
Apr 14, 2026
Merged

[Fix] stabilize conversation ordering and bump alpha.6#831
dingyi222666 merged 2 commits intov1-devfrom
fix/conversation-system

Conversation

@dingyi222666
Copy link
Copy Markdown
Member

description: |-

This pr bumps ChatLuna core to 1.4.0-alpha.6, updates workspace peer dependency ranges, and fixes conversation ordering and route binding behavior so numeric targets and cross-lane switches stay stable.

New Features

None.

Bug fixes

  • keep conversation listing and numeric target resolution stable by using stored seq ordering instead of recent activity order
  • sync the route binding active conversation when switching across preset lanes so route-level state follows the selected lane conversation
  • update conversation service coverage to match the stable ordering and route binding behavior

Other Changes

  • bump koishi-plugin-chatluna to 1.4.0-alpha.6
  • update workspace packages that peer depend on koishi-plugin-chatluna to the new alpha.6 range
  • align rollback_chat conversation type imports with the current lint rules

Release alpha.6 by updating package versions and peer dependency ranges across the workspace. This also stabilizes conversation ordering and route binding updates so numeric targets and preset-lane switches stay consistent.
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

Warning

Rate limit exceeded

@dingyi222666 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 35 minutes and 7 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 35 minutes and 7 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8af37128-1013-451e-af22-1d24f2b19419

📥 Commits

Reviewing files that changed from the base of the PR and between 1bdd674 and 523b2eb.

⛔ Files ignored due to path filters (26)
  • packages/adapter-azure-openai/package.json is excluded by !**/*.json
  • packages/adapter-claude/package.json is excluded by !**/*.json
  • packages/adapter-deepseek/package.json is excluded by !**/*.json
  • packages/adapter-dify/package.json is excluded by !**/*.json
  • packages/adapter-doubao/package.json is excluded by !**/*.json
  • packages/adapter-gemini/package.json is excluded by !**/*.json
  • packages/adapter-hunyuan/package.json is excluded by !**/*.json
  • packages/adapter-ollama/package.json is excluded by !**/*.json
  • packages/adapter-openai-like/package.json is excluded by !**/*.json
  • packages/adapter-openai/package.json is excluded by !**/*.json
  • packages/adapter-qwen/package.json is excluded by !**/*.json
  • packages/adapter-rwkv/package.json is excluded by !**/*.json
  • packages/adapter-spark/package.json is excluded by !**/*.json
  • packages/adapter-wenxin/package.json is excluded by !**/*.json
  • packages/adapter-zhipu/package.json is excluded by !**/*.json
  • packages/core/package.json is excluded by !**/*.json
  • packages/extension-agent/package.json is excluded by !**/*.json
  • packages/extension-long-memory/package.json is excluded by !**/*.json
  • packages/extension-tools/package.json is excluded by !**/*.json
  • packages/extension-variable/package.json is excluded by !**/*.json
  • packages/renderer-image/package.json is excluded by !**/*.json
  • packages/service-embeddings/package.json is excluded by !**/*.json
  • packages/service-multimodal/package.json is excluded by !**/*.json
  • packages/service-search/package.json is excluded by !**/*.json
  • packages/service-vector-store/package.json is excluded by !**/*.json
  • packages/shared-adapter/package.json is excluded by !**/*.json
📒 Files selected for processing (1)
  • packages/core/src/services/conversation.ts

概述

此拉取请求更新了对话类型定义和排序逻辑。导入 ConversationResolution 类型以完善类型注解,将对话列表排序从基于时间戳改为基于序列号,调整显示序列计算方式,并添加条件性绑定更新以处理绑定密钥不匹配场景。

变更

Cohort / File(s) Summary
类型导入和函数签名
packages/core/src/middlewares/chat/rollback_chat.ts
conversation_types 导入 ConversationResolution 类型,将 rollbackConversation()resolved 参数类型调整为 ConversationResolution
对话列表和切换逻辑
packages/core/src/services/conversation.ts
修改排序方式从 lastChatAt ?? updatedAt 改为 seq 字段(降序),更新 listConversationEntries()displaySeq 的计算方式,在 switchConversation() 中添加条件性重新应用活跃对话绑定。
测试用例更新
packages/core/tests/conversation-service.spec.ts
调整测试用例以适配新的 seq 序列排序语义,更新对话顺序和显示序列期望值,补充路由族绑定同步断言。

代码审查工作量评估

🎯 3 (中等) | ⏱️ ~25 分钟

可能相关的 PR

诗句

🐰 序号整齐排一行,
时间戳已远去无踪,
绑定键闭合又打开,
对话流切换得畅快,
测试也跟着微微笑 ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly summarizes the main changes: stabilizing conversation ordering and bumping to alpha.6 version.
Description check ✅ Passed The pull request description is well-structured and directly related to the changeset, covering bug fixes, version bump, and implementation details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/conversation-system

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the version of koishi-plugin-chatluna to 1.4.0-alpha.6 across multiple packages and modifies conversation management logic, specifically changing the sorting and sequence handling. Feedback highlights potential ID collisions when using sequence numbers for display across multiple lanes, logic errors in per-lane state synchronization during conversation switching, and the need for a secondary sort criterion to ensure deterministic ordering.

Comment thread packages/core/src/services/conversation.ts Outdated
Comment thread packages/core/src/services/conversation.ts
Comment thread packages/core/src/services/conversation.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/core/src/services/conversation.ts`:
- Around line 748-749: The current code exposes raw seq values from
allocateConversationSeq(bindingKey) in displaySeq and sorts only by seq, which
causes duplicate seq across allPresetLanes/legacy+canonical merges and makes
targetConversation ambiguous; fix by assigning a stable, merged displaySeq after
combining lists: first deterministically sort merge keys (e.g., by bindingKey
then seq or by createdAt fallback) to stabilize order, then reassign incremental
displaySeq values (1,2,3...) across the merged array so displaySeq is unique and
used for UI ordering/targetConversation resolution (adjust usages in the merging
logic that references seq/displaySeq and ensure targetConversation comparisons
use the new displaySeq). Ensure the same approach is applied to the other merge
block referenced around the 756-759 region.
- Around line 844-849: The code unconditionally synchronizes an external
conversation ID into the current route binding when bindingKey differs, which
can cross route families; before calling setActiveConversation (the block using
current.bindingKey, bindingKey, conversation.id) add a guard that ensures the
target conversation belongs to the same route family as current (respecting
allPresetLanes logic) — e.g., compare the route-family portion of
current.bindingKey and bindingKey (or use an existing routeFamily property) and
only call setActiveConversation when they match, otherwise skip syncing the
binding.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2e84c174-e100-4aa4-be5d-b45b94f1817c

📥 Commits

Reviewing files that changed from the base of the PR and between 2819c31 and 1bdd674.

⛔ Files ignored due to path filters (26)
  • packages/adapter-azure-openai/package.json is excluded by !**/*.json
  • packages/adapter-claude/package.json is excluded by !**/*.json
  • packages/adapter-deepseek/package.json is excluded by !**/*.json
  • packages/adapter-dify/package.json is excluded by !**/*.json
  • packages/adapter-doubao/package.json is excluded by !**/*.json
  • packages/adapter-gemini/package.json is excluded by !**/*.json
  • packages/adapter-hunyuan/package.json is excluded by !**/*.json
  • packages/adapter-ollama/package.json is excluded by !**/*.json
  • packages/adapter-openai-like/package.json is excluded by !**/*.json
  • packages/adapter-openai/package.json is excluded by !**/*.json
  • packages/adapter-qwen/package.json is excluded by !**/*.json
  • packages/adapter-rwkv/package.json is excluded by !**/*.json
  • packages/adapter-spark/package.json is excluded by !**/*.json
  • packages/adapter-wenxin/package.json is excluded by !**/*.json
  • packages/adapter-zhipu/package.json is excluded by !**/*.json
  • packages/core/package.json is excluded by !**/*.json
  • packages/extension-agent/package.json is excluded by !**/*.json
  • packages/extension-long-memory/package.json is excluded by !**/*.json
  • packages/extension-tools/package.json is excluded by !**/*.json
  • packages/extension-variable/package.json is excluded by !**/*.json
  • packages/renderer-image/package.json is excluded by !**/*.json
  • packages/service-embeddings/package.json is excluded by !**/*.json
  • packages/service-multimodal/package.json is excluded by !**/*.json
  • packages/service-search/package.json is excluded by !**/*.json
  • packages/service-vector-store/package.json is excluded by !**/*.json
  • packages/shared-adapter/package.json is excluded by !**/*.json
📒 Files selected for processing (3)
  • packages/core/src/middlewares/chat/rollback_chat.ts
  • packages/core/src/services/conversation.ts
  • packages/core/tests/conversation-service.spec.ts

Comment thread packages/core/src/services/conversation.ts Outdated
Comment thread packages/core/src/services/conversation.ts
Release alpha.7 by updating workspace package versions and peer dependency ranges. This also keeps merged conversation listings stable by sorting within route families deterministically while preserving sequential display numbers for merged results.
@dingyi222666 dingyi222666 merged commit 3303710 into v1-dev Apr 14, 2026
1 of 3 checks passed
@dingyi222666 dingyi222666 deleted the fix/conversation-system branch April 14, 2026 17:14
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