Skip to content

fix(chat): order bound Session history after validation - #9535

Open
hhyykk wants to merge 1 commit into
mainfrom
codex/chat-bound-session-history-chronology
Open

hhyykk wants to merge 1 commit into
mainfrom
codex/chat-bound-session-history-chronology

Conversation

@hhyykk

@hhyykk hhyykk commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

The read-only Chat history for a conversation binding returned rows in lexical timestamp order. A retained fractional-second update could appear after an older whole-second or offset-encoded update.

The snapshot now sorts the Session rows returned by Core by UTC chronology. The existing ordering of equal instants and the returned timestamp strings are preserved. The binding recheck still runs before the snapshot is returned.

Author Declaration

  • Written by model_agent, OpenAI Codex (GPT-6 family).
  • Reproduced on main at 509360fb0 through the real loopback bound Session history endpoint.
Criterion Disposition Evidence
Show the latest approved Session first implemented The real HTTP response puts the one-microsecond-later marked Session first. The equal UTC instants keep their previous relative order.
Preserve read-only behavior and original timestamps implemented The HTTP regression compares the records and fixture provider calls before and after readback.
Preserve binding and duplicate checks implemented The original Core observation and binding recheck remain in the read path. Existing identity, duplicate and Core tests pass.

Validation

Check Result Evidence
Baseline and fixed HTTP passed The lexical order fails the new test on main. UTC ordering fixes the same response.
Targeted bound HTTP and scope 9 passed Covers the new regression, existing identity checks and scoped readback routes.
Full Chat conversation binding suite 118 passed PYTHONPATH="$PWD" python3 -m pytest -q tests/test_chat_conversation_bindings.py
Existing duplicate-discovery regression passed The steward discovery test retains its duplicate rejection and read-only checks.
Core conversation binding tests 70 passed tests/control_plane_ts/conversation_binding.test.ts.
Shared chronology tests 6 passed tests/test_history_chronology.py.
Lean 4.22.0 passed lean -DwarningAsError=true regression/BoundChatSessionOrder.lean. Dropping rows with unreadable timestamps makes the membership proof fail.
Local premerge 8 checks passed python3 -m loopx.entrypoint canary premerge --from-git-diff --git-diff-base origin/main --tier quick.
Ruff passed Both changed Python files.

The Lean model begins with Core's accepted result. It proves that display ordering retains the exact approved rows and that rejection still produces no list. The real HTTP tests exercise parsing and the binding path separately. All tests use disposable local synthetic records.

Scope And Continuation

The read-only list changes order after authority validation. The underlying Session records, candidate discovery, provider routing and resume decisions retain their existing contracts.

Frontend / Visual Evidence

This change affects the returned history order. The real API response shows the latest Session first under the existing list shape. Browser rendering was outside this validation run.

Type Of Change

  • Bug fix
  • Test update

LoopX Area

  • Capability or extension

Shared-authority RFC fixture impact

N/A.

Boundary Checklist

  • Diff and evidence use public-safe synthetic data.
  • The change is scoped to the reproduced bound-history order.
  • No paired RFC changed.
  • The commit includes a DCO Signed-off-by trailer.

Signed-off-by: aihop <4408344+hhyykk@users.noreply.github.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T17:52:52.741661Z f9ba36a PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

通过会话绑定查询历史的调用方需要先看到最近更新的可用会话。 旧接口把持久化时间当作字符串比较,微秒或带偏移的更新可能排在较旧会话之后。 经过 Core 验证的同一批会话按 UTC 微秒排序,同一时刻保留既有文本次序,可读时间排在旧无效值之前,原更新时间字串原样返回。 本次范围为已存在的绑定历史 API 和返回顺序。

改动思路 / Approach

沿原绑定验收和去重取得批准的 ID,再用既有 chronology_key 排序。查看列表仍通过绑定二次核对与原公开会话投影。 本次范围为已存在的绑定历史 API 和返回顺序。 显示顺序改变,候选授予、原绑定响应和既有恢复选择仍由各自所有者处理。

具体改动 / Changes

审查精确提交 f9ba36a8da228e172bbc44ea091d08f5efdc9a51,当前比较基线 509360fb0d3e9e6e578ddf5c12db587886016b23。三个文件增加 128 行、删除 1 行,覆盖现有快照的排序、真实 HTTP 回归与 Lean 模型。 verified-bound-session-inventory 已验证只返回原绑定授权的现有会话及匹配绑定,不创建或恢复会话。reject-mixed-selector 已验证混合或重复选择条件必须拒绝,保留原只读绑定检查。 既有会话绑定读取约定

关键代码讲解

  • ChatConversationBindings.local_session_snapshot。按现有共享 UTC 解析给已验证成员排序,继续核对原绑定。 源码
  • observe_local_sessions_flow。候选的发现、重复拒绝和 Core 授权沿原路径,排序接收原返回集合。 源码
  • ChatRequestHandler._list_sessions。读取与回显唯一绑定,错误沿原拒绝路径。 源码

对主干的风险 / Risks

相同入口在精确头把新的分数秒与跨本地日期记录排首,等时刻和两条旧文本保留原相对次序。实际返回匹配绑定和原时间,读取前后的会话内容与合成宿主调用记录一致。 基线的原作者案例与新增跨日案例均失败。现头混合选择参数仍返回 400 且无列表。原绑定变化与重复行拒绝继续由已有 Core 与 HTTP 测试覆盖。 125 项 Python 回归、70 项 TypeScript 绑定所有者测试、Ruff 和 Git diff 检查通过。Lean 4.22.0 验证拒绝保持与成员保留,刻意丢弃旧文本行的负对照无法通过。 验证覆盖本地 Chat HTTP 与合成会话,浏览器、现有消费者按 last_activity_at 作的默认选择,以及外部 Lark 和远端 CI 均未实测。

我的整体评价 / Verdict

APPROVE。 经过 Core 验证的同一批会话按 UTC 微秒排序,同一时刻保留既有文本次序,可读时间排在旧无效值之前,原更新时间字串原样返回。 原始 GET 的成功、拒绝和只读证据均已复验。验证覆盖本地 Chat HTTP 与合成会话,浏览器、现有消费者按 last_activity_at 作的默认选择,以及外部 Lark 和远端 CI 均未实测。

English verdict: APPROVE at f9ba36a. The bound-history endpoint now orders the same Core-approved Session rows by UTC while retaining timestamp text, deterministic ties, legacy rows, and rejection of mixed selectors.

This branch has not been deployed

No deployments
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.

2 participants