Skip to content

feat(managed): Add live message paging to WebShell - #15865

Merged
doudouOUC merged 2 commits into
mainfrom
feat/managed-live-message-pages
Oct 29, 2026
Merged

doudouOUC merged 2 commits into
mainfrom
feat/managed-live-message-pages

Conversation

@doudouOUC

@doudouOUC doudouOUC commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does

Managed WebShell reads the latest 100 materialized Items directly from SQL, including conversations without a published snapshot and messages newer than the last snapshot. Scrolling upward requests an older page; live messages continue through the existing event stream. Export reads these live pages with a finite membership range and allows bodies/statuses to change between pages.

The new behavior is explicitly selected by the Java Provider. Existing clients that omit the selection retain the snapshot/event defaults. The Provider rejects invalid projection coverage as a read failure rather than substituting the event head or spinning on an undefined resume position. The API contract advances from 1.96.0 to 1.97.0 and the WebShell types are regenerated. No new routes or database migrations are introduced.

Why it's needed

The bounded query API merged in #15839 reads published snapshots. Selecting the newest snapshot does not include later messages or support a Session that has never published one, and the existing Java WebShell bootstrap can still read a full snapshot. Direct message queries let the screen load a bounded recent page without reconstructing or retaining the complete conversation.

Reviewer Test Plan

How to verify

Use matching Server and WebShell builds in Managed mode with local H2 and Hosted MySQL. Check a Session without any published snapshot and one whose published snapshot is behind its message projection. Initial loading should return at most 100 Items, older pages should contain no repeated or skipped identities even when sequence numbers tie, and scrolling should preserve the visible anchor.

Continue a Turn while loading an older page in both event-arrival orders. Complete Item text and already-covered delayed stream fragments should appear once; later fragments and unrelated Items must remain visible. A stream-gap resync should reset the Item window and older cursor together. Test a projection behind the event head: the stream must resume from the projection's included sequence, preserving the unprojected tail. A projection below the retained event floor must return retryable 503 rather than skip events.

Export while the conversation continues. The operation should finish within its original membership range, may observe newer bodies/statuses for those Items, and should label the output as a live export. An initially lagging projection must return retryable 503. Verify cursor scope/direction/generation errors, actor/tenant isolation, private-CSI refusal, resource integrity, oversized-page admission, and unchanged omitted-selection snapshot behavior.

Evidence (Before & After)

Independent report: test-engineer evidence. Parent cf7a0ed SDK Java CI was requested once. Its completed MySQL job explicitly checked out that parent: H2 paging11, real-MySQL paging11, API contract23 and surface4 pass; totals5978 unit/H2 with19 skipped,1245 real-profile with0 skipped and packaging3, all zero failures/errors. The1379 Java/SDK/POM/workflow/lock/manifest inputs are unchanged by R1 at ca8970b; only these slices carry forward, not actual new-head execution or whole-workflow qualification. The parent Hosted-fault gate is still running; new-head smoke CI remains pending.

Before: two actual source-Provider HTTP-transport assertions failed on main because transcript/export requests did not select direct messages. Both pass after the change; six additional handoff checks pass, including a projection at sequence 40 with an event head of 400. These are injected transport probes, not server HTTP execution.

Independent review reproduced four real frontend failures: three tied-identity ordering variants and a delayed-SSE duplicate. After correction, the two affected files pass 204/204. At the initial cf7a checkpoint, the five-file inventory had335 distinct cases with passing evidence across incremental runs, plus five separate scroll/anchor DOM cases. Original failures and fixture corrections remain in the independent report. This is not a fresh 340-case full-suite run. The DOM tests use mocked rows and inspected parent/hook wiring; no connected real-browser/database acceptance or screenshots are claimed.

An isolated full TypeScript build passed before the review fixes. After the fixes, the affected WebShell/template builds, WebShell typecheck, four integration-workspace typechecks, integration-test typecheck and final bundle passed. The initial full typecheck failed because the isolated copy omitted four integration-local dependency directories and resolved Node 20 types instead of the original Node 22 types; after restoring the matching links, the affected checks passed. Scoped formatting/lint and API generation consistency pass. Root and independent reviews each reached two clean incremental passes.

R1 independently reproduced one Managed smoke failure plus both stale selector failures and four malformed-coverage Provider failures. The fix passes all10 Managed progress scenarios plus the two exact upstream-selector targets (12PASS,0retry/targetskip), the complete changed Provider100PASS and six actual Java-provider hook targets. The other119 hook tests were filtered as unaffected. Existing335-case/frontend and five DOM evidence above remains historical and source-scoped, not a newly repeated whole suite. The original CI smoke12FAIL/3flaky/396PASS is retained. Incremental build36.698s/template1.175s/typecheck14.637s and bundle2.947s pass; the first bundle attempt failed because the private copy omitted an unchanged generated-ui output, then passed after copying that unchanged prerequisite. No product source, timeout or assertion was changed to mask that failure. Scoped lint/format/diff checks and two root/two independent incremental audits pass. The old visuals job had0steps and an explicit cancellation by @yiliang114; it was not rerun.

Tested on

OS Status
🍏 macOS ✅ TypeScript build/typecheck/bundle, focused frontend, DOM and Chromium smoke with mocked daemon/Java
🪟 Windows ⚠️ Not tested locally
🐧 Linux ✅ Parent cf7a CI unit/H2, real-MySQL and API slices only; not connected-browser acceptance

Environment (optional)

macOS, Node26.12.1, Vitest3.2.7 and the pinned Playwright Chromium runtime. Application builds and smoke ran in a fresh private copy; both user previews5196/5197, their JARs, served assets and H2 data remained untouched. Frontend smoke uses a real browser with mocked daemon/Java HTTP, while the SQL evidence comes separately from CI.

Risk & Scope

  • Main risk or tradeoff: mutable Item pages and event streaming must meet at the included projection sequence. Full-tuple keysets, projection-generation rejection, per-Item stream coverage, selected-body byte admission and existing resource checks protect that boundary. Live export fixes membership, not historical body contents; selected-turn control queries bound returned bodies without claiming a constant total database scan cost.
  • Not validated / out of scope: new-head smoke CI, completion of the parent Hosted-fault workflow, connected real-SQL browser/live-export/model acceptance and MySQL Unicode/case tie execution remain unqualified. SQL identity columns use VARBINARY UTF-8 byte ordering; real-MySQL ASCII ties and frontend Unicode/case tests are distinct evidence. All three local Java allowances are CLOSED: original verification564.787/600, earlier preview315.129/600 and current preview348.204/600; remainders are forbidden, both preview allowances authorize0tests. No new local Java validation ran. No Legacy daemon, Core/CLI, recovery/CSI, schema, workflow, dependency, authority/cache-window or derived-index changes are included. Snapshot retirement refactor(managed): Remove persisted public message snapshots #15870 and module split refactor(managed-agent): Split server into Maven modules #15871 remain separate; conditional request-schema/annotation nits are deferred without weakening the existing guard.
  • Breaking changes / migration notes: existing API defaults are preserved and no migration is required. The Java Provider selects the new contract and requires the matching Server build. Preview5197 remains the cf7a compile/start artifact and does not establish the R1 head or query/model qualification; preview5196 remains its older ce2 build.

Design: English · 简体中文. Both versions include the same decisions, limits, acceptance criteria and deferred work.

Linked Issues

Follow-up to #15839. Related context: #13184; this PR does not close it.

中文说明

What this PR does

Managed WebShell直接从SQL读取最近100个已投影Item,覆盖尚未发布快照的会话和最后快照之后的新消息。向上滚动请求更早的一页,实时消息继续通过既有事件流接收。导出读取这些实时页面,固定有限成员范围,允许页间正文和状态更新。

Java Provider显式选择新行为;省略该选择的既有客户端保留快照/事件默认语义。Provider把非法投影覆盖视为读取失败,不以事件head兜底,也不在undefined续传位置上空转。API契约从1.96.0升至1.97.0,并重新生成WebShell类型。不新增路由或数据库迁移。

Why it's needed

#15839合入的有界查询API读取已发布快照。选择最新快照既不包含其后的消息,也不能覆盖从未发布快照的Session,而原Java WebShell首屏仍可能读取完整快照。直接查询消息可以有界加载最近一页,避免重建或常驻完整会话。

Reviewer Test Plan

How to verify

使用匹配的Server与WebShell构建,在本地H2和Hosted MySQL的Managed模式验证。检查完全没有已发布快照的Session,以及已发布快照落后于消息投影的Session。首屏应最多返回100个Item;即使序号相同,历史翻页也不能重复或遗漏身份;滚动加载应保持可见锚点。

在加载更早页面时继续执行Turn,并覆盖事件先到和页面先到两种顺序。完整Item文本及已被页面包含的延迟流帧只出现一次,更晚的流帧和无关Item仍须显示。事件流gap重同步应同时重置Item窗口和历史游标。验证投影落后于事件head时,事件流从页面实际包含的投影序号继续,保留未投影尾部;投影低于保留事件floor时,应明确返回可重试503,不能跳过事件。

持续对话时执行导出。导出应在原成员范围内结束,可以读取该范围Item更新后的正文/状态,并标注实时导出。首个请求若投影滞后,应返回可重试503。验证游标scope/方向/代次错误、actor/租户隔离、私有CSI拒绝、资源完整性、页面字节准入,以及省略选择时保持原快照行为。

Evidence (Before & After)

独立报告:test-engineer验证证据。父提交cf7a0edf37d390a58db00901a397286023ce62f5的SDK Java CI仅派发一次。其已完成MySQL job明确核实实际checkout为该父提交:H2分页11、真实MySQL分页11、API契约23及surface4通过;总unit/H2为5978项/19跳过,真实profile1245项/0跳过,packaging3项,均零failure/error。R1提交ca8970b84b96c6d3cc5f77fc43b577150a0944c8未改变1379项Java/SDK/POM/workflow/lock/manifest输入,只复用这些切片,不冒充新head执行或完整workflow资格。父提交Hosted故障门禁仍在运行,新head Smoke CI待验。

修前:在main上,通过实际源码Provider执行的两个HTTP传输注入断言失败,因为transcript/导出请求未选择直接消息读取。修后相同两项通过,另外六项交接检查通过,包括投影序号40而事件head为400的情况。这些是传输注入探针,不是服务端HTTP执行。

