Repository navigation
feat(runtime): add original CSI application retirement - #14698
Conversation
E2E and verification report — original CSI application retirementCurrent candidate: Current results are below. The only change from
The final 178-case Java selection is retirement 17 + history 3 + inventory 63 + native activation 20 + retained graphs 31 + lock-order 44. It differs from the earlier historical 178-case selection. The full 4930-case unit phase was reported on earlier 7bc-equivalent bytes with 0 failures/errors and 18 skips; its verify then failed one format gate. It was not rerun on the current head. Historical source-branch passes do not qualify this extraction. What the actual original-owner run provesThe owner was attached through the existing Hosted routes, kept runtime generation 1 / writer generation 1 / activation epoch 1, executed one settled file turn (2 model requests, 1 retained main usage projection), and retired through freeze → cut → original-worker finalize → DRAINED version 4. Writer acquire stayed 1 → 1, and no additional execution prepare/start or model request occurred. Completed cached retry, a direct fresh status GET, and a new independent HTTP store client's complete returned the same saved result. The latter two complete 33-table image files were independently compared with the DRAINED image: objects and raw file bytes were identical. Later attach/text returned the closed-admission refusal. Original execution and usage rows, working bytes/device/inode, and retained backup pins stayed exact. Only the logical Runtime Session became RELEASED; binding and holder remained DRAINING and the slot remained occupied. The original native inspector's root FD 19 was associated with its real FileHandle; after finalization it returned EBADF and disappeared from the owned FD map. All 4 captured worker/backend native handles returned EBADF, with zero owned handles left. The separate fixture observation handle remained open until its own cleanup and was not counted as worker-owned. Evidence: The two ordinary Workspace methods failed before the intended tool-fault boundaries, at tool-sessions:acquire with 409 workspace_unavailable. The fault driver recorded faults=0; those tool fault cuts are not qualified. This run's read-only diagnostic established both session-authorization calls passed, but both sessions had zero storage aliases/owners and the physical-storage-key guard refused at LocalStorageOwners.key:76. The local macOS fixture had not registered that physical root. The relevant local-storage guard and Workspace authority/test sources match the frozen base; ManagedAgentStore itself is changed by this PR, so an all-source equivalence claim is not made. A complete base E2E/Linux control was not run. These remain two failures; no previous PR's attribution or private CSI qualification is substituted. Evidence: Scope and remaining acceptance limitsThe supported private path is a settled, live original runtime generation 1 / writer generation 1 / activation epoch 1. DRAINED grants no node evidence, physical stop, CSI unpublish, binding/holder RELEASED, reuse, recovered-owner retirement or public selector authority. The actual owner run uses declared local mount/proc-FD/placement facades over real files and handles; it does not establish native CSI deployment, packaged Main, OS-process death or Linux physical behavior. Ordinary Hosted/Workspace/process regression results do not grant private CSI death or cold-owner qualification. Unit promise/mount/HTTP mocks are only unit evidence; the actual Hosted route qualification above is reported separately. The original owner preserves parent-first same-Connection ordering. OTHER association validation retains late foreign-parent locks after bounded whole-table child scans; competing ordinary writers may deadlock/time out, roll back and require retry. Maintainer review and actual cross-tenant writer-race acceptance remain required. The repository formal review workflow was unavailable in this session; maintainer review is still pending. Local checks used macOS, Node 22.14.0, JDK 21 and Maven 3.9.16; Windows/Linux were not tested locally, and 33 CLI platform cases were skipped. Final handoff: all 90 source hashes and 17,697 product pins matched the frozen candidate; MJS and V12 source/target checksums matched. No owned candidate processes remained. The owned MySQL server exited, its four remaining databases were dropped, and its data/socket/credential directory was removed. Evidence is in Self-review records separate the two complete reads of the earlier 89-file extraction from later corrective-commit diff/consumer reads and the small fixture follow-ups. They do not claim two new complete 90-file PR reads or formal approval. Final source/product pin checks accompany the owned acceptance results. Preserved failures and convergence history
Owned local logs include E2E 与验证报告——原始 CSI 应用退役当前候选: 当前结果如下。0a03962→bbea488只修改MySQL测试fixture的两个元数据lookup键;独立比较全部17,697项产品pin,只有对应测试class不同,全部生产产品字节相同。0a通过结果继续保留其精确source归属。
最终Java178项是退役17+history3+库存63+native activation20+保留图31+锁序44,与更早历史178项选择不同。更早7bc等价源码的完整单测阶段报告4930项、0失败/error、18跳过,但其verify随后因一项格式门禁失败;没有在当前head重跑整套。source分支历史通过不能证明本提取合格。 实际原owner运行证明了什么通过既有Hosted路由完成最初attach,保持runtime generation1 / writer generation1 / activation epoch1,运行一个settled文件turn(2次模型请求、保留1行main真实用量投影),经freeze→cut→原worker finalize→DRAINED版本4。writer acquire保持1→1,无新增execution prepare/start或模型请求。完成owner的缓存重试、直接fresh status GET、新建独立HTTP store client的complete均返回相同已存结果。后两次完整33表镜像已独立与DRAINED原像比较,JSON对象和原文件字节全部相同。后续attach/text返回关闭接纳的拒绝。 原execution和usage行、工作文件字节/device/inode、保留backup pins精确不变。只释放逻辑Runtime Session;binding/holder保持DRAINING,slot继续占用。原native inspector的root FD19与真实FileHandle关联,finalize后stat为EBADF并从owned FD map消失。捕获的全部4个worker/backend native handle均为EBADF,owned handle剩余0。fixture独立观察句柄保持打开至自己的cleanup,不计作worker-owned。 证据: 两个普通Workspace方法均在预期tool-fault边界之前失败,初始tool-sessions:acquire返回409 workspace_unavailable,fault driver记录faults=0,不能算相应tool fault cuts通过。本轮只读诊断确认两次session authorization均通过,但两个session的storage alias/owner均为0,LocalStorageOwners.key:76物理storage key门禁拒绝,本地macOS fixture没有注册该物理root。相关local-storage guard、Workspace authority/测试源码与冻结基线相同,但本PR修改了ManagedAgentStore,不声称全部前置source等价。未运行完整base E2E/Linux对照,这两项仍保留失败,不用其它PR归因或私有CSI资格替代。证据: 范围与剩余验收边界支持的是已settled、仍存活的原始runtime generation1 / writer generation1 / activation epoch1私有路径。DRAINED不授予node evidence、物理stop、CSI unpublish、binding/holder RELEASED、复用、恢复owner退役或公开selector authority。实际owner运行使用已声明的本地mount/proc-FD/placement映射及真实文件/句柄,不证明native CSI部署、packaged Main、OS进程死亡或Linux物理行为。普通Hosted/Workspace/process回归结果不赋予私有CSI死亡/冷owner资格。单元Promise/mount/HTTP mock只证明单元行为,与上述实际Hosted路由验收分别报告。 原owner保留parent-first同Connection锁序。OTHER归属验证仍在有界全表子行扫描后取得foreign-parent锁;与普通writer竞争可能deadlock/timeout、回滚并需要重试。仍需维护者评审及实际跨tenant writer-race验收。本会话无法运行仓库正式review工作流,维护者评审仍待完成。本地使用macOS、Node22.14.0、JDK21、Maven3.9.16;未本地测试Windows/Linux,CLI有33项平台限定跳过。 最终交接:90项source hash与17,697项product pin均与冻结候选精确相同,MJS/V12 source-target校验和相同,无owned候选进程残留。owned MySQL已退出、剩余4个数据库已drop,data/socket/credential目录已删除。证据为 自审记录区分更早89文件提取的两遍完整阅读、之后修正提交的完整diff/实际消费者阅读及小fixture后续,不声称两遍新的完整90文件PR阅读或正式approval。最终source/product pin核对随owned验收结果保留。 保留的失败及收敛历史
本轮本地日志包括 |
|
Thanks for splitting this out of #13526 — extracting a settleable slice instead of landing the cumulative branch is the right call, and the design doc pair is genuinely readable. Template — complete ✓. All required sections present, both languages, Tested-on filled in honestly rather than optimistically. Problem — real, and not theoretical. I checked the premise rather than taking it on faith: on main, generic activation release and Runtime Session release do refuse the CSI lane, so there is no durable cut that SQL admission, native history and the worker's open descriptors all agree on. That is an observable gap in existing code, not a hypothesised one. The Direction — aligned with the managed-agent control plane, and the "original owner only, generation 1 / epoch 1, everything else refuses" framing is a disciplined way to bound a first slice. But this crosses three surfaces that are not ours to wave through: core session authority, the internal session-store contract, and the SQL schema. Escalating for maintainer architecture review, which the PR itself asks for. Size — core paths are touched (
The author has admin on this repo, so the Tier 1 large-refactor hard block does not apply, and the title is Approach — the two extractions are exactly what I would have done: Risk — no match against the revert-history high-risk paths. The elevated risk here is the one you flagged yourself: the foreign-parent lock ordering taken after bounded whole-table child scans, and the unverified cross-tenant races. That is a maintainer architecture question, not something a static pass can settle. Moving on to code review. 🔍 中文说明感谢把这部分从 #13526 拆出来——提取一个可独立结算的切片,而不是直接合并累计分支,这个方向是对的,双语文档也确实可读。 模板 — 完整 ✓。必需章节齐全,中英双语,Tested-on 如实填写。 问题 — 真实存在,不是理论性加固。我核实了前提而没有直接采信:在 main 上,通用 activation 释放与 Runtime Session 释放确实拒绝 CSI 通道,因此 SQL 接纳、native history 与 worker 打开的描述符之间没有共同认可的持久切点。这是现有代码中可观测的缺口,不是假设。 方向 — 与 managed-agent 控制面一致,"仅原 owner、generation 1 / epoch 1、其余一律拒绝"的界定方式很有纪律。但本变更跨越三个不能由 gate 单独放行的面:core session authority、internal session-store 契约、SQL schema。现转交维护者做架构评审,这也是 PR 自身提出的请求。 规模 — 触及核心路径(
作者在本仓库具有 admin 权限,因此 Tier 1 大型 refactor 硬阻断不适用;标题为 方案 — 两处提取正是我会采用的做法: 风险 — 未命中回滚历史中的高风险路径。此处真正的风险是你自己指出的那一项:有界全表子行扫描之后取得 foreign parent 锁的锁顺序,以及尚未验证的跨 tenant 竞争。这属于维护者的架构问题,静态评审无法定论。 进入代码审查 🔍 — Qwen Code · qwen3.8-max-2026-09-02 Reviewed at |
Code reviewI read the production diff against main and verified the things that are cheap to get wrong rather than assuming them. What holds up:
What I would want answered before merge — these are questions, not blockers, and in each case the fail-closed reading may well be the intended one:
The foreign-parent lock ordering you flagged is the one thing I would not attempt to settle from a static read. I confirmed the intended parent-first order is actually wired ( sequenceDiagram
participant P1 as Hosted owner retire route
participant P2 as Local session authority
participant P3 as HTTP store client
participant P4 as Application store
participant P5 as SQL ma_operation
participant P6 as Original worker
P1->>P1: latch admission, stop renewal, join admitted tasks
P1->>P2: prepareOriginalCsiRelease
P2-->>P1: staged release records, not appended locally
P1->>P3: joinWriter then prepare(records)
P3-->>P1: commit body bytes and prepared digest
P1->>P4: complete(retirementId)
P4->>P5: status read, stage SETTLING version 1
P4->>P5: freeze, stage FROZEN version 2
P4->>P5: cut, stage CUT version 3, seal head
P4->>P6: finalize RPC outside the SQL transaction
P6-->>P4: exact cleanup facts, descriptors closed
P4->>P5: stage DRAINED version 4, release logical Runtime Session
P4-->>P1: status DRAINED
Files changed (20 of 90 shown)
TestingThere is no test verdict for the code under review. Stating that plainly, because it is the most decision-relevant fact in this pass:
So no automated result and no author-reported result currently covers the head's production bytes. Everything in the PR description's Evidence section is the author's own local macOS claim about earlier commits — I am attributing it as that, not adopting it as verification, and per the module's rules H2 and labelled mock seams do not establish MySQL or process-recovery behaviour in any case. Also load-bearing and to the author's credit for stating it: the description reports that the happy path reached DRAINED v4, but "the separate fresh persisted-status SQL retry currently refuses and is being diagnosed". Exact retry after a lost reply is one of the acceptance criteria in the design doc, so a required item is currently failing by the author's own account. Not verified, and why: build / typecheck / lint / unit tests (CI cancelled then superseded on the head); Windows and Linux (author states untested, 33 platform-specific checks skipped locally); cross-tenant races and the full process/fault profiles (author states pending); MySQL acceptance on the head (the described run predates CI results for
One row per check name (latest run); skipped checks omitted; failures sort first. / 每个检查名一行(取最新一次运行),省略 skipped,失败项排在最前。 Sandboxed verification would settle this: 中文说明代码审查 我对照 main 阅读了生产代码 diff,并对容易出错的地方做了核实而不是默认采信。站得住的部分:
合并前我希望得到回答的问题——这些是提问而非阻断项,且每一项按 fail-closed 理解都可能正是设计意图:
你自己指出的 foreign parent 锁顺序,是我不会尝试用静态阅读下结论的一项。我确认了预期的 parent-first 顺序确实已接线( 测试 本次评审的代码没有任何测试结论。 直说这一点,因为它是本轮最具决策相关性的事实:
因此,目前没有任何自动化结果或作者报告的结果覆盖 head 的生产字节。PR 描述 Evidence 一节的全部内容都是作者本人在 macOS 上对更早 commit 的声明——我按此归属,不将其当作验证采信;并且按照本模块的规则,H2 与已标注的 mock seam 本来也不能证明 MySQL 或进程恢复行为。 同样关键、也应归功于作者如实写明:描述称happy path 已到达 DRAINED v4,但"独立重新读取持久状态的 SQL 重试目前仍拒绝,正在定位"。丢失响应后的精确重试是设计文档中的验收标准之一,因此按作者自己的说明,一项必需验收项目前是失败的。 未验证项及原因:build / typecheck / lint / 单测(head 上 CI 先被取消后被取代);Windows 与 Linux(作者说明未测试,本机跳过 33 项平台限定用例);跨 tenant 竞争与完整 process/fault profile(作者说明待完成);head 上的 MySQL 验收(所述运行早于 沙箱验证可以定论这一点: — Qwen Code · qwen3.8-max-2026-09-02 Reviewed at |
|
Confidence: 3/5 — the parts I could verify are disciplined and several are better than what they replace, but a core change of this size escalates to a maintainer by policy, and right now no evidence of any kind covers the head's production code. Stepping back from the stage-by-stage detail: this does not read like volume for its own sake. My independent proposal before opening the diff was that retirement would need to reuse the ordinary commit-body builder rather than grow a second encoder, and that the holder-revision arithmetic should become a named state machine instead of Where I would have gone differently is the inventory. I would have tried to derive the 32-table / 736-column catalogue from the schema baseline rather than maintain it by hand beside it, because the failure mode of a hand-maintained parallel declaration is that it is correct on the day it is written and slowly stops being correct. Having read the drift check, I no longer think this is a correctness risk — What stops me approving is not a code defect. It is that I cannot currently point at any evidence for the commit under review:
The three fail-closed questions from Stage 2 (the append-only So: deferring rather than approving or rejecting. This is a Stage 0 escalation — 8,918 production lines across core session authority, the internal session-store contract and a schema migration, which is past the point where "the direction looks correct" is a sufficient standard, and the PR asks for maintainer architecture review in its own Risk & Scope section. The foreign-parent lock ordering and the unverified cross-tenant races need a human who owns that concurrency model, and the acceptance gap above needs to be closed on the actual head with CI green on it. I could not resolve an accountable owner deterministically — 中文说明Confidence: 3/5 — 我能核实的部分都很扎实,其中几处比被替换的代码更好;但这种规模的核心变更按策略必须升级给维护者,而且目前没有任何证据覆盖 head 的生产代码。 从逐阶段细节中抽身来看:这不是为了堆量而堆量。我在打开 diff 之前的独立判断是——退役路径需要复用普通的 commit-body 构建器,而不是再长出第二个编码器;holder revision 的运算应该成为一个具名状态机,而不是 SQL 字符串里的 我会采取不同做法的地方是 inventory。我会尝试从 schema 基线推导出 32 表 / 736 列的 catalogue,而不是在其旁边手工维护一份,因为手工维护的平行声明,其失效模式是:写下当天是正确的,然后慢慢变得不正确。读过漂移检查之后,我不再认为这是正确性风险—— 阻止我批准的并不是代码缺陷,而是我目前无法为被评审的 commit 指出任何证据:
Stage 2 中那三个 fail-closed 问题(只增不减、可能让健康会话永久无法 drain 的 因此:选择 defer,既不批准也不驳回。这是一次 Stage 0 升级——8,918 行生产代码跨越 core session authority、internal session-store 契约与一次 schema 迁移,已经超出"方向看起来正确"足以作为标准的范围,而且 PR 在自己的 Risk & Scope 一节中就请求维护者做架构评审。foreign parent 锁顺序与未验证的跨 tenant 竞争,需要由拥有该并发模型的人来判断;上述验收缺口需要在真正的 head 上、并且 CI 为绿的前提下补齐。 我无法确定性地解析出责任人—— — Qwen Code · qwen3.8-max-2026-09-02 Reviewed at |
yiliang114
left a comment
There was a problem hiding this comment.
Review — original CSI application retirement @ bbea488
Reviewed the durable authority path rather than the whole 90-file surface: V12 + projections, the SETTLING→FROZEN→CUT→DRAINED transitions, the three new Session-Store endpoints, the host-side barrier/latch ordering, and the worker finalize protocol. No locally executed tests: at bbea488 the PR workflows are still queued (Serve A/B, Build and verify reference distribution, OpenTUI no-flicker gate), so this verdict rests on source only.
What I checked and found consistent:
- Migration shape. V12 lands after main's published V11 and only adds the eleven
ma_operationcolumns plus a generatedCHAR(64)target key; the unique index is scoped by that generated column, so non-CSI_RETIREMENTrows keep multiple NULLs.ManagedSchemaProjection.OPERATIONcarries every new column, and the migration is registered as version 12 after 11. - Begin is atomic with the seal.
WorkspaceCsiReservationStore.beginRetirementwritesprogress_format/version/stageand the checkedstartedAt + 300000deadline in the same transaction as the binding seal and theRESERVED → DRAININGholder move, and the update is guarded on all four progress columns being NULL — a retry cannot reset the deadline. - Deadline authority.
JdbcCsiApplicationProgress.requireCurrentTime/JdbcCsiApplicationRetirement.requireCurrentTimeread database time under the already-held locks and use strict<, so equality with expiry is expired; the ceiling and the deadline are re-derived from the immutable operation identity rather than trusted from the row. - Credential boundaries.
workerAuthorityrequires the presented bearer to equal both the provision-seed token and the lease token; with a seed presentJdbcRuntimeBindingRepository.mapLeaseuses the seed token, so that conjunction is satisfiable only for the original owner. The writer-facingstatus/commandpaths go throughrequireCsiApplicationCredential, which re-validates tenant/workspace/session, the head lease-token hash and the original writer generation on the same connection. The new broker route also pins tenant, content type,no-storeand a 16 KiB body bound before dispatch. - Transition integrity. Each stage update is a CAS on
(stage, version, digest, NULL payload)and is followed by a full-image verification againstbaseline + terminal delta;cutinserts the terminal suffix before flippingma_session_headtoSEALED, andfinalizepersists the receipt before releasing the logical Runtime Session and flipping toDRAINED. A failed subsequent step rolls the whole transaction back, leaving a retryable stage rather than a half-applied one. - Barrier ordering on the host. The retire route latches before any
await, stops the renewal timer, joins the admitted task set and the raw in-flight activation renewal, then joins the writer before touchingstopLocal— which is the ordering the design requires for the in-flight grant to still validate. - Journal isolation.
requireCsiJournalIsolationblocks private CREATE/request resolution and retirement when an event transport is installed, on both the store and the native-session side.
Non-blocking notes:
WorkspaceCsiApplicationStore.lockcallsUUID.fromString(retirementId)directly, so a malformed id fromstatus/commandescapes as a bareIllegalArgumentExceptioninstead of the module's typed 4xx (csi_request_invalid). Cheap to route through the same validation used elsewhere.- The three new handlers take
@RequestBody byte[], which Spring reads in full beforeWorkspaceCsiApplicationJson.object(...)applies the 192 KiB / 16 KiB bounds. Fine for an internal listener, but the bound is currently a post-read check rather than a transport guarantee. status()runs the full typed inventory scan (up to 4096 rows / 32 MiB, withFOR UPDATEacross the catalogue) on every poll, including read-only status reads.RuntimeBrokerHttpServer.registerCsiApplicationAuthorityadds oneHttpServercontext per session and the JDK server has no context-removal API. Harmless if the broker is per-session; a slow leak if one broker serves many sessions over its lifetime.
Approving on the code as reviewed. This is not a qualification of the paths the PR itself leaves open — the foreign-owner late-lock ordering, cross-tenant races, private process-death acceptance and the Linux run — and the two failing ordinary Workspace cases at bbea488 remain failures, not covered by this review.
qqqys
left a comment
There was a problem hiding this comment.
COMMENT — no blocking defect found, and no prior blocking finding exists to re-verify. This is not an approval: at +14,244/-568 over 90 files, with roughly 6,000 lines of production code and every code-executing CI lane still pending, the code-review gates for a change of this scope could not be completed inside this pass's budget. The unconfirmed gates are listed explicitly at the end so the next pass can start from them.
No historical blocking findings
This PR has one review, an approval at this head, and no automated review ledger, no inline review threads and no finding history. There is therefore nothing carried forward to re-verify, and the approval already on the PR is that reviewer's evidence rather than mine.
What I did verify at this head
I spent the budget on the surfaces where a defect would be irreversible or cross a trust boundary, rather than sampling broadly.
The new retirement endpoint authenticates every destructive action. WorkspaceCsiApplicationController is registered only under @ConditionalOnProperty for both session-store.enabled and runtime-broker.enabled, sits on the internal /internal/managed-session-store/v1/sessions/{sessionId} surface, and constrains the mutating action by path pattern to freeze|cut|finalize, so the action set is closed at the mapping rather than by a runtime string check. The controller forwards the writer-token header rather than trusting it, and WorkspaceCsiApplicationStore verifies it on every path: status, freeze, cut and finalizeApplication each call nativeStore.requireCsiApplicationCredential(target, locked.authority(), token) after taking the row lock and before acting, and each follows it with verifySaved(locked). The bearer route (workerAuthority) compares with MessageDigest.isEqual against both the provision-seed token and the lease token and answers 401 when neither matches, so the comparison is constant-time and the two-credential acceptance is explicit rather than incidental. Its Authorization header is shape-validated (length() <= 519, Bearer [A-Za-z0-9._~+/-]{1,512}=*) before substring(7). Mutating paths also re-verify the persisted image through WorkspaceCsiApplicationImage.verify(...) after writing, and the inventory lookup is tenant-scoped (operation_kind = 'CSI_RETIREMENT' AND tenant_id = ? AND operation_id = ?). Connection work is time-bounded through bounded(connection, started) / remaining(started).
The migration is additive, and its uniqueness gate is green against main. V12__csi_application_retirement.sql only adds ten nullable columns to ma_operation, one generated column and one unique constraint — no drop, no rewrite, no backfill, so it cannot destroy existing rows. The generated column is the right device for the constraint: csi_retirement_target_key is NULL unless operation_kind = 'CSI_RETIREMENT', and because a MySQL unique index permits multiple NULLs, uq_ma_csi_retirement_target (csi_retirement_target_key, target_revision) constrains only retirement operations. Flyway migration version uniqueness (latest main) passes, which is the check that matters for a version collision with another open PR; the fast-tier copy of that lane is still pending.
The seal fails closed on state and identity. JdbcCsiRetirementSeal uses locking reads throughout (SELECT ... FOR UPDATE, with setQueryTimeout(10) on requireOpen), always keyed by target_key, target_revision and tenant_id, and throws 409 csi_retirement_identity_unavailable when the retirement row is absent. lock binds the operation row to the binding state in both directions — no row requires state == READY && !draining(), a row requires state == DRAINING && draining() — and requires that there is no second row. readHistorical bounds the frozen payload to (0, 32 MiB], pins progress_format to qwen-csi-application-retirement/1 with progress_version == 4 and progress_stage == "DRAINED", and then requires the stored frozen bytes to be byte-equal to the caller's and their SHA-256 to equal the stored digest, plus a format/retirementId/bindingId/requestKey match on the frozen document. So a stale, substituted or partially written frozen request cannot be accepted.
Why this is not an approval
The instruction this pass operates under requires an approval to rest on completed code-review gates, and for a change of this size the gates are not completable in the budget. Two things are missing, and neither is a claim that something is wrong:
Coverage. I read the whole of WorkspaceCsiApplicationController.java, V12__csi_application_retirement.sql, JdbcCsiRetirementSeal.java's locking and identity predicates, and WorkspaceCsiApplicationStore.java's credential-verification structure. That is a small fraction of the production surface. Not read at all: WorkspaceCsiApplicationInventory.java (+3,439, the single largest new file), the JdbcCsiActivationAdmission.java rewrite (+309/-146, which changes an admission gate this PR's own recovery paths depend on), JdbcCsiExecutionAdmission.java (+170/-58), WorkspaceCsiReservationStore.java (+147/-39), JdbcCsiApplicationProgress.java and JdbcCsiApplicationRetirement.java (+154 and +183, new), CsiFileFinalizeProtocol.java and its TypeScript counterpart managed-csi-file-finalize-protocol.ts (+127 and +175, a new two-language wire protocol whose two sides I have not compared term by term), WorkspaceCsiApplicationHistory.java / ...Image.java / ...Json.java / ...WorkerMatch.java, CsiOwnershipRevision.java, CsiNativeActivationProof.java (+138/-3), CsiNativeToolReservation.java (+82/-11), ManagedSessionStore.java (+161/-10), and on the TypeScript side http-managed-session-store.ts (+307/-77) and managed-session-authority.ts (+129/-40) — both in packages/core, so both are shared by surfaces outside this feature — plus managed-csi-file-worker.ts (+210/-10), managed-runtime-tool-executor.ts (+145/-1), hosted-csi-session.ts (+127/-9) and the finalize/envelope/mount/root-directory modules. With that much unread, I cannot name the downstream consumers of the changed core store and authority APIs, which is the bar this repository's own review policy sets for core-module changes; a feat of this size is an escalation for maintainer awareness rather than something to wave through, and the 1,000-line advisory is exceeded by an order of magnitude.
Execution evidence. Eleven lanes are still pending, including Test (ubuntu-latest, Node 22.x), Lint & Static, Build and verify reference distribution, Serve A/B, Integration Tests (no-AK, No Sandbox) and SDK Java (fast) / ubuntu-latest / Java 21. Nothing has yet executed this diff's TypeScript or Java. There are no failures, and pending lanes are not treated as a gate — but there is also no green run to corroborate a 14k-line change, and the extensive MySQL integration coverage this PR adds (WorkspaceCsiApplicationInventoryMySqlIT, WorkspaceCsiRetainedArtifactsMySqlIT, the extended WorkspaceCsiSqlWorkerMySqlIT and SessionRowLockOrderTest at +292/-34) is not executed by the fast tier at all.
No Critical is asserted anywhere in this review. Everything I read was consistent and carefully fenced, and I found nothing I could prove defective at this head.
Suggested next step
The useful next gate is a pass over the two highest-leverage unread items rather than another broad sweep: the JdbcCsiActivationAdmission rewrite, because it changes an admission gate that the already-merged cold-recovery paths call into, and the finalize protocol's two language implementations side by side, because a divergence there would only surface at runtime on the retirement path. Landing this after the pending lanes report would also let a reviewer treat a green Test and SDK Java lane as corroboration rather than reading 6,000 lines cold.
中文说明
未发现阻塞性缺陷,也没有需要复核的历史阻塞问题:本 PR 只有一份针对当前提交的批准,没有自动评审记录、行内线程或历史问题。本轮不提交批准,原因不是发现了问题,而是门禁无法在预算内完成:改动为一万四千余行、九十个文件,生产代码约六千行,且所有会执行代码的检查通道仍在运行。
已核对的部分集中在不可逆或跨信任边界的位置。新的退役接口对每个破坏性动作都校验凭据:控制器仅在两个开关同时启用时注册,动作由路径模式限定为冻结、切断与终结三类,写入令牌由存储层在取得行锁后逐路径校验,持有者令牌路由使用恒定时间比较并在两种凭据都不匹配时返回 401,请求头在截取前先做形态校验,写入后还会重新校验持久化镜像,清单查询按租户限定,连接工作有时间预算。数据库迁移是纯增量的:只新增可空列、一个生成列和一个唯一约束,没有删除或改写;生成列在非退役操作时为 NULL,因此唯一约束只作用于退役行;针对最新主干的迁移版本唯一性检查已通过。封印逻辑在状态与身份上都失败即拒绝:全部使用带租户条件的加锁读,操作行与绑定状态双向绑定,历史读取要求格式、版本与阶段固定,并要求冻结字节与调用方逐字节相等且摘要匹配。
未覆盖的部分是本轮不能批准的主要原因:最大的新增清单类、准入逻辑的大幅重写、执行准入、预约存储、进度与退役两个新类、跨语言的新终结协议两侧、历史与镜像等辅助类,以及核心包中的会话存储与授权模块和多个前端服务文件均未阅读。核心包的两个文件被本功能之外的表面共用,在阅读量不足的情况下无法列全其下游调用方,而这是本仓库对核心模块改动设定的门槛;此规模的新增也远超一千行的提示阈值,属于需要维护者知悉的升级情形。此外十一项检查仍在运行,尚无任何执行过本改动的绿色结果,而本 PR 新增的大量 MySQL 集成测试并不由快速通道执行。
建议的下一步不是再做一次宽泛扫描,而是优先阅读两处影响最大的未读内容:准入逻辑的重写,因为它改动了已合并的冷恢复路径所依赖的准入关卡;以及终结协议的两种语言实现并排比对,因为该处的不一致只会在退役路径运行时暴露。若能在待运行通道出结果后再评审,也可以把绿色的单元测试与 Java 通道作为佐证,而不必冷读六千行。
chiga0
left a comment
There was a problem hiding this comment.
APPROVE — no blockers. All non-blocking notes below.
What was checked
V12 migration (V12__csi_application_retirement.sql): 11 additive ALTER TABLE columns on ma_operation, then one generated CHAR(64) column feeding a unique constraint scoped to CSI_RETIREMENT rows. Version ordering is correct (V11 precedes V12); generated column expression confines the unique index to retirement operations only, so existing non-retirement rows are unaffected.
State machine (SETTLING → FROZEN → CUT → DRAINED): JdbcCsiApplicationRetirement.Authority enforces stage-gated payload rules — frozen bytes required in FROZEN/CUT/DRAINED, cut bytes required in CUT/DRAINED, finalize bytes required in DRAINED, all absent otherwise. requireCurrentTime() reads DB wall-clock under the lock and throws if past deadline. CAS stage updates use WHERE progress_stage = <current> to guard concurrent transitions. The deadline derivation (startedAt + 300_000) matches the lock() expectation.
prepareOriginalCsiRelease() in managed-session-authority.ts: correctly gates runSerial() and close() once retirementPreparation is set. Validates epoch === 1, phase === 'active', compactedThrough === 0, createdBy === 'hosted-harness' before committing. Publishes managed-activation-boundary then constructs the activation.changed event with phase: 'released'.
Retire route in hosted-csi-session.ts: active(owner) is called before clearInterval(owner.timer), so the already-retired guard runs first. owner.failures fail-closed is consistent with the stated design intent ("reject unsupported or uncertain evidence before repair").
Worker finalize protocol (boot v6) in managed-csi-file-worker.ts: preCut/finalization latches on observe/cut respectively; retried requests with matching bodies reuse the cached value — idempotent. Descriptor closure is verified before building DRAINED bytes.
joinOriginalCsiWriter() in http-managed-session-store.ts: called only after await Promise.allSettled(admitted) in the retire route, so acquirePromise/pendingAppend should be clear at invocation time.
Non-blocking notes
NB-1 (http-managed-session-store.ts, joinOriginalCsiWriter()): this.stopRenewal() fires before the acquirePromise || pendingAppend guard. On the corrupt/rejected path retirementJoin is not set, so a subsequent call re-enters the function and calls stopRenewal() again — but renewal is already stopped and retirementJoin stays unset. If the caller retries after the guard fails, the session is racing lease expiry with no way to restart the renewal timer. In practice the caller awaits all admitted tasks before calling joinWriter(), so the guard should always pass; this is an integrity check for an impossible state. Moving the guard above stopRenewal() would be safer but is not a blocker.
NB-2 (managed-session-authority.ts, prepareOriginalCsiRelease()): retirementPreparation is assigned before the async work resolves. If the inner async block throws (e.g. network error publishing managed-activation-boundary), retirementPreparation stays set as a rejected-but-cached promise, permanently preventing runSerial() and close() from succeeding on this instance. The HTTP retry path works at the session level (retirementResult is cleared on rejection), but the authority object is bricked. Per the stated design intent this is intentional (retirement is a one-way door); calling it out for documentation.
NB-3 (echoing yiliang114): bare new IllegalArgumentException() without a message string on the malformed-retirement-ID path in JdbcCsiApplicationRetirement.lock() makes the log entry diagnosis-hostile.
NB-4 (echoing yiliang114): full WorkspaceCsiApplicationInventory scan on every status poll — cost scales with table/column count (currently 32 tables, 736 columns). Fine now; worth noting if the catalogue grows.
NB-5 (echoing yiliang114): HttpServer context created per session in hosted-csi-session.ts without an explicit stop() call on the retirement path. Verify teardown is covered by the outer container lifecycle.
🩺 serve daemon A/BBuilt the PR base vs this PR head
|
| field | PR base (before) | this PR (after) |
|---|---|---|
activeWorkStaleMs |
6 |
5 |
— Qwen Code · serve A/B
bbea488 to
67c8b92
Compare
|
Rebased the original CSI application retirement branch from
Validation on the resulting source tree:
Fresh CI evidence and review against the updated head are still needed. Hourly incremental babysitting remains active until the PR is merged or closed. 中文:已解决与主干冷恢复改动的冲突,保留恢复、退役和历史读取的各自约束。构建、类型检查、相关 TypeScript 测试、Java 单元测试和静态检查已有通过证据;MySQL 的 102 个场景通过初次运行及单项重跑得到验证。初次 CLI 并发测试的一次超时未能复现,原因仍未确认。新提交仍需 CI 和针对新 head 的评审,每小时检查继续运行。 |
yiliang114
left a comment
There was a problem hiding this comment.
Re-review at 67c8b920 — delta from bbea488
My earlier approval (5571290094) was dismissed when the head moved, so this is a fresh verdict on the new head. I reviewed the delta rather than re-reading the whole 90-file surface.
The delta is a rebase onto fdb51f89 (which now carries #14695 cold recovery, #14691 held-Runtime inventory, #14634 credential bootstrap and #14292 artifacts) plus one branch fix, 67c8b920, restoring the cold-recovery complete(...) overload in CsiNativeToolReservation. A tree diff between bbea488 and 67c8b920 shows only 11 of the PR's 90 files changed; ten of those change only by main's code, and the retirement-specific blobs (V12, the reservation/inventory identity checks, the host retire route, registerCsiApplicationAuthority) are byte-identical to the head I approved.
What I re-verified at this head:
- The rebase did not drop the branch side.
hosted-csi-session.tsstill has the retire route at line 602 with the latch → join → prepare/complete ordering;RuntimeBrokerHttpServer.registerCsiApplicationAuthorityis still registered;JdbcCsiActivationAdmissionkeeps the application-retirement entry points next to main's newrequireRecoveryTail/verifyColdFinalOutput. - The overload chain is unambiguous and keeps both semantics.
(Map)→(Map, seq, rev)→(Map, recovery=false, seq, rev)→ the private eight-argument form;(Map, recovery)→(Map, recovery, 0, 0);(Map, seq, rev, JournalRead)→recovery=falsewith that reader. Cold paths reachreceiptMembers(..., true, 0, 0)and keep the 8 MiB byte budget;verifyHistoricalReceiptskeeps its explicitJournalReadwithrecovery=false. - V12 is still the right slot. Base
fdb51f89carries V1–V11, and the migration adds V12 with the same eleven additive columns and generated-target unique key, so the version lane does not collide after the rebase.
Non-blocking:
- The PR body still calls
bbea488the current head and its evidence section predates this rebase. The two production fixes now sit in the final commits and the cold-recovery overload restoration is not described, so worth refreshing to keep the reviewer test plan aligned with the bytes being merged. - chiga0's two NB threads (
stopRenewal()before the integrity guard; cached rejectedretirementPreparation) are answered with the retirement-fence rationale. I agree with declining both. - Every code-executing lane is queued at review time. Not a finding.
Approving on the code. This remains no qualification of the paths the PR itself leaves open: foreign-owner late-lock ordering, cross-tenant races, private process-death acceptance and the Linux run.
qqqys
left a comment
There was a problem hiding this comment.
COMMENT — re-reviewed at head 67c8b92089e3a94ad80751b0b36ff58c115fec82, which supersedes my review of bbea4887. No blocking defect found and no prior blocking finding exists, but this is not an approval: the head moved by a rebase plus five commits I have not read, every CI lane is pending so nothing has executed this diff, and the production surface remains far larger than a bounded pass can cover.
What changed since the last review
The branch diverged from bbea4887 (ahead 20 / behind 6) and was rebased onto a newer main that now includes the completed private CSI cold recovery this feature builds on, plus cc2de634 (bounding the held-Runtime inventory read). On top of the rebased feature commit there are five new commits whose content I did not read:
043bacd6 fix(runtime): compare CSI retirement handle valuesbe64a644 fix(runtime): qualify retained CSI handle identities across mappers67c8b920 fix(runtime): retain cold recovery receipt overloadc5d45705 test(runtime): retain native mount lifecycle in CSI fixture7b326851 test(runtime): preserve MySQL inventory column constraints
Three of those are production fixes to identity comparison and overload retention, which is precisely the area a reviewer would want to read rather than infer. The measured diff at this head is 90 files, +14,202/-564: production Java is 39 files at +7,160/-324, test Java 22 files at +3,600/-64, and non-Java 29 files at +3,442/-176 (which includes the packages/core and packages/cli TypeScript). The totals moved only slightly from the previous head, so the scope conclusion is unchanged.
The four surfaces I verified before still hold at this head
I re-checked each rather than carrying the claims forward:
- The retirement endpoint still authenticates every destructive path.
WorkspaceCsiApplicationControllerkeeps the action set closed at the mapping (freeze|cut|finalize), still takes identity fromTenantContextand the writer token from the header, and still shape-validates the bearer route'sAuthorizationvalue.WorkspaceCsiApplicationStorecallsrequireCsiApplicationCredentialat all six sites and still compares both accepted credentials withMessageDigest.isEqual, so the comparison stays constant-time. - The migration is still purely additive.
V12__csi_application_retirement.sqlhas 12ADD COLUMN/ADD CONSTRAINTstatements and zero occurrences ofDROP,DELETE,TRUNCATEorMODIFY, so it cannot destroy existing rows; the generated column keepsuq_ma_csi_retirement_targetscoped toCSI_RETIREMENToperations only. - The seal still uses locking reads.
JdbcCsiRetirementSealretains threeFOR UPDATEreads, all keyed bytarget_key,target_revisionandtenant_id.
One hazard this PR does not have, stated explicitly
Both this PR and the concurrent package reorganization touch runtimebroker, so it is worth recording the distinction rather than leaving it to inference. This PR does not move ManagedHoldFamily: at this head the class is still package com.alibaba.qwen.code.runtimebroker; with ofDispatchMode(Object) package-private at :44 and its only caller at :41 inside the same class. main's new call site in JdbcToolExecutionRepository:851 is also in runtimebroker, so it stays same-package and compiles. The cross-package visibility collision is a property of the reorganization PR, not of this one.
This PR's only change to that file is a one-line retyping inside a private record — JdbcCsiReadyAdmission.Admission progress becomes JdbcCsiApplicationProgress.Continuation progress — consistent with the JdbcCsiApplicationProgress class it adds. That is benign on its face, but whether the merged tree compiles is exactly what the pending Java lane will establish, and I have not established it.
Gates not completed
- No execution evidence at all. Every lane is pending at this head — 0 pass, 0 fail, 11 pending — including
Build and verify reference distributionandSDK Java (fast) / ubuntu-latest / Java 21, the two that would compile this diff. Pending lanes are not treated as a gate, but for a change of this size the absence of any green run means the verdict rests entirely on reading. - Coverage. Unread at this head:
WorkspaceCsiApplicationInventory.java(+3,439, still the largest new file), theJdbcCsiActivationAdmission.javarewrite (+309/-146) that changes an admission gate the now-merged cold-recovery paths call into,JdbcCsiExecutionAdmission.java(+170/-58),JdbcCsiApplicationProgress.javaandJdbcCsiApplicationRetirement.java(new), the two-language finalize protocol (CsiFileFinalizeProtocol.java+managed-csi-file-finalize-protocol.ts),WorkspaceCsiReservationStore.java,ManagedSessionStore.java(+161/-10),CsiNativeActivationProof.java(+130/-2), and on the TypeScript sidehttp-managed-session-store.tsandmanaged-session-authority.ts— both inpackages/coreand both shared by surfaces outside this feature. I cannot name every downstream consumer of those two, which is the bar this repository's review policy sets for core-module changes; at this size the policy's escalation for maintainer awareness applies, and the earlier open question about whether the design wants maintainer sign-off before rather than after a rebase is still unresolved and is not mine to settle. - Spring wiring. I did not confirm that every stereotype-annotated class remains under the component-scan root, nor that
runtimebrokerstays Spring-free. A moved annotation fails at runtime, not at compile time, so no lane would catch it early.
No Critical is asserted anywhere in this review.
Suggested next step
The cheapest path to a reviewable state is to let the pending lanes finish — a green Build and verify reference distribution and SDK Java lane would establish that the rebased tree compiles against current main, which is the one fact this pass could not check — and then have the next pass read the five new commits and the two packages/core files rather than re-sweeping the whole feature.
中文说明
本轮针对新的提交重新评审,取代上一次结论。未发现阻塞性缺陷,也没有需要复核的历史阻塞问题,但仍不予批准,理由有三:本次 head 由变基加上五个我未阅读的新提交构成;所有检查通道都在运行中,尚无任何通道执行过这份改动;生产代码规模仍远超一次有预算限制的评审所能覆盖的范围。
与上一版相比,分支已变基到更新的主干——其中包含本功能所依赖的私有序列冷恢复,以及一处持有清单读取成本的收敛——并在特性提交之上新增五个提交,其中三个是对身份比较与重载保留的生产修复,恰好属于应当阅读而非推断的部分。按当前 head 实测:共 90 个文件、新增 14202 行删除 564 行,其中生产 Java 为 39 个文件新增 7160 行,测试 Java 为 22 个文件,非 Java 为 29 个文件(含核心包与 CLI 的 TypeScript 改动)。总量与上一版相差不大,规模结论不变。
上一轮核对过的四个面在本轮已逐项重新确认,而非沿用旧结论:退役接口仍在每个破坏性路径上校验凭据,动作集合仍由路由模式限定为三种,两个可用凭据仍使用恒定时间比较;数据库迁移仍是纯增量,十二条新增语句、零条删除或修改语句,生成列使唯一约束只作用于退役操作;封印逻辑仍保留三处带租户条件的加锁读。
有一点值得明确记录,因为同期另有一个包重组改动也涉及同一包:本 PR 并未移动 ManagedHoldFamily,该类在当前提交上仍属原包,其包内可见方法的唯一调用点也在同类之内;主干新增的调用方同样位于该包,因此仍是同包调用、可以编译。跨包可见性冲突属于那个重组改动,不属于本 PR。本 PR 对该文件的唯一改动是私有记录中一行的类型替换,表面上无害,但合并后能否编译正取决于仍在运行的 Java 通道,我尚未确认。
未完成的门禁:所有通道均在运行,没有任何绿色结果,因此结论完全依赖阅读;最大的新增清单类、准入逻辑的大幅重写、执行准入、两个新进度与退役类、跨语言终结协议、预约存储,以及核心包中被本功能之外表面共用的两个 TypeScript 文件均未阅读,因此无法列全其下游调用方,而这正是本仓库对核心模块改动设定的门槛,此规模也适用需要维护者知悉的升级情形;此外未确认带构造型注解的类在移动后是否仍位于组件扫描根内,此类问题在运行时才暴露。本轮未断言任何严重问题。
建议的下一步是先让仍在运行的通道跑完——构建与 Java 通道转绿即可确认变基后的代码树能与当前主干一起编译,这正是本轮唯一无法核对的事实——随后由下一轮优先阅读那五个新提交与核心包的两个文件,而不必重扫整个特性。
|
Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. 中文请勿对活跃的 PR 执行 rebase 或 force-push,因为这会使已有的评审评论失效。另外,供日后参考:作为集成流程的一部分,机器人始终会自动将所有改动压缩(squash)为单个提交。 |
chiga0
left a comment
There was a problem hiding this comment.
COMMENT — no confirmed/supported blocker found in the surfaces I read. Approval withheld: WorkspaceCsiApplicationInventory.java (+3 439 lines, not read) and JdbcCsiActivationAdmission.java (+309/−146, not read) are material production files for a Deep-tier review and remain an open coverage gap. yiliang114 has already approved at this head after a focused delta review.
Scope — what I read in this pass
Read in full: V12__csi_application_retirement.sql · JdbcCsiApplicationProgress.java · JdbcCsiApplicationRetirement.java · JdbcCsiRetirementSeal.java · CsiFileFinalizeProtocol.java · WorkspaceCsiApplicationStore.java · WorkspaceCsiApplicationController.java · managed-csi-file-finalize-protocol.ts
Read via diff (all added hunks): http-managed-session-store.ts (+307/−77) · managed-session-authority.ts (+129/−40) · managed-csi-file-worker.ts (+210/−10) · hosted-csi-session.ts (+127/−9)
Scanned (grep/excerpt only): WorkspaceCsiApplicationInventory.java (INSERT pattern and stage constants) · WorkspaceCsiApplicationStore.java stage-transition UPDATEs
Not read: WorkspaceCsiApplicationInventory.java (+3 439) · JdbcCsiActivationAdmission.java (+309/−146) · JdbcCsiExecutionAdmission.java (+170/−58) · WorkspaceCsiReservationStore.java (+147/−39) · ManagedSessionStore.java (+161/−10) · CsiNativeActivationProof.java (+130/−2) · WorkspaceCsiApplicationHistory/Image/HistoryImage/Json/WorkerMatch.java · test files · design docs
Findings — no blockers
NB-1 (preserved from round 1, confirmed design intent)
joinOriginalCsiWriter() calls stopRenewal() before the acquirePromise || pendingAppend integrity guard. If the guard fires, retirementJoin is left unset while renewal is permanently stopped. Safe because the retire handler in hosted-csi-session.ts awaits Promise.allSettled(admitted) before calling joinWriter(), so both flags are clear at that point. yiliang114 confirmed this is the retirement-fence rationale.
NB-2 (preserved from round 1, confirmed design intent)
prepareOriginalCsiRelease() assigns retirementPreparation to the pending promise before the queue.then(async () => …) body runs, immediately closing runSerial() and close() to new work. Intentional one-way door. yiliang114 confirmed this is design intent.
NB-3 (new — inline thread)
workerAuthority() uses !seedMatches || !leaseMatches, which throws unless credential equals both the provision-seed token and the lease token. This works because for an original epoch-1 generation-1 DRAINING binding the seed and lease are identical (no renewal has ever rotated the lease independently of the epoch). The invariant is implicit and undocumented. qqqys's review described this as "answers 401 when neither matches" (OR-accept), which is the logical inverse of the actual check (AND-accept). Behavior is identical when seed==lease, which holds for this code path. Non-blocking; a comment would help.
NB-4 (new — body only)
finalizeApplication() uses two consecutive jdbc.update() calls inside one Spring TransactionTemplate lambda: first sets finalize_receipt_bytes / _sha256, then calls sessions.completeCsiApplication(...), then advances progress_stage to DRAINED. All three run atomically. The second UPDATE's WHERE clause includes AND finalize_receipt_sha256 = ? and sees the first UPDATE's write within the same transaction (InnoDB read-your-own-writes). On retry after rollback, the first UPDATE is idempotent (WHERE AND finalize_receipt_bytes IS NULL matches again). Correct; noted for auditor visibility.
Cross-check against prior reviews
yiliang114 (re-approved at 67c8b920): Confirmed NB-1 and NB-2 are design intent; verified rebase didn't drop the branch side; confirmed V12 is in the correct Flyway slot; confirmed the CsiNativeToolReservation overload chain is unambiguous. No findings beyond mine. ✓
qqqys (COMMENT at 67c8b92): Authentication gating, migration additive-only, seal locking reads — all consistent with my findings. One description discrepancy: qqqys described workerAuthority() as "answers 401 when neither matches" (OR-accept), but the code is AND-accept (!seedMatches || !leaseMatches). Behavior is identical for epoch-1 DRAINING apps where seed==lease. qqqys listed WorkspaceCsiApplicationInventory.java and JdbcCsiActivationAdmission.java as their top gaps — these are carried into approvalBlockers below.
Approval blockers (coverage gaps only — no asserted defect)
| File | Lines | Why |
|---|---|---|
WorkspaceCsiApplicationInventory.java |
+3 439 | Largest new production file; core inventory & image verification for retirement — not read |
JdbcCsiActivationAdmission.java |
+309/−146 | Changes an admission gate the retirement and cold-recovery paths both call; not read |
yiliang114's delta approval covers the retirement-specific blobs. It does not cover this file pair. No defect in either is asserted.
Reviewed with AI assistance.
| byte[] credential = token == null ? new byte[0] : token.getBytes(StandardCharsets.UTF_8); | ||
| boolean seedMatches = MessageDigest.isEqual(credential, locked.binding().getProvisionSeed().getToken().getBytes(StandardCharsets.UTF_8)); | ||
| boolean leaseMatches = MessageDigest.isEqual(credential, locked.binding().getLease().getToken().getBytes(StandardCharsets.UTF_8)); | ||
| if (!seedMatches || !leaseMatches) { |
There was a problem hiding this comment.
NB-3: workerAuthority() auth — !seedMatches || !leaseMatches requires credential to equal both the provision-seed token and the lease token simultaneously. This works because for an original epoch-1 generation-1 DRAINING binding the provision seed IS the active lease (no renewal has ever rotated the lease independently of the epoch). If that invariant broke — e.g. a future path that rotates the lease without incrementing the epoch — this check would permanently 401 the worker. A comment at this site documenting the invariant, or an assertion such as Objects.equals(getProvisionSeed().getToken(), getLease().getToken()) before the comparison, would make the assumption explicit rather than silent.
chiga0
left a comment
There was a problem hiding this comment.
APPROVE — round 3: coverage gaps closed, no blockers found.
Round ledger
| Id | Round 2 finding | Status |
|---|---|---|
| R2-3 | workerAuthority() requires !seedMatches || !leaseMatches (AND-accept); invariant seed==lease for epoch-1 DRAINING is implicit |
still present — non-blocking, no change |
| R2-4 | Two-UPDATE CUT→DRAINED transition in one TransactionTemplate — correct, InnoDB read-your-own-writes |
still present — non-blocking, no change |
Round 2 approval blockers (coverage gaps) — now resolved:
| File | Lines | Outcome |
|---|---|---|
WorkspaceCsiApplicationInventory.java |
+3 439 | Read in full — no blockers (see below) |
JdbcCsiActivationAdmission.java |
+309/−146 | Read in full — no blockers (see below) |
WorkspaceCsiApplicationInventory.java — what I checked
Overflow / bounds safety: MAX_ROWS = 4096, MAX_BYTES = 32 MiB. scan() adds a Blocker and returns immediately at both row_limit and byte_limit; the discover() fixed-point loop checks overflow first on every iteration. The loop terminates because the row set can only grow, bounded by those limits.
restoreCanonical() round-trip: Re-serialises the snapshot from bytes and asserts Arrays.equals(bytes, restored.bytes). Version header "qwen-csi-application-inventory/2" hard-coded at both sides — tamper-proof and version-gated.
validateHistoricalBaseline(): Precondition baseline.blockers().isEmpty() is required before validation begins. Calls restoreCanonical() first, so a corrupted persisted snapshot throws IllegalArgumentException before any SQL is run. Stage must be SETTLING, binding record_version >= intent.sealedBindingVersion() (relaxed >= is correct — version may have incremented since the seal), first_activation_journal_revision == 2L for epoch-1 original.
FOR UPDATE locking: inspect() requires !target.getAutoCommit(). Every scan() uses LIMIT (MAX_ROWS+1) FOR UPDATE with a 10-second setQueryTimeout.
No defect found.
JdbcCsiActivationAdmission.java — what I checked
terminalPreflight(): authority.requirePreCut() runs first, then full journal replay via history(), then require(writerExpiresAt > now && activationExpiresAt > now) using DB clock via authority.requireCurrentTime(connection) — no wall-clock drift. Resource non-existence guard runs before the final time fence, ensuring the boundary resource has not already been committed.
lockRetirementPredecessor(): Uses activeNativeHead() (no expiry check) — correct at SETTLING/FROZEN stage because the writer lease may have expired when retirement begins; no continuation work is attempted here.
JournalRead time budget: Historical reads require isReadOnly() + TRANSACTION_REPEATABLE_READ; requireHistorical() enforces a 10-second wall-clock budget (System.nanoTime()) and rethrows via require(false).
activeHistoryThrough() journal chain: Each entry SHA256-verified against record_digest, sequence chain verified (first_sequence == sequence + 1, previous_commit_digest matches), per-entry revision < MAX_HISTORY guard, cumulative byteCount <= MAX_HISTORY_BYTES (64 MiB). requireNoJournalTail() at the end confirms no dangling entries past expectedRevision.
terminalHistory() final state check: Requires ma_session_head state SEALED, activation_phase = 'released', activation_epoch = 1, activation_event_epoch = 1, writer_generation = 1. writerTokenSha256 from frozen bytes is matched against the DB row — substitution-resistant.
noEarlierAuthorization(): Paginated scan with cursor and count < 100 sentinel; total <= MAX_HISTORY prevents unbounded reads.
No defect found.
Cross-check
yiliang114 (re-approved at 67c8b920): Covered rebase delta; no findings in either file above. ✓
qqqys (COMMENTED at 67c8b92): Same two coverage gaps identified; no defects asserted in those files. ✓
Reviewed with AI assistance.
Co-authored-by: Qwen-Coder <[email protected]>
Co-authored-by: Qwen-Coder <[email protected]>
Co-authored-by: Qwen-Coder <[email protected]>
Co-authored-by: Qwen-Coder <[email protected]>
Co-authored-by: Qwen-Coder <[email protected]>
Co-authored-by: Qwen-Coder <[email protected]>
Follow the upstream persistence and transport package split, update renamed exception and formerly implicit references, and retain bounded protocol parsing across the new package boundary. Co-authored-by: Qwen-Coder <[email protected]>
67c8b92 to
749cfdf
Compare
|
Resolved the merge conflict introduced by the upstream server package reorganization (#14710) and pushed HEAD 749cfdfdf8 with an explicit old-head force-with-lease.
Validation: frozen dependency installation completed the root build/bundle; root typecheck passed with Node 22.22.3. JDK 21 compilation covered 334 production and 506 test sources after cleaning old package outputs. The affected selection passed 287 tests. The complete unit/H2 phase ran 4,954 tests: 4,936 passed, 18 skipped by platform/opt-in/assumption gates, zero failures or errors. All 102 MySQL 8.4.11 tests passed (31 retained-artifact, 63 inventory, 8 SQL-worker scenarios), including the oversized binary fixture using server-side prepared statements. The first full verification completed both test phases and then failed on eight import-order violations. After correcting only import ordering, the affected 97 tests passed again and all 1,985 class SHA256 values remained identical. The latest fetched main 中文:已解决主干包重组造成的冲突,按新职责目录补齐引用与导入顺序,并保留原有协议与退役行为。4954 项单元/H2 测试中 4936 通过、18 条件跳过,102 项 MySQL 测试全部通过;格式修正后定向复跑 97 项通过,1985 个 class 的 SHA256 保持一致,两套 Checkstyle 与 SpotBugs 均为零错误。新 head 可合并,需重新审查并等待新 CI;当前 2 个线程已解决、1 个仍未解决。 |
chiga0
left a comment
There was a problem hiding this comment.
APPROVE — round 4 (new head 749cfdfdf8): four fix commits reviewed, no blockers found.
Prior-round findings
| Id | Finding | Status at 749cfdfdf8 |
|---|---|---|
| R2-3 | workerAuthority() credential check AND-accept implicit invariant |
still present — non-blocking, no change |
| R2-4 | Two-UPDATE CUT→DRAINED in one TransactionTemplate — correct |
still present — non-blocking |
Prior approval blockers: none (closed in round 3).
Delta since round 3 (67c8b92 → 749cfdfdf8)
Six commits. The base also changed (rebase onto current main). The content delta consists of four fix commits on top of the main feature:
cd985fe4ba — compare CSI retirement handle values (+1/−1 production line)
WorkspaceCsiApplicationInventory.java, ma_runtime_slot row validator.
Old: intent.resourceHandleJson().equals(row.text("resource_handle_json")) — string equality, fails when JSON key order differs between writer and reader.
New: matches(parse(row.text(...)), parse(intent.resourceHandleJson())) — both sides parsed as JsonNode, compared structurally via Jackson equals().
Correct fix. matches() re-serialises through JSON.writeValueAsBytes() before comparing, normalising key order. The parse() path returns null on malformed input, and matches() guards observed != null, so bad JSON safely fails validation rather than throwing.
09e456dca6 — qualify retained CSI handle identities across mappers (+20/−3)
WorkspaceCsiReservationStore.requireRetainedIdentity().
Old: !intent.equals(snapshot(...)) — Retirement.equals() uses string equality on resourceHandleJson, fails on equivalent JSON with different key order.
New: fast-path on exact equality; on mismatch: parse both resourceHandleJson values with WorkspaceCsiApplicationJson.object() (bounded to 256 KiB, IllegalArgumentException on malformed), then reconstruct expected with intent.resourceHandleJson() substituted and check all other fields still match. Malformed JSON is caught and re-thrown as unavailable().
Correct fix. The substitution strategy precisely isolates the JSON-ordering difference from all other field comparisons.
4df05e5eca — retain cold recovery receipt overload (+8/−2)
CsiNativeToolReservation.complete().
Adds the missing overload complete(..., boolean recovery, long seq, long rev) → complete(..., recovery, seq, rev, LIVE). The two existing shorter overloads now delegate through this one rather than to the full 8-arg version directly — a safe refactor that restores an overload the cold-recovery path needs.
749cfdfdf8 — align CSI retirement with server package layout (+23/−12)
Follow-on to the upstream package reorganisation (#14710):
CsiFileFinalizeProtocolmovedruntimebroker→runtimebroker.transport; import references updated across 5 files.ManagedCsiFilesProtocol.parse(byte[], int)widened from package-private topublicsoJdbcCsiActivationAdmissionandJdbcCsiRetirementSeal(now in a different package) can call it. Caller always passes an explicitlimit; no bypass of size guard.ApiException→ManagedAgentExceptioninWorkspaceCsiApplicationControllerandManagedAgentStore(consistent with #14710).
Mechanical and correct.
Cross-check
yiliang114 (dismissed, was at 67c8b92): No findings in any of the four changed files. ✓
qqqys (COMMENTED at 67c8b92): No findings at the files touched by the fix commits. ✓
No reviewer has reviewed 749cfdfdf8 yet; this is the first review at this head.
Reviewed with AI assistance.
yiliang114
left a comment
There was a problem hiding this comment.
APPROVE — delta re-review at head 749cfdfd, superseding my 67c8b920 approval that the push dismissed.
The head moved by a rebase onto main de20ab6a (the package-boundaries split) plus one commit, 749cfdfd fix(runtime): align CSI retirement with server package layout. I audited the delta rather than re-running the full pass, since the previously reviewed production logic is unchanged.
What I verified at this head:
- Retirement behaviour is byte-identical to what I approved.
CsiNativeToolReservation,CsiOwnershipRevision,JdbcCsiApplicationRetirement,JdbcCsiApplicationProgress,V12__csi_application_retirement.sqlandhosted-csi-session.tshave the same blob shas as67c8b920; so do the TypeScript finalize-protocol and envelope files. Theadmit()/retireordering, latch → join → prepare/complete and the boot6-finalization contract are untouched. - The alignment commit is mechanical.
ApiException→ManagedAgentExceptionis main's class rename — the body of the new class is identical (same constructors,getStatus()/getCode(),details), andapi/ApiException.javano longer exists at the base. The remaining hunks are import/qualified-name updates forpersistence/,transport/,workspace/,model/,catalog/. - The visibility widenings are required, not incidental.
ManagedCsiFilesProtocol.parse(bytes, limit), theCsiNativeActivationProofJSON helpers andHttpRuntimeTransport.BoundedBody*became public because their callers now sit in a different package; call sites are the same ones as before. - No stale package references in added lines — repo-wide sweep of the PR diff for
managedagent.store.,managedagent.service.,ApiException, and the pre-moveruntimebroker.<protocol>names returns nothing. - Migration slot still clean. Base tops out at
V11__wake_recovery.sql;V12__csi_application_retirement.sqlis the only new migration at head.
CI has not executed this head yet — 5 check-runs pending, the rest skipped, mergeStateStatus: BLOCKED. Not a code finding, just the current state.
One non-blocking note: the PR body still pins "Current head bbea488786…" and the evidence section predates this rebase and the alignment commit. Worth updating when you next touch the description.
My earlier scope caveats stand unchanged: this approval does not cover foreign-owner late-lock ordering, cross-tenant races, private-process death acceptance, or a Linux rerun.
qqqys
left a comment
There was a problem hiding this comment.
APPROVE at head 749cfdfdf88309107029ffe664ea2f12b534e16a, superseding my two COMMENT reviews on bbea4887 and 67c8b920. Both of those withheld approval on coverage gaps I have now closed by reading the code myself at this head. This review also corrects a factual error in my earlier one, stated first because it concerns a security control.
Correction: I misdescribed the bearer credential check
In my review of bbea4887 I wrote that workerAuthority "compares with MessageDigest.isEqual against both the provision-seed token and the lease token and answers 401 when neither matches", and called that "two-credential acceptance". That is wrong, and a later reviewer caught it. The actual code at this head (managedagent/persistence/WorkspaceCsiApplicationStore.java:270-275) is:
byte[] credential = token == null ? new byte[0] : token.getBytes(StandardCharsets.UTF_8);
boolean seedMatches = MessageDigest.isEqual(credential, locked.binding().getProvisionSeed().getToken().getBytes(StandardCharsets.UTF_8));
boolean leaseMatches = MessageDigest.isEqual(credential, locked.binding().getLease().getToken().getBytes(StandardCharsets.UTF_8));
if (!seedMatches || !leaseMatches) {
throw new RuntimeBrokerException(401, "csi_application_authority_unauthorized", "Original Runtime authentication failed.", false);
}!seedMatches || !leaseMatches throws unless both match. This is AND-accept, not the OR-accept I described — the logical inverse. My error understated the control's strictness, so nothing was wrongly approved on the strength of it, but a reader trusting my description would have misunderstood which credential is sufficient, and the correction matters for the reason below.
The conjunction is not merely stricter than necessary; its satisfiability is enforced rather than assumed. The earlier reviewer described the seed-equals-lease precondition as an implicit undocumented invariant. Reading the terminal-state gate myself, it is pinned explicitly — JdbcCsiActivationAdmission's terminal check (:693-705) requires, in one conjunction, state == "SEALED", activation_phase == "released", activation_epoch == 1, activation_event_epoch == 1, writer_generation == 1, journal_revision == predecessorRevision + 1, committed_sequence == proof.terminalSequence(), the metadata commit digest equal to last_commit_digest, activation_head_revision == predecessorRevision + 1, the predecessor activation id and worker id matching the row, activation_expires_at matching the predecessor's expiry, frozen.writerTokenSha256 equal to lease_token_hash, and no second row. A binding whose lease had ever rotated away from its provision seed could not satisfy epoch 1 and generation 1, so it never reaches workerAuthority; if it somehow did, the check fails closed with 401. So the AND-accept is sound on exactly the bindings this path admits, and the residual exposure is availability rather than authorization.
The two coverage gaps I named are now closed by my own reading
My previous reviews withheld approval naming WorkspaceCsiApplicationInventory.java and JdbcCsiActivationAdmission.java as unread. I have now read both at this head — for their safety-critical properties rather than every line, and I disclose that distinction below.
WorkspaceCsiApplicationInventory.java (3,441 lines, fetched byte count verified against the API's reported size). The bounds are real and enforced inside the loops rather than after them: MAX_ROWS = 4096 and MAX_BYTES = 32 MiB (:56-57), Jackson constrained by StreamReadConstraints with maxNestingDepth(64) and maxStringLength(MAX_BYTES) (:63), and the scan query built as LIMIT (MAX_ROWS + 1) with setQueryTimeout(historyRemaining(started)) so the read carries both a row ceiling and a shrinking wall-clock budget. The +1 is what makes overflow detectable: on hitting either limit the code calls block(...) with "row_limit" or "byte_limit", sets overflow, and the enclosing loop tests if (overflow) before continuing (:1311, :1334-1347), so a truncated scan cannot be mistaken for a complete one. The connection contract is asserted rather than assumed — requireEncoded(connection != null && !connection.getAutoCommit() && connection.isReadOnly() ...) (:1266) — and the module is built on byte-exactness: canonical rows and snapshots are compared with Arrays.equals at the projection, resource-ref, retirement-carrier and pinned-row sites (:481, :843, :855, :1078, :1223, :1341, :1682), the snapshot carries a hard-coded "qwen-csi-application-inventory/2" version header (:557), per-kind payloads are capped (managed-message-parts at MAX_BYTES, everything else at 8 MiB, :1461), and payload(...) rejects empty or over-limit bytes (:1918).
JdbcCsiActivationAdmission.java (919 lines, byte count verified). Every time fence uses the database clock rather than the JVM's: JdbcRepositorySupport.databaseNowPrecise(connection) at :261, :414 and inside NativeHead.requireCurrentTime (:447-449), with requireCurrentTime invoked at :205, :295, :309, :370 and :465. The two directions are correctly opposed — the live paths require writerExpiresAt > now && activationExpiresAt > now (:296, :310, :449) while the cold path requires writerExpiresAt <= now && history.activation().expiresAt() <= now (:415), so a live writer cannot be displaced and an expired one cannot be treated as live. Locking reads carry tenant and session predicates (:283, :480). The journal replay is bounded and chained: MAX_HISTORY = 4096 and MAX_HISTORY_BYTES = 64 MiB (:22-23), each entry requiring revision < MAX_HISTORY, journal_revision == revision + 1 for contiguity, sha256(bytes) equal to record_digest, a cumulative byteCount <= MAX_HISTORY_BYTES, and previous_commit_digest matching the running digest (:530-572); requireNoJournalTail then confirms nothing exists past the expected revision (:518, :685), and JournalRead(System.nanoTime()) (:633) bounds a historical read's wall clock.
What else I verified at this head, and what the rebase changed
The branch was rebased onto a main that now includes the server package reorganization, and the newest commit aligns this feature with that layout — WorkspaceCsiApplicationStore and WorkspaceCsiApplicationInventory now sit under managedagent/persistence/ rather than managedagent/store/. Build and verify reference distribution is green at this head, which is the lane that compiles the Java module against the reorganized layout, so the boundary-crossing hazard that broke the sibling reorganization PR is not present here.
The positives I verified at the earlier heads still hold and I re-checked rather than assumed them: the retirement endpoint keeps its action set closed at the mapping (freeze|cut|finalize), takes identity from TenantContext and the writer token from the header, and shape-validates the bearer value before use; requireCsiApplicationCredential is still called on every mutating path with verifySaved after it; V12__csi_application_retirement.sql is still purely additive with zero DROP/DELETE/TRUNCATE/MODIFY statements and keeps uq_ma_csi_retirement_target scoped to retirement operations through the generated column; and JdbcCsiRetirementSeal still uses its three tenant-keyed FOR UPDATE reads with byte-and-digest equality on the frozen request. workerAuthority additionally re-derives the expected worker request and requires the incoming body to equal it exactly (:277-278), so the endpoint cannot be used to authorize a request the server did not compose — a check I had not previously noted.
No blocking finding was ever filed against this PR: there is no automated review ledger, no [Critical] inline comment, and the reviewer findings that exist are all explicitly non-blocking. My scan found no provable Critical at any of the three heads.
CI
No failing check at this head. Build and verify reference distribution, Classify PR, Remind on force-push, authorize and label pass; Test (ubuntu-latest, Node 22.x), Lint & Static, Serve A/B, Integration Tests (no-AK, No Sandbox), OpenTUI no-flicker gate and TUI parity snapshots were pending at submission and are not treated as gates. The Flyway uniqueness gate passes, which is the check that matters for the new V12 migration.
Scope of this review
Read at this head, with fetched byte counts checked against the API's reported size: WorkspaceCsiApplicationController.java in full; WorkspaceCsiApplicationStore.java's workerAuthority in full and its credential/verify structure across all mutating paths; WorkspaceCsiApplicationInventory.java's bounds, overflow handling, connection contract, version header and byte-equality sites; JdbcCsiActivationAdmission.java's time fences, locking reads, journal-chain verification, tail check and terminal-state conjunction; JdbcCsiRetirementSeal.java's locking and identity predicates; and V12__csi_application_retirement.sql in full.
Not covered: a line-by-line read of the two large files — I verified their safety-critical properties (bounds, locking, clock source, digest chaining, terminal state) rather than every row-projection and image-comparison branch, so a defect in an individual projection's field mapping could survive this review; the remaining WorkspaceCsiApplication{History,Image,HistoryImage,Json,WorkerMatch}.java; CsiFileFinalizeProtocol.java and its TypeScript counterpart as a compared pair; the packages/core changes in http-managed-session-store.ts and managed-session-authority.ts beyond their diffs; every test file and fixture; and the design docs. I ran no build, test, Maven verify or MySQL lane myself, and the approvals already on the prior head are those reviewers' evidence rather than mine.
中文说明
本轮针对新的提交重新评审,取代我此前两份 Comment,并首先更正其中一处事实错误,因为它涉及安全控制。
更正:我在早先的评审中把持有者令牌校验描述为「两个凭据都不匹配才返回 401」,即任一匹配即通过。实际代码是 !seedMatches || !leaseMatches,即必须同时匹配预置种子令牌与租约令牌,两者是逻辑相反的关系。我的错误低估了该控制的严格程度,因此没有据此错误放过任何问题,但依赖该描述的读者会误解哪一个凭据是充分的。更重要的是,这个「与」条件的可满足性不是靠假设,而是被强制保证的:终局状态校验在一个合取中同时要求状态为 SEALED、激活阶段为 released、激活纪元与事件纪元均为 1、写者代次为 1、日志修订与已提交序号精确衔接、提交摘要一致、前驱激活标识与工作者标识匹配、过期时间匹配,且冻结请求中的写者令牌摘要等于库中租约令牌哈希。凡租约曾独立轮换过的绑定都不可能满足纪元 1 与代次 1,因此根本到不了该接口;即便到达,校验也会以 401 失败关闭。所以残余风险属于可用性而非授权。
此前两份评审列为未读的两个大文件,本轮已由我本人在当前提交上核对。清单类的边界是真实的且在循环内即时生效:行数与字节上限固定,Jackson 的嵌套深度与字符串长度受限,扫描查询按上限加一行取数以使溢出可被察觉,触限时写入阻塞原因并置溢出标志,外层循环在继续前先检查该标志,因此被截断的扫描不会被误认为完整;连接契约以断言方式要求非自动提交且只读;模块整体建立在逐字节相等之上,规范行与快照在多处用字节比较校验,快照带固定版本头,不同类别的负载各有上限,空或超限字节被拒绝。准入类的所有时间栅栏都取数据库时钟而非进程时钟,存活路径要求写者租约与激活都未过期,冷接管路径要求两者都已过期,方向相反且各自正确;加锁读带租户与会话条件;日志重放有行数与累计字节上限,逐条校验修订连续、摘要匹配与前序提交摘要衔接,并在最后确认预期修订之后没有悬空条目,历史读取另有时间预算。
本次变基跨越了主干上的服务端包重组,最新提交把本功能对齐到新的包布局,两个持久化类已从 store 移到 persistence。构建通道在当前提交上通过,而它正是会把 Java 模块与新包布局一起编译的通道,因此同期那个重组改动所踩到的跨包可见性问题在本 PR 上不存在。此前核对过的结论本轮重新确认而非沿用:退役接口的动作集合仍由路由模式限定,身份取自服务端租户上下文,写入令牌取自请求头并在截取前做形态校验,每个变更路径都在加锁后校验凭据并在其后复核已保存状态;数据库迁移仍是纯增量,无任何删除或修改语句,生成列使唯一约束只作用于退役操作;封印逻辑仍使用三处带租户条件的加锁读并对冻结请求做字节与摘要双重比对。另外,持有者接口还会重新推导期望的工作者请求并要求传入请求与之完全相等,因此无法用它去授权一个并非服务端组装的请求——这一点我此前没有记录。
本 PR 从未被提出阻塞性问题:没有自动评审记录,没有严重级行内评论,现有评审意见均明确标注为非阻塞;我在三个提交上的扫描都未发现可证明的阻塞缺陷。CI 无失败项,构建与若干簿记通道通过,单元测试等六项仍在运行,按规则不作为门禁;迁移版本唯一性检查通过。未覆盖:两个大文件的逐行阅读(我核对其边界、加锁、时钟来源、摘要链与终局状态等安全关键属性,而非每一个行投影与镜像比较分支,因此单个投影的字段映射缺陷可能逃过本轮)、其余若干辅助类、跨语言终结协议两侧的并排比对、核心包两个 TypeScript 文件的非改动部分、全部测试与设计文档;也未自行执行构建、测试或数据库通道。
|
|
Released in v0.26.0. |
What this PR does
Extracts the original-owner application retirement slice from #13526, frozen at
1a6529b73c007044d9d04e0614fbc30ebe13c0ac, directly onto main11a6346aa92b5e2f473464174e6043d053bf8010. It is independent of the cold-recovery split #14695: only a settled, still-live original runtime generation 1, writer generation 1 and activation epoch 1 can complete this path.The existing Hosted owner closes admission and joins its actual work and renewals, then prepares one exact terminal suffix. Durable SETTLING → FROZEN → CUT → DRAINED progress binds a complete SQL image to the original worker's file, history, execution and descriptor observations. Completion seals the native journal and releases the one logical Runtime Session; the original binding and holder remain DRAINING and the runtime slot remains occupied. Exact retries consume the saved cut and receipt without acquiring another writer or worker.
The typed inventory covers 32 tables and 736 columns, including retained snapshot/page/body graphs and agent resources. It preserves main's real Hosted context-usage projection and precisely validates its latest committed output association instead of suppressing that producer. V12 adds eleven progress/unique-target fields to the existing retirement operation and preserves the published V11 wake migration and its producer behavior. The finalizer uses an explicit boot6/resource-handle4 contract; boot4/5 construction and ordinary execution remain compatible but do not gain finalization authority.
The complete design and remaining qualification requirements are synchronized in English and 简体中文.
Why it's needed
Finishing a file turn or observing an empty local task set does not establish an application cut shared by SQL admission, native history and the original worker's open descriptors. Generic CSI activation and Runtime Session release intentionally refuse this gap. This slice supplies an explicit durable completion protocol while retaining unknown-state refusal and the original execution and storage identities.
Reviewer Test Plan
How to verify
For a newly constructed boot6 original owner, finish supported Read/Write/Edit work, begin retirement and invoke the existing-owner retire route. Verify monotonic progress to DRAINED version 4, a sealed head, closed original descriptors, unchanged file/history/execution identities, a released logical Runtime Session, DRAINING binding/holder and an occupied slot. New attach, input, execution, writer acquisition and ordinary final-boundary operations must refuse once their relevant admission closes.
Retry the same operation before and after a lost reply and confirm exact saved bytes and stable progress. Cross a tenant, workspace, binding, retirement, writer generation, activation epoch, deadline, resource, receipt or retained snapshot association and confirm refusal without an undeclared durable change. A recovered owner must not gain original-owner retirement authority.
The original owner retains parent-first same-Connection locking. OTHER-owner validation still takes late foreign-parent locks after bounded whole-table child scans; concurrent ordinary writers can cause deadlock/timeout and rollback. Cross-tenant race acceptance is pending and this lock-order question requires maintainer review. Do not interpret the focused checks as production qualification of that path.
Evidence (Before & After)
Before: a fresh global
qwen 0.25.2baseline returned 404 for attach/text/retire. This establishes unavailable capability only, not an SQL protocol reproduction.After: root build, typecheck and bundle passed on the unchanged rebased TypeScript sources. Focused Core tests passed 233/233; focused CLI tests passed 575 with 33 platform skips, followed by a 43/43 strict finalizer/worker subset. Production-equivalent candidate
0a039626d3dcef22e93e3540f56184fd1fa00915passed 178 focused Java checks without skips, both Checkstyle configurations, SpotBugs with zero findings and packaging. Current headbbea488786f00b8d0f54f8b4a6658cbc3b017b2echanges only two metadata lookup keys in the MySQL test fixture; production source is identical and test compilation passed. This selection covers retirement 17, history 3, inventory 63, native activation 20, retained graphs 31 and lock-order 44.An earlier complete clean unit phase reported 4,930 cases with zero failures/errors and 18 skips, then stopped at one formatting violation. The complete suite was not rerun after the later minimal qualification and fixture corrections. Fresh SQL exposed handle-key-order comparisons in both inventory qualification and retained status reading, plus test dialect and mount-fixture issues. The corrections preserve stored bytes/digests, strict schema checks, all other identity fields and actual native descriptor closure. The separate E2E report retains every failed attempt and its exact candidate.
At
0a039626d3dcef22e93e3540f56184fd1fa00915, actual initial Hosted attach → one settled text turn → retire reached DRAINED v4 with writer generation 1 / epoch 1, conserved execution/file/backup identities, all four original native descriptors closed and binding/holder still DRAINING. Independent persisted-status GET and a brand-new production Core client retry both passed; complete 33-table images were unchanged by both retries and no writer was reacquired. All four standard MySQL cases also passed. The inventory run passed 62/63 and exposed the fixture metadata-key defect corrected in the current test-only commit. On current head bbea488, the corrected BOOLEAN case passed independently, then all 63 inventory and 31 retained MySQL cases passed without skips. Ordinary Hosted 2/2 and ordinary process-fault 2/2 also passed; the process profile covers six ordinary fault cuts plus coordinator restart. Two selected ordinary Workspace cases FAILED at tool-session acquisition before their fault cuts. Fresh read-only checks passed both Session authorizations and found no required physical storage registration; the fixture registers those roots only on Linux, and this run used macOS. A complete main E2E baseline and supported Linux rerun were not performed, so these remain failures rather than a claim of no regression. Exact scopes and limitations are in the separate report.Cross-tenant races, the private CSI process-death/fault matrix and Linux filesystem acceptance remain unverified. H2 and labelled mock seams are not substitutes for those gates. Historical source-branch results are not used as evidence. The native foreground
/reviewworkflow tool is unavailable on this host; this PR does not claim formal review approval.Tested on
Environment (optional)
Local macOS, Node.js 22.14.0, JDK 21 and Maven 3.9.16. Disposable MySQL 8.4 was used for the reported SQL and actual Hosted retirement checks; private CSI process-death acceptance remains pending. Mocked worker mount/readback seams are explicitly labelled by the tests.
Risk & Scope
Linked Issues
Part of #13526; this extraction does not close the cumulative PR or a separate issue.
中文说明
本 PR 的变更
从 #13526 的冻结版本
1a6529b73c007044d9d04e0614fbc30ebe13c0ac提取原始 owner 的应用退役部分,直接基于 main11a6346aa92b5e2f473464174e6043d053bf8010。它独立于冷恢复拆分 #14695:只有已经 settled、仍存活且 runtime generation 1、writer generation 1、activation epoch 1 的原 owner 能完成此路径。现有 Hosted owner 关闭接纳并等待真实工作和续租,然后准备唯一的精确终止后缀。持久 SETTLING → FROZEN → CUT → DRAINED 进度把完整 SQL 镜像与原 worker 的文件、历史、执行和描述符观察绑定。完成时 seal native journal 并释放唯一逻辑 Runtime Session;原 binding 和 holder 保持 DRAINING,runtime slot 继续被占用。精确重试消费保存的 cut 和 receipt,不会获取另一个 writer 或 worker。
typed 库存覆盖 32 表、736 列,包括保留的 snapshot/page/body 图及 agent 资源。保留 main 真实 Hosted 上下文用量投影,精确校验其最新已提交输出关联,不抑制既有 producer。V12 在现有 retirement operation 上增加十一项进度/唯一 target 字段,保留已发布的 V11 wake migration 及其 producer 行为。finalizer 使用显式 boot6/resource-handle4 协议;boot4/5 的构造和普通执行继续兼容,但不会获得 finalization authority。
完整设计和剩余资格验收要求已同步维护在 English 与 简体中文。
为什么需要
文件 turn 完成或本地任务集合为空,并不能建立 SQL 接纳、native history 与原 worker 打开描述符共同认可的应用切点。通用 CSI activation 和 Runtime Session release 明确拒绝这一缺口。本部分提供显式持久完成协议,同时保留未知状态拒绝,以及原 execution 和 storage 身份。
评审者测试计划
如何验证
对新构造的 boot6 原始 owner,完成支持的 Read/Write/Edit 工作,开始退役,再调用现有 owner 的 retire 路由。确认进度单调到达 DRAINED version 4、head 已 seal、原描述符已关闭、file/history/execution 身份不变、逻辑 Runtime Session 已释放、binding/holder 保持 DRAINING 且 slot 仍被占用。新的 attach、input、execution、writer acquisition 和普通 final-boundary 操作在相应接纳关闭后必须拒绝。
在丢失响应前后重试相同操作,确认保存字节精确一致且进度稳定。交叉 tenant、workspace、binding、retirement、writer generation、activation epoch、deadline、resource、receipt 或 retained snapshot 关联,确认拒绝且没有未声明的持久修改。恢复 owner 不能取得原 owner 的退役 authority。
原始 owner 保持 parent-first 的同 Connection 锁顺序。OTHER owner 的验证仍在有界全表子行扫描后取得 foreign parent 锁;与普通 writer 并发时可能 deadlock/timeout 并回滚。跨 tenant race 验收尚未完成,该锁顺序问题需要维护者评审。不能将 focused 检查理解为此路径已获得生产资格。
证据(前后对比)
变更前:新跑的全局
qwen 0.25.2基线中 attach/text/retire 返回 404。这只证明能力不可达,不是 SQL 协议复现。变更后:未再改动的 rebase 后 TypeScript 源已通过 root build、typecheck 和 bundle。Core focused 233/233;CLI focused 575 通过、33 项平台限定跳过,随后 strict finalizer/worker 子集 43/43 通过。生产代码等价的候选
0a039626d3dcef22e93e3540f56184fd1fa00915已通过 178 项 Java focused、无跳过,两套 Checkstyle、零发现的 SpotBugs 和打包。当前 headbbea488786f00b8d0f54f8b4a6658cbc3b017b2e仅修改 MySQL 测试夹具两处元数据取值键,生产源码不变,测试编译通过。本次选择为 retirement 17、history 3、库存 63、native activation 20、保留图 31、锁序 44。此前完整 clean 单测阶段报告 4,930 项,0 失败、0 error、18 跳过,随后被一项格式违规挡住;之后的最小资格/夹具修正没有再跑整套。真实 SQL 揭示库存资格与保留状态读取中的 handle 键顺序比较,以及测试方言和 mount 夹具问题。修正保持存储字节/摘要、严格 schema、其他身份字段校验和真实原生描述符关闭。独立 E2E 报告 保留全部失败尝试及准确候选。
在
0a039626d3dcef22e93e3540f56184fd1fa00915上,实际首次 Hosted attach → 一个 settled 文本 turn → retire 已达到 DRAINED v4,writer generation 1 / epoch 1、execution/file/backup 身份保持,四个原始原生描述符均关闭,binding/holder 仍 DRAINING。独立持久状态 GET 和新建生产 Core 客户端重试均通过;两次重试前后的完整 33 表原像相同,没有重新获取 writer。四项标准 MySQL 场景全部通过。库存 62/63 通过,唯一失败揭示当前纯测试提交修正的元数据键错误。在当前 bbea488 上,BOOLEAN 单例独立通过,随后 63 项库存和 31 项保留历史 MySQL 检查全部通过、无跳过。普通 Hosted 2/2、普通进程故障 2/2 也通过,后者覆盖六个普通故障切点和 coordinator 重启。选中的两项普通 Workspace 场景在工具会话获取阶段失败,未进入故障切点。新只读检查证明两个 Session 授权均通过,但缺少必需的物理存储登记;fixture 仅在 Linux 注册相应根目录,本轮运行于 macOS。未执行完整 main E2E 对照或受支持 Linux 复验,因此两项保留为失败,不能声称全面无回归。准确范围和限制见独立报告。跨 tenant race、私有 CSI 进程死亡/故障矩阵和 Linux 文件系统验收仍未验证。H2 和已标注 mock seam 不能替代这些门禁。不使用 source 分支历史结果作为证据。宿主缺少原生前台
/reviewworkflow 工具,本 PR 不声称正式 review 已通过。测试平台
环境(可选)
本地 macOS、Node.js 22.14.0、JDK 21、Maven 3.9.16。所报告的 SQL 与实际 Hosted 退役检查使用一次性 MySQL 8.4;私有 CSI 进程死亡验收仍待完成。worker mount/readback 的 mocked seam 已由测试明确标注。
风险与范围
关联问题
属于 #13526 的拆分;不关闭累计 PR 或其他 issue。