Repository navigation
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2f88e91ee
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return false; | ||
| } | ||
| if returned >= self.maximum { | ||
| self.next_message.get_or_insert(self.first + returned); |
There was a problem hiding this comment.
当匹配消息之间夹有不匹配消息时,self.first + returned 并不是当前溢出命中的 message_index;例如限制为 1、命中位于消息 11 和 21 时,第一页会把续页位置写成消息 2,后续页面将重复返回消息 11,并逐条推进大量无关消息。这里应保留当前 message_index,否则稀疏搜索结果会出现重复项和异常多的续页请求。
AGENTS.md reference: AGENTS.md:L9-L9
Useful? React with 👍 / 👎.
| .filter(|message| self.visible(message)) | ||
| .nth(end - 1) |
There was a problem hiding this comment.
当所选轮次之前存在 context_compactions 隐藏的摘要消息,并且所选轮次之后还有历史时,end 仍是原始消息数组的独占下标,但这里先过滤可见消息再执行 nth(end - 1),会把 lastMessageId 指向后续消息。例如隐藏一条摘要后对中间轮次 Fork,OpenCode 可能收到下一轮 user 的 ID 而拒绝请求,其他原生运行时则可能在错误的更晚位置创建分支;锚点应继续使用原始边界 messages[end - 1]。
AGENTS.md reference: AGENTS.md:L9-L9
Useful? React with 👍 / 👎.
| raw_turns_before( | ||
| self.session, | ||
| self.position.message + usize::from(self.position.offset > 0), | ||
| ) |
There was a problem hiding this comment.
当字节预算把一条 user 消息切成多个 fragment 时,续页游标的 offset > 0,这里已经把当前 user 消息计入 turn_prefix,而 context_page 随后处理该消息时还会再次执行 current_turn += 1。因此同一条消息第一页的 turn 为 N、后续 fragment 却变成 N+1,破坏分页前后稳定的消息轮次映射;前缀应只统计 position.message 之前的 user 消息。
AGENTS.md reference: AGENTS.md:L9-L9
Useful? React with 👍 / 👎.
|
@codex fix the issues identified in your review. 请逐项修复本 PR 中你刚刚报告的问题,补充能够复现相应问题的回归测试,并运行相关检查。保留本次模块重构,将修复提交并推送到当前 PR 分支 |
|
To use Codex here, create an environment for this repo. |
|
@codex fix the issues identified in your review. 请逐项修复本 PR 中你刚刚报告的问题,补充能够复现相应问题的回归测试,并运行相关检查。保留本次模块重构,将修复提交并推送到当前 PR 分支 |
|
To use Codex here, create an environment for this repo. |
|
@codex fix the issues identified in your review. 请逐项修复本 PR 中你刚刚报告的问题,补充能够复现相应问题的回归测试,并运行相关检查。保留本次模块重构,将修复提交并推送到当前 PR 分支 |
修改总结
验证结果
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
会话读取中的分页状态、消息视图、摘要窗口和 block 分片分散在同一个模块,原生分支点也各自计算轮次和消息位置。本次将这些职责拆分并集中维护,便于后续扩展读取能力。
验证:Rust 库的 857 个单元测试、3 个分页集成测试、Clippy(所有目标且告警视为错误)、格式检查及生成契约一致性检查均通过。