独立审阅复现四个真实前端失败:三个同序号身份排序变体和一个延迟SSE重复。修后完整两文件204/204通过。初始cf7a检查点的五文件335个不同用例通过增量执行及适用证据复用均有通过证据,另有五项滚动/锚点DOM测试通过。独立报告保留原失败和夹具修正;这不是重新全跑340项。DOM测试使用模拟行并另行审阅父页面/hook接线,不宣称已完成真实浏览器与数据库端到端验收,也不提供未经验证的截图。

独立目录中的完整TypeScript构建在审阅修复前通过。修复后,受影响WebShell/模板构建、WebShell类型检查、四个integration workspace类型检查、integration-tests类型检查及最终bundle通过。第一次完整类型检查失败,是因为隔离副本遗漏四处integration局部依赖目录,错误解析到Node 20类型而非原Node 22类型;恢复匹配链接后,受影响检查通过。增量格式/lint及API生成一致性检查通过。根代理和独立审阅均达到两轮增量clean。

R1独立复现一项Managed Smoke失败、两项旧选择器失败及四项非法覆盖Provider失败。修后全部10项Managed progress和两项上游选择器目标通过(12PASS、0重试/目标跳过),完整受改Provider100PASS,六项实际Java-provider hook目标通过;其余119个hook用例作为未受影响目标过滤。上述既有335前端及五项DOM证据保持原历史来源,不是本轮重复全跑。原CI Smoke的12FAIL/3flaky/396PASS保留。增量构建36.698秒/模板1.175秒/类型检查14.637秒和bundle2.947秒通过;首轮bundle因独立副本遗漏未变generated-ui产物失败,补拷该未变输入后通过,未改产品源码/超时/断言掩盖失败。增量lint/format/diff检查及根/独立各两轮增量审阅通过。旧visuals job为0steps且annotation明确@yiliang114取消,未重跑。

Tested on

OS Status
🍏 macOS ✅ TypeScript构建/类型检查/bundle、针对性前端/DOM及模拟daemon/Java的Chromium Smoke
🪟 Windows ⚠️ 未在本地测试
🐧 Linux ✅ 仅父提交cf7a CI的unit/H2、真实MySQL与API切片,不是连通浏览器验收

Environment (optional)

macOS、Node26.12.1、Vitest3.2.7及固定的Playwright Chromium运行时。应用构建和Smoke在新的独立副本中执行,用户5196/5197两个预览、JAR、运行资产及H2数据均保持不变。前端Smoke使用真实浏览器与模拟daemon/Java HTTP,SQL证据另来自CI。

Risk & Scope

  • 主要风险或取舍:可变Item页面与事件流必须在页面实际包含的投影序号交接。完整排序键游标、投影代次拒绝、逐Item流覆盖、选中正文的字节准入及既有资源检查共同保护该边界。实时导出只固定成员范围,不冻结历史正文;选中Turn的控制查询限制返回正文,不声称数据库扫描总成本恒定。
  • 未验证/范围外:新head Smoke CI、父提交Hosted故障workflow完成、真实SQL浏览器/实时导出/模型连通验收以及MySQL Unicode/大小写并列执行仍未验收。SQL身份列采用UTF-8 VARBINARY字节顺序,真实MySQL ASCII并列与前端Unicode/大小写测试是不同证据。三个本地Java额度均CLOSED:原验证564.787/600、旧预览315.129/600、本次预览348.204/600,余量禁用,两次预览授权测试均为0,未新增本地Java验证。本次不改Legacy daemon、Core/CLI、恢复/CSI、schema、workflow、依赖、authority/缓存窗口或派生索引。快照下线#15870及模块拆分#15871独立处理;请求条件schema/注解细化后置,既有守卫不弱化。
  • 破坏性变更/迁移说明:保留既有API默认行为,不需要迁移。Java Provider选择新契约,需要匹配的Server构建。5197预览保持cf7a编译启动产物,不证明R1新head或查询/模型验收;5196保持原ce2构建。

设计:English · 简体中文。两份设计均包含相同的决策、限制、验收标准和后置事项。

Linked Issues

#15839的后续工作。相关背景:#13184;本PR不关闭该issue。

Read bounded current SQL messages for initial and older Managed pages,
resume SSE from projection coverage, and export live bodies.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@doudouOUC

doudouOUC commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Current status: see the bilingual R1 addendum below for the pushed fix, independent incremental verification and source-labelled CI results. The original cf7a checkpoint is retained verbatim, including its then-pending gates.

当前状态请见文末R1双语补充:包含已推送修复、独立增量验证及准确来源CI结果。原cf7a检查点(含当时待验门禁)逐字保留。

Independent test-engineer report for cf7a0edf37d390a58db00901a397286023ce62f5 (tree a22ff7f03078ab046034538903b7f440b24439bd). Acceptance is partial: frontend behavior and isolated TypeScript checks have evidence; new Java/database/server HTTP acceptance is pending CI.

Evidence Outcome and boundary
Source Provider with injected HTTP transport on base fa7421bdc19557a11596d8c39da6ba4c2ddf74e8 Two expected RED assertions: transcript/export omitted the new direct-message selection. The same two pass after implementation. Six additional postfix checks include projection40/head400 → stream handoff40, Item-page mode, older cursor and one request per operation. These are transport injections, not server execution.
First five-file frontend run 331 collected,327PASS/4FAIL/0skip. Three old coverage fixtures and one new bubble-count assumption were corrected without changing timeouts or safety assertions. Six exact changed-fixture targets pass; original failures are retained.
Independent-review regression reproduction Five selected instances on preserved pre-fix source: one control PASS/four actual FAIL. Three SQL identity tie-order permutations and a delayed-SSE duplicate become GREEN after the fixes.
Complete affected-file verification Messages79 + hook125 =204PASS/0FAIL/0skip/0missing/extra. Current five-file inventory335 has passing evidence from this run plus unaffected Provider96/export18/projector17. This is an incremental evidence union, not a full335-case rerun.
Scroll/anchor component DOM Five exact cases PASS,0targetskip/missing/extra;185 non-target cases filtered. Covers top-scroll, fast wheel, prepend anchor, underfill and no repeated empty-page load. Row rendering/callbacks are mocked and actual Managed parent/child props wiring was inspected; this is not connected browser-to-database E2E.
Isolated build/type checks Initial full TypeScript build PASS148.616s. After review fixes: WebShell build38.121s/template build1.036s/typecheck15.199s, four affected integration typechecks5.560s, integration-tests typecheck17.430s and bundle2.691s all PASS. Initial full typecheck failure is retained: the isolated copy omitted integration-local dependency links and resolved Node20 types; restoring the original Node22 links corrected the affected environment.
Static checks Scoped formatting/lint, generated API consistency and diff checks PASS. Two clean root and two clean independent incremental source-review passes; these are not full-PR approval. Hook preserved the exact staged tree.

The test engineer imported actual source and edited no product code. Captured source inputs stayed stable during execution and all1153 protected preview compiled assets stayed byte-identical. Builds ran in a separate copy, not the user's5196 preview directory. The last test-only formatting correction has identical non-whitespace TypeScript tokens. API formatting corrections preserve parsed JSON and the generated types exactly.

No local Java preparation/version/compilation/Maven/javac/Checkstyle/SpotBugs or Java test ran. The original shared budget remains CLOSED564.787/600 with35.213 forbidden; the separate preview compile/start budget remains CLOSED315.129/600 and authorized0tests. Neither was reused or reset. Eleven source regression cases are shared by H2 and the new real-MySQL test class, with an additional HTTP/API contract extension. Their compilation and runtime result are NOT_RUN locally / PENDING final-head CI. A prior JAR, old-head test or successful TypeScript check does not establish them.

Real connected browser/model testing and Windows/Linux local acceptance were NOT_RUN. The oldce2 preview/JAR/H2 database remained untouched and does not demonstrate this feature. New SQL checks must validate actual checkout/tree, read-only MySQL transactions, scope/generation and byte/resource guards before acceptance.

中文说明

独立test-engineer报告对应cf7a0edf37d390a58db00901a397286023ce62f5,tree为a22ff7f03078ab046034538903b7f440b24439bd。目前仅有前端行为及隔离TypeScript检查证据;新增Java、数据库和服务端HTTP验收仍待CI。

证据 结果与边界
基线fa7421bdc19557a11596d8c39da6ba4c2ddf74e8实际Provider+HTTP传输注入 两项预期RED:transcript和导出未选择直接消息读取。修后同两项通过。另六项仅修后验证,覆盖projection40/head400时流交接40、Item分页标记、历史游标及每项操作只发一个请求。不是服务端执行。
首次五文件前端运行 收集331项,327PASS/4FAIL/0skip。修正三处旧覆盖夹具和一处新气泡数量假设,未改变超时或安全断言。六个精确受影响目标通过,原失败保留。
独立审阅回归复现 保留的真实修前源码上,五个目标为一项对照PASS、四项真实FAIL。三个SQL身份并列排序变体及一个延迟SSE重复,在修复后转为GREEN。
完整受影响文件验证 messages79+hook125=204PASS/0FAIL/0skip/0缺失或额外。当前五文件335项的通过证据来自本次204及未受影响Provider96/export18/projector17,是增量证据并集,不是重新全跑335项。
滚动/锚点组件DOM 五个精确目标PASS,0目标跳过/缺失/额外,185非目标过滤。覆盖顶部、快速滚轮、前插锚点、未填满视口及空页不重复加载。行与回调使用模拟夹具,并审阅实际Managed父/子页面接线;不等于浏览器到数据库的完整E2E。
隔离构建与类型检查 首次完整TypeScript构建148.616秒通过。审阅修复后WebShell构建38.121秒、模板构建1.036秒、类型检查15.199秒,四个受影响integration检查5.560秒、integration-tests检查17.430秒、bundle2.691秒均通过。保留最初完整类型检查失败:隔离副本遗漏integration局部依赖链接,错误使用Node20类型;恢复原Node22链接后受影响环境检查通过。
静态检查 增量格式/lint、API生成一致性及diff检查通过。根代理和独立审阅分别两轮增量clean,不是全PR批准。hook保留精确已暂存tree。

test-engineer导入实际源码,未编辑产品代码。执行期间捕获的源码输入稳定,1153项受保护预览编译资产逐字未变。构建在独立副本执行,不在用户5196预览目录。最后仅测试排版的改动具有完全相同的非空白TypeScript词法token;API排版修正保留相同解析JSON及生成类型。

