Skip to content

fix(group-chat): separate UI history from model context#1678

Open
hanzckernel wants to merge 3 commits into
mainfrom
fix/groupchat-context-history-cursors
Open

fix(group-chat): separate UI history from model context#1678
hanzckernel wants to merge 3 commits into
mainfrom
fix/groupchat-context-history-cursors

Conversation

@hanzckernel

Copy link
Copy Markdown
Collaborator

改动说明

这个 PR 是 group-chat context/routing hardening stack 的第 1 个切片:只处理历史读取、上下文窗口和 canonical ordering。

主要变化:

  • 将 UI 分页读取和 agent/model context 读取拆开,避免 UI 当前页决定模型上下文。
  • 增加 group-chat message canonical ordering helper,稳定 assistant/tool multipart message 的顺序。
  • 用 message cursor 作为 context/snapshot 边界,避免 timestamp-only cutoff 在同毫秒消息下切错。
  • 压缩 fallback 保留最新 tail,snapshot anchor 被 prune 时保守使用 retained transcript。
  • UI pagination 为了不 split tool run,允许 page boundary 返回略多于 limit 的消息。

设计取舍

  • limit 是 UI page 的目标值,不是硬上限;保持 tool run 完整比严格 message count 更重要。
  • agent context 仍来自 shared room transcript,但通过 summary + tail 控制预算。
  • 不改 core chat、model routing、approval 或普通 /chat-run 行为。

验证

  • npm run harness:check
  • npm run test -- tests/server/group-chat-history-window.test.ts tests/server/group-chat-context-cache.test.ts tests/server/group-chat-context-projection.test.ts tests/server/group-chat-mention-routing.test.ts tests/server/group-chat-agent-instructions.test.ts tests/server/group-chat-clear-context-inflight.test.ts tests/server/context-engine.test.ts tests/server/group-chat-member-sync.test.ts
  • npx tsc --noEmit -p packages/server/tsconfig.json
  • npm run build

本地结果:78 tests passed;build passed。group-chat-member-sync.test.ts 中 mocked runtime failure 的 stderr 是预期测试输出。

Review request

请重点确认:UI pagination 为了保持 assistant/tool-run 完整而把 limit 作为 soft target 是否可接受。

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