本地没有执行任何Java准备/版本检查/编译/Maven/javac/Checkstyle/SpotBugs或Java测试。原共享预算仍为CLOSED564.787/600、35.213禁用;独立预览编译启动预算仍为CLOSED315.129/600,授权测试为0。两项均未复用或重置。11项源码回归由H2与新增真实MySQL测试类共享,另扩展HTTP/API契约测试。编译和运行结果均为本地NOT_RUN/待最终head CI,旧JAR、旧head测试或TypeScript通过不能替代。

未执行真实浏览器/模型连接测试及Windows/Linux本地验收。原ce2预览、JAR和H2数据库保持不变,不展示本功能。新增SQL必须核实实际checkout/tree、MySQL只读事务、scope/代次和字节/资源守卫的有效CI结果,才能完成验收。


R1 addendum: ca8970b

The original cf7a report above is retained verbatim as its initial checkpoint. This addendum supersedes its pending-CI and two-budget statements only with the following source-labelled facts.

R1 independently reproduced one Managed smoke failure plus both stale selector failures and four malformed-coverage Provider failures. The fix passes all10 Managed progress scenarios plus the two exact upstream-selector targets (12PASS,0retry/targetskip), the complete changed Provider100PASS and six actual Java-provider hook targets. The other119 hook tests were filtered as unaffected. Existing335-case/frontend and five DOM evidence above remains historical and source-scoped, not a newly repeated whole suite. The original CI smoke12FAIL/3flaky/396PASS is retained. Incremental build36.698s/template1.175s/typecheck14.637s and bundle2.947s pass; the first bundle attempt failed because the private copy omitted an unchanged generated-ui output, then passed after copying that unchanged prerequisite. No product source, timeout or assertion was changed to mask that failure. Scoped lint/format/diff checks and two root/two independent incremental audits pass. The old visuals job had0steps and an explicit cancellation by @yiliang114; it was not rerun.

The independent reproduction/verification recorded3 original E2E RED targets (one Managed scenario and two selector cases), plus4 new malformed-coverage unit RED cases; only those were observed before the fix, not all10 Managed scenarios. The after run executes all12 intended E2E targets once. The malformed coverage tests also require exactly one HTTP fetch and preserve the existing positive zero/partial coverage cases.

Completed cf7a MySQL job123467700015: actual full checkout cf7a0ed; H2 paging11, real-MySQL paging11, API contract23 and surface4 all zero failures/errors/skips. Unit/H2 totals5978/0failure/0error/19skip; real profile1245/0/0/0; packaging3/0/0/0. Complete log14794890bytes/SHA2565bf9a8e3fd943b5c41964874d7d77cfca42848225fc98e420af6614ee0eb87da. The1379 Java/SDK/POM/workflow/lock/manifest inputs match the new R1 head; these Java slices carry only by unchanged inputs, not as actual new-head execution or whole-workflow acceptance. The parent full run remains11success/1Hostedfault running. SQL IDs are VARBINARY(512) encoded as UTF-8, so their order is raw bytes, not text collation; MySQL ASCII ties and frontend Unicode/case evidence are separate.

No original failed result is erased, and no old mixed-code smoke or maintainer-canceled visuals job was rerun. New-head smoke CI and connected real-SQL browser/live-export/model acceptance remain pending/NOT_RUN. Static clean is not whole-PR approval. All three Java budgets remain CLOSED564.787/600,315.129/600,348.204/600; both preview compile/start allowances authorized0tests and no remainder is reused. Preview5197 is still the cf7a394-source compiled JAR (SHA2568ec2f5267520f452bc7c0b5bde912472570f6af773b4e5f773932d4ba6913753), readinessUP/front200 only; it is not new-head or query/model acceptance. Preview5196 and both data directories are unchanged.

R1中文说明

上方原cf7a报告逐字保留,代表初始检查点;本段仅以下述准确来源事实替代其待CI及两项预算的旧状态。

R1独立复现一项Managed Smoke失败、两项旧选择器失败及四项非法覆盖Provider失败。修后全部10项Managed progress和两项上游选择器目标通过(12PASS、0重试/目标跳过),完整受改Provider100PASS,六项实际Java-provider hook目标通过;其余119个hook用例作为未受影响目标过滤。上述既有335前端及五项DOM证据保持原历史来源,不是本轮重复全跑。原CI Smoke的12FAIL/3flaky/396PASS保留。增量构建36.698秒/模板1.175秒/类型检查14.637秒和bundle2.947秒通过;首轮bundle因独立副本遗漏未变generated-ui产物失败,补拷该未变输入后通过,未改产品源码/超时/断言掩盖失败。增量lint/format/diff检查及根/独立各两轮增量审阅通过。旧visuals job为0steps且annotation明确@yiliang114取消,未重跑。

独立修前真实观察为3项原E2E RED(1项Managed及2项选择器)与4项新增非法覆盖单元RED,未把全部10项Managed说成修前均复跑。修后精确执行12项E2E一次;非法覆盖同时断言仅一次HTTP读取,合法零/部分覆盖的既有正例保持。

完整cf7a MySQL job123467700015的实际checkout为cf7a0edf37d390a58db00901a397286023ce62f5:H2分页11、真实MySQL分页11、API契约23、surface4均零failure/error/skip。总unit/H2为5978/0failure/0error/19skip,真实profile1245/0/0/0,packaging3/0/0/0。完整日志14794890字节,SHA256为5bf9a8e3fd943b5c41964874d7d77cfca42848225fc98e420af6614ee0eb87da。1379项Java/SDK/POM/workflow/lock/manifest输入与R1新head一致,只按未变输入复用这些切片,不冒充新head实际执行或完整workflow通过;父run仍11success/1Hostedfault运行中。SQL身份是UTF-8编码的VARBINARY(512),按原始字节而非文本collation排序;真实MySQL ASCII并列与前端Unicode/大小写验证分别留档。

原失败不删除,旧混合代码失败Smoke和维护者取消visuals未重跑。新head Smoke CI待验,真实SQL浏览器/实时导出/模型连通验收NOT_RUN;静态clean不等于全PR批准。三个Java额度保持CLOSED564.787/600、315.129/600、348.204/600,两次预览编译启动授权测试为0,余量不复用。5197仍运行cf7a的394源码编译JAR,SHA256为8ec2f5267520f452bc7c0b5bde912472570f6af773b4e5f773932d4ba6913753,仅证明readinessUP/前门200,不是新head或查询/模型验收。5196与两个数据目录保持不变。

@doudouOUC doudouOUC self-assigned this Oct 29, 2026
@doudouOUC
doudouOUC marked this pull request as ready for review October 29, 2026 13:58
@doudouOUC
doudouOUC enabled auto-merge (squash) October 29, 2026 13:58
@qwen-code-review-bot

qwen-code-review-bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Qwen Triage finished — view run. See the stage comments in this thread for the result.

✅ Qwen Triage 已完成 —— 查看运行。结果见本线程中的各阶段评论。

@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Thanks for the PR — this reads as the natural completion of the bounded-read work that landed in #15839 a few hours ago.

Template ✓ — every required heading is present, and the design doc is linked in both languages with matching decisions and acceptance criteria.

Problem. Real, not theoretical. The snapshot-backed bounded read from #15839 cannot serve a Session that has never published a snapshot, and selecting the newest snapshot still misses everything committed after it. That is a concrete gap in a feature that merged today, not a hypothetical. There is no user-facing reproduction, which is the right shape for a feat follow-up — the design doc carries the acceptance criteria instead.

Direction. Aligned. Managed WebShell is in-repo surface, and this lifts the "reconstruct and retain the whole conversation" requirement off the initial load. Upstream's CHANGELOG has no direct analogue (this is server-side infrastructure rather than a CLI feature), but its adjacent entries about bounding transcript reads for very large sessions point the same way.

Size. Cross-package (managed-agent-server + web-shell), so it counts as core under the two-tier rule. Of the 1110 changed lines: 421 production / 572 test / 51 generated / 66 docs. That is under the 500-line escalation threshold and under the 1000-line large-PR advisory, and you hold admin on this repo, so the gate is exempt regardless — numbers recorded for the thread.

Approach. One question worth answering before the code review. This leaves two parallel history read paths in the tree — the published-snapshot view and the new live-messages view — with snapshot removal explicitly deferred. The frontend consequently carries three separate mechanisms to stop them double-rendering (the per-Item coverage map, withoutReplacedItemEvents, and the projectedThrough stream gate), plus an itemPages flag that changes both the dedup key and the sort order inside mergeManagedEvents. None of that is wrong, but it is the price of the interim state. Is there a tracked follow-up for retiring the snapshot path so this does not become permanent?

Related, and it turns out to matter: lastEventId now comes from coveredSequence with no fallback. In messages view the server sets coveredSequence and lastSequence to the same value, so transcript.coveredSequence ?? transcript.lastSequence would be exactly equivalent while keeping the client working against a response that omits the field. See the code review for why I am raising it here.

Risk. No elevated signals — none of the changed files match the revert-correlated high-risk paths.

Moving on to code review. 🔍

中文说明

感谢贡献!这个 PR 看起来是几小时前 #15839 合入的有界读取工作的自然收尾。

模板 ✓ —— 所有必需标题齐全,设计文档中英文双语链接完整,决策与验收标准一致。

问题。 真实存在,不是理论性的。#15839 基于快照的有界读取无法服务从未发布快照的 Session,而选择最新快照仍然会遗漏其后提交的所有消息。这是今天刚合入功能的具体缺口,不是假设。没有面向用户的复现,这对 feat 类后续工作是合适的形态 —— 改由设计文档承载验收标准。

方向。 对齐。Managed WebShell 是仓库内的产品面,这次改动把「重建并常驻完整会话」的要求从首屏加载中移除。上游 CHANGELOG 没有直接对应项(这是服务端基础设施,不是 CLI 功能),但其中关于超大会话限制 transcript 读取的相邻条目指向同一方向。

规模。 跨包改动(managed-agent-server + web-shell),按两级规则计入核心。1110 行改动中:生产代码 421 行 / 测试 572 行 / 生成代码 51 行 / 文档 66 行。低于 500 行升级阈值,也低于 1000 行大 PR 提示线;且你在本仓库持有 admin 权限,该门禁本就豁免 —— 数据仅为留档。

方案。 有一个问题值得在进入代码审查前先回答。这次改动让仓库里同时存在两条平行的历史读取路径 —— 已发布快照视图和新的实时消息视图 —— 且快照子系统的移除被明确推迟。因此前端需要三套独立机制来防止重复渲染(逐 Item 覆盖表、withoutReplacedItemEvents、以及 projectedThrough 流门控),外加一个 itemPages 标志,它会同时改变 mergeManagedEvents 内部的去重键和排序规则。这些都没有错,但确实是过渡状态的代价。是否有已登记的后续工作来下线快照路径,避免它变成永久状态?

相关的一点,而且事后证明确实要紧:lastEventId 现在取自 coveredSequence,没有兜底。在 messages 视图下服务端会把 coveredSequence 和 lastSequence 设为同一个值,所以 transcript.coveredSequence ?? transcript.lastSequence 在语义上完全等价,同时能让客户端在响应缺少该字段时仍然正常工作。为什么在这里提出,请看代码审查部分。

风险。 无升级风险信号 —— 改动文件均未命中与回滚相关的高风险路径。

进入代码审查 🔍

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at cf7a0edf37d390a58db00901a397286023ce62f5 · re-run with @qwen-code /triage

@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Code review

Blocking: web-shell E2E Smoke is red, and this PR caused it.

10 of the 12 hard failures are in web-shell.managed-progress.spec.ts, and all 10 die in the same place — installManagedScenario → waitForCurrentStream at spec line 195, polling streamCursors.includes(summary.lastSequence) until the 20s timeout. The chain:

  • The provider now derives the stream resume point from a different field: lastEventId: transcript.coveredSequence, where it used to read transcript.lastSequence.
  • useManagedSession feeds that straight into the SSE request — snapshot() returns transcript.lastEventId, and the provider posts { sessionId, afterSequence: request.lastEventId }.
  • The E2E mock daemon's /transcript/query handler replies with { items: [], events, lastSequence, hasMore: false }. It has never sent coveredSequence, even though the contract has listed that field as required since before this PR.
  • So lastEventId arrives undefined. The load loop is while (!aborted && lastEventId === undefined) lastEventId = await snapshot(false), so the page re-requests the transcript instead of proceeding, and the stream opens at afterSequence: undefined — which the mock records as 0. [0].includes(3) never becomes true.

Nothing in this PR touches client/e2e/, so the fixture simply was not updated — unlike the two unit-test mocks in java-managed-agent-provider.test.ts and use-managed-session.test.tsx, which both had coveredSequence added in this same diff. TypeScript cannot catch it: the generated type declares coveredSequence: number as required, and route.fulfill({ json }) is untyped, so the omission is invisible until runtime.

Two ways to fix, and I would take the second:

  1. Add coveredSequence: summary.lastSequence to the mock's transcript reply.
  2. Fall back in the provider — transcript.coveredSequence ?? transcript.lastSequence. In messages view messageTranscript sets both from page.coveredSequence(), so they are equal and the fallback is exactly equivalent. It also removes a failure mode where a non-conforming response makes the client retry forever instead of surfacing anything. Given the PR body itself states the provider "requires the matching Server build", a client that degrades rather than spins seems worth the few characters.

Non-blocking.

  • The other two hard failures — web-shell.host-directory-picker.spec.ts:90 and web-shell.standalone.spec.ts:197 — are not attributable to this diff. Neither spec references the managed provider or installManagedScenario, and both fail on plain UI waits (an "Add Workspace" dialog, a "Project" disclosure button). Three further tests were marked flaky in the same 36.2-minute run, which is full of ECONNREFUSED 127.0.0.1:4170 vite proxy noise. I cannot prove these pre-existing, because this check is skipped on main and there is no baseline to compare against. One hypothesis I will not assert as fact: the spinning retry loop above hammers the mock daemon from a parallel worker, and the runner was clearly saturated. Re-run after the fixture fix and see what remains.
  • The Java side held up on everything I checked. Every query is scoped by tenant_id and session_id; requireSession, ManagedLegacySessionGuard.requireLegacyMutation and requireReadableSession are all preserved on the new path. All values are bound parameters — the only string-concatenated SQL fragments are the comparison operator and sort direction, both derived from a boolean rather than from input. The cursor binds scope, direction, membership bound and projection generation, and the 409 message_projection_changed correctly escapes the IOException | IllegalArgumentException catch because ManagedAgentException extends RuntimeException. The keyset predicate matches the existing ix_ma_message_history (tenant_id, session_id, first_sequence, item_id) index, so no new index and no migration — consistent with the V1-baseline rule. OCTET_LENGTH cannot return NULL here (attributes_json and parts_json are NOT NULL, inline_bytes is COALESCE'd), and turn_id is NOT NULL, so the turn_id IN (...) list can never be empty.
  • Nice touch: ManagedMessagePagingMySqlIT extends ManagedMessagePagingTest, so the whole paging suite re-runs against real MySQL rather than a token separate case. That is the right shape for the module's "SQL changes require real MySQL evidence" rule — but see the testing section, because that leg has not finished.
  • Small contract nit: the transcript request schema still declares limit with maximum: 1000, while messages view rejects anything above 100 (and the new contract test pins that 400 deliberately). The view description explains it in prose, but a consumer reading only the schema maximum would be surprised. Same for cursor length — the contract now says 4096, enforced in the store rather than by a @Size annotation as WebShellExportRequest does.
  • The frontend complexity is the part I would watch. Three mechanisms now cooperate to stop an Item page and the event stream double-rendering: the per-Item coverage map, withoutReplacedItemEvents, and the projectedThrough gate — plus an itemPages boolean that switches both the dedup key and the sort order inside mergeManagedEvents. Each is individually defensible and the tied-sequence ordering tests are good. Together they are the cost of running two history paths at once, which is why the snapshot retirement follow-up matters.

The handoff this PR introduces, and where it currently breaks:

sequenceDiagram
    participant P1 as WebShell UI
    participant P2 as useManagedSession
    participant P3 as Java Provider
    participant P4 as Managed Agent Server
    participant P5 as SQL ma_message
    P1->>P2: open Session
    P2->>P3: readTranscript (limit 100)
    P3->>P4: POST transcript query (view messages)
    P4->>P5: keyset page, newest 100 Items
    P5-->>P4: Items plus covered sequence
    P4-->>P3: items, events, coveredSequence
    Note over P3,P2: lastEventId = coveredSequence (changed here)
    P3-->>P2: transcript page
    P2->>P4: POST events stream (afterSequence = lastEventId)
    P4-->>P2: live events above the projection
Loading
Files changed (22 of 22 shown)
File What changed
docs/design/2026-10-29-managed-live-message-pages.md English design doc — decisions, limits, acceptance criteria, deferred work.
docs/design/2026-10-29-managed-live-message-pages.zh-CN.md Chinese counterpart; structure and criteria match the English version.
managed-agent-server/.../api/WebShellAgentController.java Three existing routes branch to the messages view when the request selects it. No new routes.
managed-agent-server/.../model/ApiModels.java Optional view field on the transcript and export request records, with a compact constructor preserving the old three-arg shape.
managed-agent-server/.../model/StoreModels.java New MessagePage record carrying items, bounded lifecycle events and both sequence bounds.
managed-agent-server/.../persistence/ManagedAgentStore.java The substance of the server change — keyset page query, metadata-only byte lookahead, turn lifecycle event join, cursor encode and validate.
managed-agent-server/.../session/AgentStateStore.java Interface declaration for the new store method.
managed-agent-server/.../session/ManagedAgentService.java Two thin service methods; both keep the existing readable-session authorization check.
managed-agent-server/.../openapi/managed-agent-public-api.openapi.json Contract 1.96.0 to 1.97.0 — adds view, 409 and 503 responses, widens the transcript cursor to 4096.
managed-agent-server/.../ManagedAgentApiContractTest.java Pins 200 for the messages selection, 404 for a foreign tenant, 400 for an unknown view and 400 for limit 101.
managed-agent-server/.../persistence/ManagedMessagePagingMySqlIT.java Runs the whole paging suite against real MySQL by subclassing the H2 test.
managed-agent-server/.../persistence/ManagedMessagePagingTest.java Paging, cursor, projection-generation and byte-admission cases on H2.
web-shell/.../managed/generated/managed-agent-api.ts Regenerated from the bumped contract.
web-shell/.../managed/java-managed-agent-provider.test.ts Existing expectations updated for the new request field and the changed resume point.
web-shell/.../managed/java-managed-agent-provider.ts Selects the messages view on transcript and export, declares live export consistency, switches lastEventId to coveredSequence.
web-shell/.../managed/managed-agent-provider.ts Adds the optional history marker and live export consistency flag to the provider interface.
web-shell/.../managed/managed-session-export.test.tsx Live-export happy path plus five guard-violation variants.
web-shell/.../managed/managed-session-export.tsx Live mode skips the snapshot watermark wait and bounds membership by firstSequence rather than lastSequence.
web-shell/.../managed/managed-session-messages.test.ts Tied-sequence identity ordering variants, including a byte-order case a locale compare would get wrong.
web-shell/.../managed/managed-session-messages.ts Item-page dedup key and a UTF-8 byte-wise tiebreak so client order matches SQL order.
web-shell/.../managed/use-managed-session.test.tsx Page and stream arrival orders, resync, and delayed-fragment suppression.
web-shell/.../managed/use-managed-session.ts Per-Item coverage tracking, replaced-fragment pruning, and the stream gate suppressing already-projected events.

CI on the reviewed commit at review time. The finalize job refreshes this region once the remaining legs settle.

Check Conclusion
Build and verify reference distribution success ✅
Capture web-shell visuals (ubuntu-latest, Node 22.x) queued
Check TUI impact success ✅
Classify PR success ✅
EventTransport broker gates / RocketMQ 5.5.1 / Java 21 success ✅
EventTransport multi-node gates / RocketMQ 5.5.1 + MySQL 8.4 / Java 21 success ✅
Flyway migration version uniqueness success ✅
Hosted failover E2E / Java 21 queued
Hosted process fault gates / MySQL 8.4 / Java 21 queued
Integration Tests (CLI, No Sandbox) skipped
Integration Tests (no-AK, No Sandbox) success ✅
Lint & Static (ubuntu-latest, Node 22.x) success ✅
Managed Agent fast tier success ✅
OpenTUI no-flicker gate success ✅
Real daemon E2E / Java 11 success ✅
Runtime Broker and Managed Agent MySQL / Java 21 in_progress
SDK Java (fast) / Flyway migration version uniqueness success ✅
SDK Java (fast) / Real daemon E2E / Java 11 success ✅
SDK Java (fast) / ubuntu-latest / Java 21 success ✅
Select the Managed Agent tier success ✅
TUI parity snapshots (ink vs opentui) success ✅
Test (macos-latest, Node 22.x) skipped
Test (ubuntu-latest, Node 22.x) success ✅
Test (windows-latest, Node 22.x) skipped
macos-latest / Java 21 queued
ubuntu-latest / Java 11 success ✅
ubuntu-latest / Java 17 success ✅
ubuntu-latest / Java 21 success ✅
web-shell E2E Smoke (ubuntu-latest, Node 22.x) failure ❌
windows-latest / Java 21 success ✅

Testing

This is an unattended CI run, so no PR code was built or executed here — the evidence below is the PR's own CI, read through the API for the reviewed commit.

One required check is red: web-shell E2E Smoke (ubuntu-latest, Node 22.x) — failure, 12 failed / 3 flaky / 396 passed. Ten of those twelve are the managed-progress failures traced above, so this is not infra noise; it is a fixture this PR invalidated and did not update. That check has to be green before this merges.

The Java legs that did finish are green across the board, including Managed Agent fast tier, Managed Agent gate, SDK Java (fast) / ubuntu-latest / Java 21, Java 11/17/21, windows-latest / Java 21, Flyway migration version uniqueness, and Real daemon E2E / Java 11. The TypeScript legs that ran are green too: Test (ubuntu-latest, Node 22.x), Lint & Static, Integration Tests (no-AK, No Sandbox), TUI parity snapshots, OpenTUI no-flicker gate. Test (macos-latest) and Test (windows-latest) were skipped by the matrix, not failed.

Still open at review time, and these matter more than usual for this diff:

  • Runtime Broker and Managed Agent MySQL / Java 21 — in_progress. This is the leg that runs ManagedMessagePagingMySqlIT, i.e. the only real-MySQL evidence for the new keyset query, the OCTET_LENGTH byte accounting, and the turn-lifecycle join. The module's own rules require real MySQL evidence for SQL changes and are explicit that H2 does not establish MySQL behaviour. Until this lands, the SQL half of the PR is unverified against the database it ships against.
  • Hosted process fault gates / MySQL 8.4, Hosted failover E2E, macos-latest / Java 21, and Capture web-shell visuals — queued.

Not verified, and why: the new paging SQL against real MySQL (leg still running); the live-export path end to end against a running server (no connected browser/database acceptance exists — the PR body says so itself, which I am recording as the author's own statement, not as evidence); and the scroll/anchor behaviour, which the DOM tests exercise against mocked rows rather than a real browser.

Sandboxed verification would settle the part static review cannot: @qwen-code /verify — specifically that the Item page and the SSE stream meet exactly at the projection's covered sequence without dropping or duplicating an Item in either arrival order, and that the new UTF-8 byte-wise tiebreak in mergeManagedEvents actually agrees with real MySQL utf8mb4_bin ordering for tied first_sequence values. The second one is the sharper question: the H2 suite can pass while MySQL orders those identities differently, and the whole no-duplicate-no-skip guarantee rests on the two agreeing. You have write access, so @qwen-code /tmux is available too, though the surface here is a browser against a Java server rather than the TUI, so /verify is the better fit.

No local real-scenario testing was driven — this run is unattended CI, where PR code is never executed.

中文说明

代码审查

阻塞项:web-shell E2E Smoke 是红的,而且由本 PR 引起。

12 个硬失败中有 10 个在 web-shell.managed-progress.spec.ts,且全部死在同一处 —— installManagedScenario → waitForCurrentStream(spec 第 195 行),轮询 streamCursors.includes(summary.lastSequence) 直到 20 秒超时。链路如下:

  • Provider 现在改从另一个字段推导事件流续传点:lastEventId: transcript.coveredSequence,此前读的是 transcript.lastSequence。
  • useManagedSession 把它直接送进 SSE 请求 —— snapshot() 返回 transcript.lastEventId,provider 发出 { sessionId, afterSequence: request.lastEventId }。
  • E2E mock daemon 的 /transcript/query 只回 { items: [], events, lastSequence, hasMore: false }。它从来没有返回过 coveredSequence,尽管契约早在本 PR 之前就把该字段列为必填。
  • 于是 lastEventId 变成 undefined。加载循环是 while (!aborted && lastEventId === undefined) lastEventId = await snapshot(false),页面因此反复重发 transcript 请求而不往下走;事件流以 afterSequence: undefined 打开,mock 记录为 0。[0].includes(3) 永远不为真。

本 PR 没有改动 client/e2e/ 下任何文件,所以这个夹具就是漏改了 —— 而同一份 diff 里 java-managed-agent-provider.test.ts 和 use-managed-session.test.tsx 的两处单元测试 mock 都补上了 coveredSequence。TypeScript 抓不到:生成类型把 coveredSequence: number 声明为必填,而 route.fulfill({ json }) 是无类型的,缺字段要到运行时才暴露。

两种修法,我倾向第二种:

  1. 在 mock 的 transcript 响应里补 coveredSequence: summary.lastSequence。
  2. 在 provider 里兜底 —— transcript.coveredSequence ?? transcript.lastSequence。messages 视图下 messageTranscript 把两者都取自 page.coveredSequence(),因此完全等价;同时消掉了「响应不合契约时客户端无限重试而不报错」这个失败模式。PR 正文自己写了 provider「需要匹配的 Server 构建」,那么让客户端退化而不是空转,应该值这几个字符。

非阻塞项。

  • 另外两个硬失败 —— web-shell.host-directory-picker.spec.ts:90 和 web-shell.standalone.spec.ts:197 —— 无法归因到本 diff。两个 spec 都没有引用 managed provider 或 installManagedScenario,失败点都是普通 UI 等待(「Add Workspace」对话框、「Project」折叠按钮)。同一次 36.2 分钟的运行里还有 3 个用例被判为 flaky,日志中充满 ECONNREFUSED 127.0.0.1:4170 的 vite 代理噪声。我无法证明它们是既有问题,因为该检查在 main 上是 skipped,没有可比基线。有一个我不当作结论的猜测:上述空转重试会从并行 worker 持续打 mock daemon,而 runner 明显已经饱和。修好夹具后重跑,再看剩下什么。
  • Java 侧我查过的部分都站得住。每条查询都按 tenant_id 和 session_id 限定;新路径保留了 requireSession、ManagedLegacySessionGuard.requireLegacyMutation 和 requireReadableSession。所有值都是绑定参数 —— 唯一拼接进 SQL 的是比较运算符和排序方向,二者都来自布尔值而非输入。游标绑定了 scope、方向、成员上界和投影代次;409 message_projection_changed 能正确逃出 IOException | IllegalArgumentException 的 catch,因为 ManagedAgentException 继承 RuntimeException。keyset 谓词与既有索引 ix_ma_message_history (tenant_id, session_id, first_sequence, item_id) 匹配,因此不需要新索引也不需要迁移 —— 符合 V1 基线规则。OCTET_LENGTH 在此不会返回 NULL(attributes_json、parts_json 均 NOT NULL,inline_bytes 有 COALESCE),turn_id 也是 NOT NULL,所以 turn_id IN (...) 列表不会为空。
  • 一个亮点:ManagedMessagePagingMySqlIT extends ManagedMessagePagingTest,整套分页用例在真实 MySQL 上重跑,而不是只写个象征性用例。这符合本模块「SQL 改动需要真实 MySQL 证据」的规则 —— 但请看下面的测试部分,那条 leg 还没跑完。
  • 契约小问题:transcript 请求 schema 里 limit 仍声明 maximum: 1000,而 messages 视图拒绝大于 100(新增契约测试是有意把这个 400 钉住的)。view 的描述用散文解释了这点,但只读 schema 最大值的消费者会意外。游标长度同理 —— 契约现在写 4096,但由 store 校验,而不像 WebShellExportRequest 那样用 @Size 注解。
  • 前端复杂度是我最关注的部分。现在有三套机制协同防止 Item 页与事件流重复渲染:逐 Item 覆盖表、withoutReplacedItemEvents、以及 projectedThrough 门控 —— 外加一个 itemPages 布尔量,它会同时切换 mergeManagedEvents 内部的去重键和排序规则。每一项单独看都站得住,同序号排序的测试也写得好。合在一起就是「同时维护两条历史路径」的代价,这正是快照下线后续工作重要的原因。

测试

本次为无人值守 CI 运行,因此没有构建或执行任何 PR 代码 —— 以下证据是通过 API 读取的、该 PR 自身在所审 commit 上的 CI 结果。

有一个必需检查是红的:web-shell E2E Smoke (ubuntu-latest, Node 22.x) — failure,12 失败 / 3 flaky / 396 通过。其中 10 个就是上面追踪到的 managed-progress 失败,所以这不是基础设施噪声,而是本 PR 使其失效却未更新的夹具。合入前该检查必须转绿。

已完成的 Java leg 全绿,包括 Managed Agent fast tier、Managed Agent gate、SDK Java (fast) / ubuntu-latest / Java 21、Java 11/17/21、windows-latest / Java 21、Flyway migration version uniqueness 和 Real daemon E2E / Java 11。已运行的 TypeScript leg 也是绿的:Test (ubuntu-latest, Node 22.x)、Lint & Static、Integration Tests (no-AK, No Sandbox)、TUI parity snapshots、OpenTUI no-flicker gate。Test (macos-latest) 和 Test (windows-latest) 是矩阵跳过,不是失败。

审查时仍未结束的部分,对这个 diff 而言比平常更要紧:

  • Runtime Broker and Managed Agent MySQL / Java 21 — in_progress。 这条 leg 跑的正是 ManagedMessagePagingMySqlIT,也就是新 keyset 查询、OCTET_LENGTH 字节核算和 turn 生命周期 join 唯一的真实 MySQL 证据。本模块规则要求 SQL 改动提供真实 MySQL 证据,并明确 H2 不能证明 MySQL 行为。它落地之前,这个 PR 的 SQL 部分尚未经过其实际运行数据库的验证。
  • Hosted process fault gates / MySQL 8.4、Hosted failover E2E、macos-latest / Java 21、Capture web-shell visuals —— 排队中。

未验证项及原因:新分页 SQL 在真实 MySQL 上的行为(leg 仍在运行);live export 端到端对真实服务端的路径(不存在连通的浏览器/数据库验收 —— PR 正文自己也这么说,我在这里记录的是作者的陈述,不作为证据);以及滚动/锚点行为,DOM 测试用的是模拟行而非真实浏览器。

沙箱化验证可以解决静态审查解决不了的部分:@qwen-code /verify —— 具体是验证 Item 页与 SSE 流恰好在投影的 covered 序号交接,在两种到达顺序下都不丢不重;以及 mergeManagedEvents 中新的 UTF-8 按字节比较,在 first_sequence 相同的情况下是否真的与 MySQL utf8mb4_bin 排序一致。第二个问题更尖锐:H2 用例可以通过,而 MySQL 对这些身份的排序不同,而「不重复不遗漏」的整个保证依赖于两者一致。你有写权限,@qwen-code /tmux 也可用,但这里的界面是浏览器对 Java 服务端而非 TUI,所以 /verify 更合适。

未驱动本地真实场景测试 —— 本次为无人值守 CI,绝不执行 PR 代码。

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at cf7a0edf37d390a58db00901a397286023ce62f5 · re-run with @qwen-code /triage

@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Confidence: 2/5 — the design and the server implementation are sound, but a required check is red with ten failures this PR caused, and the failure mode is a page that retries forever rather than a cosmetic assertion. Requesting changes.

Stepping back: I asked in Stage 1 whether retiring the snapshot path was actually tracked, or whether this was quietly making two history subsystems permanent. It is tracked — #15870 (refactor(managed): Remove persisted public message snapshots) is already open, and #15871 splits the server into Maven modules behind it. Read against that sequence, this PR is a deliberate step in a coherent program rather than scope creep, and it softens my main reservation considerably. The three overlapping frontend dedup mechanisms are the price of a transition that is already scheduled to end, not a permanent tax. I am comfortable with that.

My own baseline for this problem was essentially what the PR does: page the message table directly with a tenant/session keyset, opt in explicitly so existing clients keep snapshot semantics, and resume SSE at the sequence the page actually included. The server side matches or beats that — the metadata-only byte lookahead before bodies are fetched is a better shape than I would have written first, and running the whole paging suite against real MySQL by subclassing the H2 test is the right way to satisfy the module's evidence rule rather than a token gesture. Every change in the diff earns its place; there is no drive-by refactor or formatting churn, and both design docs are present as the repo requires.

What stops me is that the change to the provider's resume point was not carried through to every fixture that serves a transcript response. Two unit-test mocks were updated in this same diff; the E2E mock daemon was not, and it has never returned coveredSequence because nothing read it before. The result is ten dead tests in web-shell.managed-progress.spec.ts and a load loop that spins on lastEventId === undefined instead of failing visibly. That is a small fix — one field in a fixture, or a nullish fallback in the provider that I would prefer on its own merits — but it is not optional, and it is the kind of thing that should be caught before merge rather than after.

There is also a sequencing cost worth naming: if this lands with the smoke suite red, #15870 inherits that red as its starting state, and telling the two PRs' breakage apart gets harder for whoever reviews it. Fixing the fixture here is cheaper than debugging it there.

Two things I could not settle and would not want waived: the real-MySQL leg (Runtime Broker and Managed Agent MySQL / Java 21) was still running at review time, and it is the only evidence that the new keyset query, the byte accounting and the lifecycle join behave on the database this ships against — H2 passing does not establish that, particularly for the tied-first_sequence ordering the no-duplicate guarantee depends on. And the live-export path has no connected end-to-end acceptance, which the PR body states plainly. Neither is a reason to reject; both are reasons not to approve today.

So: fix the fixture (or add the fallback), get the smoke suite green, let the MySQL leg finish, and I expect this to be a straightforward approve. The substance is good.

中文说明

置信度:2/5 —— 设计和服务端实现都是可靠的,但有一个必需检查是红的,其中 10 个失败由本 PR 引起,且失败形态是页面无限重试而非表面的断言不匹配。因此请求修改。

退一步看:我在 Stage 1 问过,下线快照路径是否真有登记,还是这次改动在悄悄把两套历史子系统变成永久状态。答案是有的 —— #15870(refactor(managed): Remove persisted public message snapshots)已经开着,后面还有 #15871 把服务端拆成 Maven 模块。放到这个序列里看,本 PR 是一个连贯计划中的有意一步,而不是范围蔓延,这也大幅缓解了我主要的顾虑。前端那三套互相重叠的去重机制,是一个已经排期结束的过渡状态的成本,不是永久税负。这一点我接受。

我自己对这个问题的基线方案,基本就是本 PR 的做法:用租户/会话 keyset 直接分页消息表,显式选择开启以让既有客户端保留快照语义,并在页面实际包含的序号处续接 SSE。服务端与我的方案相当甚至更好 —— 取正文之前先做仅元数据的字节预探,比我第一反应会写的形态更好;而通过继承 H2 测试让整套分页用例在真实 MySQL 上跑一遍,是满足本模块证据规则的正确做法,而不是象征性动作。diff 里每处改动都有其必要性,没有顺手重构或格式化噪声,两份设计文档也按仓库要求齐备。

让我停下来的是:provider 续传点的这次变更,没有同步到每一个提供 transcript 响应的夹具。同一份 diff 里两个单元测试 mock 都更新了,E2E mock daemon 没有 —— 而它从来没返回过 coveredSequence,因为此前没人读这个字段。结果是 web-shell.managed-progress.spec.ts 里 10 个用例全灭,且加载循环在 lastEventId === undefined 上空转,而不是显式失败。这个修复很小 —— 夹具里加一个字段,或者在 provider 里加空值兜底(就其本身价值而言我更倾向后者)—— 但不是可选项,而且这类问题应该在合入前被发现,而不是之后。

还有一个排序上的代价值得点明:如果本 PR 带着红的 smoke 套件合入,#15870 就会以这个红作为起始状态继承下去,届时对审阅者来说,要分清两个 PR 各自造成的破坏会更难。在这里修好夹具,比在那边调试便宜。

有两件事我无法定论,也不希望被放过:真实 MySQL 那条 leg(Runtime Broker and Managed Agent MySQL / Java 21)在审查时仍在运行,而它是新 keyset 查询、字节核算和生命周期 join 在其实际运行数据库上表现的唯一证据 —— H2 通过不能证明这点,尤其是对「不重复」保证所依赖的 first_sequence 相同时的排序。另外 live export 路径没有连通的端到端验收,PR 正文也明确说明了。这两点都不构成拒绝理由,但都是今天不宜批准的理由。

所以:修好夹具(或加上兜底),让 smoke 套件转绿,等 MySQL leg 跑完,我预计这会是一次顺利的批准。实质内容是好的。

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at cf7a0edf37d390a58db00901a397286023ce62f5 · re-run with @qwen-code /triage

@qwen-code-review-bot qwen-code-review-bot 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.

@doudouOUC Requesting changes on one blocking item — the rest of the review is in my staged comments above.

web-shell E2E Smoke is red with 12 failures, and 10 of them are in web-shell.managed-progress.spec.ts, all dying in installManagedScenario. Switching the provider's resume point from transcript.lastSequence to transcript.coveredSequence invalidated the E2E mock daemon's /transcript/query reply, which has never included coveredSequence. lastEventId arrives undefined, the load loop spins on while (lastEventId === undefined), and the stream never reaches the sequence the fixture asserts on.

The two unit-test mocks were updated in this diff; the E2E fixture was not. I would prefer the provider-side fallback (transcript.coveredSequence ?? transcript.lastSequence — exactly equivalent in messages view, where the server sets both from page.coveredSequence()) over patching the fixture, since it also removes the silent spin.

Also unresolved rather than rejected: the real-MySQL leg was still running at review time, and it is the only evidence for the new keyset query and the tied-first_sequence ordering.

Design and server implementation look good to me — #15870 behind this answers the "two history paths" question I raised in Stage 1. Expect a straightforward approve once the smoke suite is green and the MySQL leg lands.

中文说明

@doudouOUC 因一项阻塞问题请求修改 —— 其余审查内容在上面的分阶段评论中。

web-shell E2E Smoke 是红的,12 个失败中有 10 个在 web-shell.managed-progress.spec.ts,全部死在 installManagedScenario。把 provider 的续传点从 transcript.lastSequence 改为 transcript.coveredSequence,使 E2E mock daemon 的 /transcript/query 响应失效 —— 它从来没有包含过 coveredSequence。lastEventId 变成 undefined,加载循环在 while (lastEventId === undefined) 上空转,事件流永远到不了夹具断言的序号。

本 diff 里两个单元测试 mock 都更新了,E2E 夹具没有。相比改夹具,我更倾向在 provider 侧兜底(transcript.coveredSequence ?? transcript.lastSequence —— 在 messages 视图下完全等价,服务端把两者都取自 page.coveredSequence()),因为它同时消掉了这个静默空转。

另有一项是未定论而非否定:审查时真实 MySQL 那条 leg 仍在运行,而它是新 keyset 查询和 first_sequence 相同排序的唯一证据。

设计和服务端实现我认为没问题 —— 后续的 #15870 回答了我在 Stage 1 提出的「两条历史路径」疑问。smoke 套件转绿、MySQL leg 落地后,预计可以顺利批准。

— Qwen Code · qwen3.8-max-2026-09-02

Reject malformed transcript coverage before bootstrap can spin. Type the
Managed smoke response and backport the two exact selector corrections
from 4dc63d0 (#15860).

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@doudouOUC

Copy link
Copy Markdown
Collaborator Author

In response to Stage 1: snapshot retirement is tracked separately in #15870, with the module split in #15871; neither is pulled into this PR. Existing omitted-view defaults remain intact. Fixed in ca8970b: type-check the smoke transcript fixture and reject invalid coverage explicitly. I did not adopt the lastSequence fallback: when coverage is absent, the client cannot establish that another field certifies the projected prefix. Valid zero and partial coverage still resume at S, including when S is below H.

对应Stage 1:快照下线由#15870跟踪,模块拆分由#15871处理,本PR不纳入两项工作,省略view的默认契约保持。ca8970b84b96c6d3cc5f77fc43b577150a0944c8已给Smoke响应加类型检查,并显式拒绝无效覆盖序号;不采用lastSequence兜底,因为覆盖信息缺失时不能证明另一个字段代表已投影前缀。合法零值和部分覆盖仍从S续接,包括S小于H的情况。

@doudouOUC

Copy link
Copy Markdown
Collaborator Author

In response to Stage 2: agreed on the fixture regression. Fixed in ca8970b, with the typed coveredSequence fixture plus explicit malformed-coverage rejection instead of an H fallback. The independent baseline trace actually recorded 3453 transcript queries,3459 session reads and zero SSE requests. After the fix all10 original Managed smoke scenarios and both separately reproduced selector cases pass once, without retries or changed timeouts; the selectors are the exact upstream #15860/4dc63d0023749b4546696a9c16cf26b68dd86673 fix. The changed Provider file passes100 cases and six actual Java-provider hook targets pass. New-head CI remains pending.

The completed cf7a MySQL job123467700015/run40879717089 explicitly checked out cf7a: H2 paging11, real-MySQL paging11, API23 and surface4 all passed; totals5978 unit/H2 with19 skipped,1245 real-profile with0 skipped, packaging3, all zero failures/errors. SQL identities are VARBINARY(512), encoded as UTF-8 by ManagedSchemaKeys.identity; their ordering is raw bytes, not utf8mb4_bin text collation. Real-MySQL tied ASCII coverage and frontend Unicode/case tests are separate evidence; no connected real-SQL browser/export or MySQL Unicode/case execution is claimed. The1000 limit preserves the default snapshot API, with messages-only100 documented and enforced; conditional-schema refinement and annotation placement are deferred to keep this fix narrow. No guard/timeout is weakened.

对应Stage 2:确认夹具回归,ca8970b84b96c6d3cc5f77fc43b577150a0944c8已补齐并类型检查coveredSequence,同时对非法覆盖显式报错,不回退到H。独立修前trace实际为3453次历史查询、3459次会话读取、0次SSE。修后10项原Managed Smoke及两项独立复现的选择器目标全部一次通过,0重试且超时不变;选择器精确回移主干#15860的两行修复。完整Provider100项和六个实际Java-provider hook目标通过,新head CI仍待验。

cf7a的MySQL完整job已明确核实实际checkout:H2分页11、真实MySQL分页11、API23、surface4通过;总unit/H2为5978项/19跳过,真实profile1245项/0跳过,packaging3项,均零failure/error。SQL身份是UTF-8编码的VARBINARY(512),按字节排序,不使用utf8mb4_bin文本排序;真实MySQL并列ASCII与前端Unicode/大小写验证分别留档,不宣称真实SQL浏览器/导出或MySQL Unicode/大小写验收。默认快照API的1000上限保留,messages专属100已文档化并强制执行;条件schema细化及注解位置建议后置,不扩大此次修复。未削弱守卫或超时。

@doudouOUC

Copy link
Copy Markdown
Collaborator Author

In response to Stage 3: fixed in ca8970b. The independent postfix run passes all12 original failing smoke targets with0 retries; malformed coverage is an explicit read error that follows existing backoff, while a typed fixture supplies its actual included sequence. The parent cf7a real-MySQL leg has now passed, with exact-checkout evidence in the updated original test report. The new push must still earn its own smoke CI result; Hosted faults and connected browser/live-export acceptance are not inferred from partial success. The formal CHANGES_REQUESTED review is left intact for reviewer reassessment.

对应Stage 3:ca8970b84b96c6d3cc5f77fc43b577150a0944c8已修复,独立修后12项原失败Smoke目标全部通过、0重试。非法覆盖进入既有读取失败/退避路径,类型化夹具提供实际包含的覆盖序号。父提交cf7a的真实MySQL leg已通过,准确checkout证据同步原独立报告。新提交仍须单独确认Smoke CI;Hosted故障及真实浏览器/实时导出连通验收不由部分通过推断。正式CHANGES_REQUESTED保留,等待审阅者重新判断。

@doudouOUC

Copy link
Copy Markdown
Collaborator Author

R1 fixes pushed: ca8970b (parent cf7a0ed). This also responds to the CHANGES_REQUESTED review and Stages1–3; no review state was dismissed.

Item Action
Missing smoke transcript coverage / bootstrap spin Fixed the fixture with the required coveredSequence and a transcript type check; reject missing/null/negative/fractional coverage in the Provider instead of substituting an unproven event head. Valid S=0 and S<H stay supported.
Two other smoke failures Reproduced and backported the exact two selector corrections from main4dc63d0023749b4546696a9c16cf26b68dd86673/#15860. No UI or Legacy behavior change.
Validation Provider100/100, six actual Java-provider hook targets and12 original smoke targets PASS;0target skips/retries. Incremental WebShell build36.698s/template1.175s/typecheck14.637s/bundle2.947s PASS; initial bundle failed on an omitted unchanged generated-ui output and remains recorded.
SQL evidence Parent cf7a exact-checkout H2 paging11/MySQL paging11/API23/surface4 pass;1379 Java/SDK/POM/workflow/lock/manifest inputs unchanged by this TS/docs fix. This carries only those slices, not new-head runtime or whole-workflow acceptance.
Deferred / held Snapshot retirement #15870/module split #15871 remain separate; contract schema/annotation nits deferred. Old visuals was canceled by @yiliang114 before steps, so it was not rerun. No mixed-failure smoke rerun or duplicate full Java dispatch.

The old smoke result12FAIL/3flaky/396PASS is preserved. New-head smoke CI and the parent Hosted-fault gate remain pending; connected real-SQL browser/export/model acceptance is NOT_RUN. All three local Java allowances stay CLOSED, and both user previews5196/5197 stay on their original running builds/data. Incremental root and independent reviews each reached two clean passes; this is not whole-PR approval.


R1修复已推送:ca8970b84b96c6d3cc5f77fc43b577150a0944c8,父提交cf7a0edf37d390a58db00901a397286023ce62f5;同时回应正式CHANGES_REQUESTED与Stage1–3,未撤销评审状态。

事项 处理
Smoke缺失覆盖序号及启动空转 夹具补齐coveredSequence并类型检查;Provider显式拒绝缺失/null/负数/小数,不以未经证明的事件head兜底。合法S=0及S<H保持。
另两项Smoke失败 独立复现后精确回移主干4dc63d0023749b4546696a9c16cf26b68dd86673/#15860的两处选择器修正,不改UI或Legacy行为。
验证 Provider100/100、六项实际Java-provider hook目标、12项原Smoke失败目标通过,0目标跳过/重试。增量WebShell构建36.698秒/模板1.175秒/类型检查14.637秒/bundle2.947秒通过;首轮bundle缺少未变generated-ui产物的失败保留。
SQL证据 父提交cf7a准确checkout的H2分页11/MySQL分页11/API23/surface4通过;本次TS/文档修复未改变1379项Java/SDK/POM/workflow/lock/manifest输入,只复用这些切片,不冒充新head运行或完整workflow验收。
后置/保留 快照下线#15870及模块拆分#15871独立推进;契约schema/注解细化后置。旧visuals由@yiliang114在执行前取消,未重跑;未重跑混合失败Smoke,也未重复派发完整Java。

原Smoke结果12FAIL/3flaky/396PASS完整保留。新head Smoke CI和父提交Hosted故障门禁仍待完成,真实SQL浏览器/导出/模型连通验收NOT_RUN。三个本地Java额度保持CLOSED,用户5196/5197预览继续使用原构建与数据。根与独立审阅各两轮增量clean,不等于全PR批准。

@wenshao

wenshao commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Verdict: ✅ merge-ready — 18/18 scripted assertions passed at head ca8970b84b96c6d3cc5f77fc43b577150a0944c8. The blocking defect this round found at cf7a0edf37 is fixed at the new head and the fix is pinned; three coverage Suggestions remain open and are not merge conditions.

Revision note: this round began at cf7a0edf37 and the author pushed ca8970b8 mid-round while I was reading their replies. Every measurement below was re-run at ca8970b8, not carried over; the earlier head's numbers appear only in the "before" row of the A/B, labelled as such.

中文摘要

结论:merge-ready(18/18 脚本化断言通过,head ca8970b84b)。

A/B 结论(见 04-ab-after-fix.png): 令对端省略 coveredSequence:cf7a 上 lastEventId=undefined、加载循环空转 3 次、SSE 记录为 0(永不满足 spec 条件);ca8970b8 上改为显式抛出 Invalid message transcript coverage.、空转 0 次。对端带上该字段时两臂都正确续接在 3。作者同时给 E2E 夹具补了 coveredSequence: summary.lastSequence 并加 satisfies JavaAgentTranscript;我把这一行删回去验证过——条件立刻恢复失败,说明该行是承重的。

前一轮 finding 状态: 1 号(阻断)fixed,且新守卫两个条件各被 3–4 个用例钉住(移除整数校验 → 3 红,整段移除 → 4 红);2/3/4 号 suggestion stands,均为实测变异存活,不构成合并条件。

未覆盖: 浏览器 Playwright 在本机起不来(缺 libatk-1.0.so.0),10 个 spec 的端到端仍以「按夹具契约重放 + base 正控」替代;真实 MySQL 腿本轮未跑(作者报告 cf7a 上该腿已通过,我未复现);对 projectedThrough 闸的两支自建探针互相矛盾、未收敛,故 2/3 号结论只依据插桩读数与变异结果。

Previous-finding status (round 1 at cf7a0edf37 → now ca8970b84b)

# finding severity status at ca8970b8 evidence
1 transcript without coveredSequence spins the load loop and opens the stream at 0 blocking fixed 04-ab-after-fix.png: head now throws, spins=0; the fixture line is load-bearing (removing it re-breaks the condition)
2 the "delayed fragment" test is not carried by the projectedThrough gate it is named for suggestion stands 02-mutation-matrix.png M2 row
3 initial-page coverage map unpinned, and its window is narrower than it looks suggestion stands M4 row still survives 125/125
4 resync reset of itemPagesRef is unobservable suggestion stands M3 row still survives 125/125

I agree with the author's choice not to adopt the lastSequence fallback: substituting the event head for an absent coverage would assert a projected prefix nobody vouched for. Failing loudly is the stricter contract and it removes the spinner, which was the actual user-visible harm. The cost is that such a peer now gets a visible read error instead of a degraded page; since the PR already requires a matching Server, that is the right trade.

Central claim and A/B

The PR moves the WebShell history read from published snapshots to a direct page over ma_message, and with it moves the SSE resume point from transcript.lastSequence to transcript.coveredSequence. Instrument: the spec's own /transcript/query reply shape, driven through the real createJavaManagedAgentProvider, evaluating the spec's own poll condition streamCursors.includes(summary.lastSequence). Witnesses: 01-ab-resume-point.png (pre-fix head) and 04-ab-after-fix.png (current head).

cell arm lastEventId read outcome spins spec condition expected
peer omits coveredSequence base 68f181b885 3 (lastSequence) ok 0 true pass ✅
peer omits coveredSequence head before cf7a0edf37 undefined ok 3 (4 requests) false red ✅ (control, as predicted)
peer omits coveredSequence head ca8970b84b undefined throws Invalid message transcript coverage. 0 fails loudly pass ✅
peer sends coveredSequence base / head 3 / 3 ok 0 true pass ✅
fixture line removed at head ca8970b84b undefined throws 0 false pass ✅ (the fixture line is load-bearing)

Findings

1. Blocking at cf7a0edf37 — FIXED at ca8970b84b

The provider now refuses a transcript whose coverage is missing, null, negative or fractional, and the E2E fixture supplies it under satisfies JavaAgentTranscript so the type check keeps it honest. Both halves are pinned:

  • The guard's conditions are pinned one at a time. Removing the whole guard kills 4 tests; removing only the Number.isSafeInteger half kills 3 (missing, null, fractional) while negative still passes — the author wrote one input per condition rather than one input violating two.
  • The fixture line is load-bearing. Deleting coveredSequence: summary.lastSequence from the spec and re-running the provider probe restores specCondition=false, so the green depends on that line and not on something else.

I could not verify the claim that the 12 smoke targets now pass: browsers do not launch in this environment (see Not covered). That claim rests on the author's run and on the CI check at the new head.

2. Suggestion — the "delayed fragment" test is not carried by the gate it is named for

Removing the entire projectedThrough gate leaves ignores only delayed fragments already covered by an older Item page green. Its assertion happens to be satisfied by withoutReplacedItemEvents on the following loadOlder, so the test names a mechanism it does not pin.

3. Suggestion — the initial-page coverage map has no test

Instrumented at head (03-gate-decision.png): an assistant_delta for item old at id 12 sees cov: [["old",10]], projectedThrough: 10. So the write is observable in principle — but no committed test fails when it is removed (M4, 125/125 green). Note also that the hook drops every frame with id <= lastEventId before the gate runs, so the exclusion only bites for a frame above lastEventId whose item coverage sits below it.

4. Suggestion — the resync reset of itemPagesRef is unobservable

M3 survives 125/125 because the resync path re-enters snapshot() immediately and re-derives the flag. Not dead in principle, but nothing distinguishes it today.

Measured and fine

  • WebShell changed surface at ca8970b8: 322/322 across the four touched files (provider 100, session messages 79, export 18, hook 125).
  • Guard matrix at ca8970b8: 2 pinned, 2 survived, in-file control red, baselines green before and after (02-mutation-matrix.png).
  • Server (H2) at cf7a0edf37: ManagedMessagePagingTest 11/11 and ManagedAgentApiContractTest 23/23, measured here in one invocation. The Java files are identical between the two heads (git diff cf7a0edf37..ca8970b84b touches only design docs and web-shell), so these carry over by input closure. The author's update agrees and adds the real-MySQL figures from that same job (real-MySQL paging 11, API surface 4, zero failures), which I did not reproduce.
  • The two non-managed smoke failures were real; the author backported the selector fix from main (test(web-shell): follow the renamed workspace copy in two e2e specs #15860) instead of changing behaviour.

Not covered

  • Browser E2E. Playwright cannot launch here: chrome-headless-shell: error while loading shared libraries: libatk-1.0.so.0. Every browser-level statement is the spec's contract replayed through the real provider, not the spec executing. The A/A control is base, which passes the same replay.
  • Real MySQL leg. Not run: the local container route needs an interactive credential this round did not use. The author reports cf7a's MySQL leg passed (run 40879717089: H2 paging 11 / real-MySQL paging 11 / API 23 / surface 4); I did not reproduce it, so tied-first_sequence ordering is evidenced on H2 only here.
  • Convergence on the projectedThrough gate. Two of my synthetic probes disagreed with the author's scenario. I did not reach a clean account of the second, so Findings 2–3 rest on instrumented gate values and mutation results rather than end-to-end probes. Recorded as unreached, not resolved.
  • Java 11/17 matrix, hosted/fault gates, connected model acceptance — not run.

Methodology

Local maintainer round on the workstation. head-tree at ca8970b84b and base-tree at 68f181b885 (the PR's target tip), each with a real copy (cp -r; / and tmp/ are ext4 without reflink, so hardlinks would write through) of the root and per-package node_modules, with node_modules/@qwen-code/* re-pointed per arm — readlink -f and inode checks confirm independence. Both arms built with the repo's own root npm run build. Java verified with JDK 21 after installing sdk-java from this tree. Harnesses and raw logs live in harness/ and beside it (unit-*.log, mutations-new.log, java-paging-head.log, gate-instrumented.log).


Evidence images (assets branch assets/pr15865-validation)

A/B, before the fix — 01-ab-resume-point.png: the spec's own /transcript/query reply, driven through the real provider. Base resumes at 3 and satisfies the spec's poll; head cf7a0edf37 yields undefined, spins 3 extra requests, and records afterSequence = 0.

A/B resume point

A/B, at ca8970b84b — 06-ab-after-fix.png: an omitted coverage now fails loudly with spins=0; a present one still resumes at 3 on both arms.

A/B after fix

Mutation matrix at ca8970b84b — 05-mutation-matrix-ca8970b8.png: in-file control red, baselines green before and after, withoutReplacedItemEvents pinned, the projectedThrough gate and the initial coverage map unpinned, and the new coverage guard pinned condition by condition.

Mutation matrix

Instrumented gate at head — 03-gate-decision.png: a live assistant_delta for an item the page already covered arrives with cov: [["old",10]] and projectedThrough: 10, so the initial-site map is reachable — it simply has no test.

Gate decision

— DeepSeek-V4.1-Flash-1017@fda99a87 via Qwen Code /verify-pr (v0.26.4; skill 87f6e765e630)

@yiliang114 yiliang114 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.

LGTM. No P0/P1 findings — the implementation is well-structured with thorough cursor validation, byte-budget enforcement, CSI guard, consistent SQL/JS item ordering, and extensive tests across Java and TypeScript layers. Two minor non-blocking observations:

P2 (non-blocking): No formal fixes/closes/resolves #N linkage in the PR body — the PR references #15839 as "Follow-up to" and #13184 as "Related context," but neither is formally linked. Consider linking #15839 with Fixes or a closing note.

P2 (non-blocking): Three E2E files contain incidental selector/label corrections (Add Workspace → Add workspace, Project → Workspaces) unrelated to the message-paging feature. These are correct fixes but bundled scope drift — prefer separating UI-copy corrections from feature PRs in the future.

@doudouOUC
doudouOUC merged commit 89d3aae into main Oct 29, 2026
67 of 69 checks passed
@doudouOUC
doudouOUC deleted the feat/managed-live-message-pages branch October 29, 2026 16:23
@github-actions

Copy link
Copy Markdown
Contributor

Managed Agent gate failed

Run 40908774102 · commit ca8970b84b96

Failing tests

  • com.alibaba.qwen.code.managedagent.HostedSessionRelayFaultGatesIT.fg9dCancelledSendsDeliverOnlyWhatTheRelaySettledOnMySql
  • com.alibaba.qwen.code.managedagent.HostedSessionRelayFaultGatesIT.fg9cHarnessCrashesNeverMintARelayStepTwiceOnMySql
  • com.alibaba.qwen.code.managedagent.HostedSessionRelayFaultGatesIT.fg9bRefusedJournalCommitsHealOnlyThroughTheOriginalCommandOnMySql
  • com.alibaba.qwen.code.managedagent.HostedSessionRelayFaultGatesIT.fg9fPartialBroadcastAnswersHonestlyUnderAmbiguityOnMySql
  • com.alibaba.qwen.code.managedagent.HostedSessionRelayFaultGatesIT.fg9aLostRepliesResolveThroughOriginalIdentityOnMySql
  • com.alibaba.qwen.code.managedagent.HostedChannelFaultGatesIT.fg7aLostAdapterRepliesRecoverByIdentityOnMySql
  • com.alibaba.qwen.code.managedagent.HostedChannelFaultGatesIT.fg7dChannelCancellationsSettlePhysicallyOnMySql
  • com.alibaba.qwen.code.managedagent.HostedChannelFaultGatesIT.fg7fUnknownDeliveryStaysHonestOnMySql
  • com.alibaba.qwen.code.managedagent.HostedChannelFaultGatesIT.fg7bChannelStoreFailuresLeaveNoExternalEffectOnMySql(CapturedOutput)
  • com.alibaba.qwen.code.managedagent.HostedChannelFaultGatesIT.fg7eDeliveryReadsStayContinuousAcrossGapsOnMySql
  • com.alibaba.qwen.code.managedagent.HostedProcessCrashIT.processCrashesNeverReplayHostedToolsOnMySql
  • com.alibaba.qwen.code.managedagent.HostedMcpRestartFaultGatesIT.ownerReleaseRefusedThenSpringRestartReleasesTheHolderOnMySql
  • com.alibaba.qwen.code.managedagent.HostedWorkflowFaultGatesIT.fg10aDigestIntegrityHoldsAcrossTamperAndFractionalArgsOnMySql
  • com.alibaba.qwen.code.managedagent.HostedWorkspaceToolTurnIT.lostBrokerRepliesNeverReplayEffectsOnMySql
  • com.alibaba.qwen.code.managedagent.HostedWorkspaceToolTurnIT.disconnectedObserversResumeWithoutReplayingTheToolOnMySql
  • com.alibaba.qwen.code.managedagent.HostedWorkspaceToolTurnIT.malformedShellUnicodeIsCorrectableBeforeAcquisition(String)[2]
  • com.alibaba.qwen.code.managedagent.HostedWorkspaceToolTurnIT.sessionStoreFailuresNeverReplayEffectsOnMySql(CapturedOutput)
  • com.alibaba.qwen.code.managedagent.HostedWorkspaceToolTurnIT.providerRetriesKeepContractsAndCloseAdmissionOnMySql
  • com.alibaba.qwen.code.managedagent.HostedWorkspaceToolTurnIT.cancellationRequiresPhysicalSettlementOnMySql
  • com.alibaba.qwen.code.managedagent.HostedWorkspaceToolTurnIT.operatorRecoveryReleasesOnlyTheOriginalQuiescentShellOnMySql
  • …and 21 more

Tracking issue

@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Released in v0.26.5.

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.

4 participants