Repository navigation
fix(managed-agent): close the deferred #13182 terminal-state suggestions - #14358
Conversation
PR #13219 deferred its Suggestion-level review findings under the post-round-5 Critical-only rule. This lands the ones still valid on main. Behavior: - Bound the generation-change retry exemption (R3-6). A bound Session's HostedHarnessGenerationException stays exempt from the Turn retry budgets, but only until the Turn has gone four budgets without journaled progress; past that, it fails with hosted_harness_unavailable or hosted_harness_unavailable_after_admission instead of retrying forever. - Read the Action once per catch-block inspection in ActionResponseCoordinator; the expiry check reuses that read (R2-11). - Keep the release failure as the cause when the close-time seal fails too (R1-4). - Treat action_response_decision_expired as an ended Action in the WebShell approval hook (R2-18). Contract 1.51.0: failure_code now lists the codes a lifecycle operation can end with once its budget runs out, maps runtime_broker_recovery_blocked to workspace_close_identity_unverified, and notes that session_close_writer_live also covers a failed writer check (R2-2, R2-16, R2-17, R3-4). Docs: the recovery-scan population includes CWD_CHANGE (R2-15), the recovery_blocked publication trigger is the raw attempt count (R2-9), the stale section 8 bullet is gone (R1-26), and the generation cap is documented in the replaceable-Harness design. Tests, each checked red against its mutant: - R3-3: the generation exemption under the cap. - R3-6: the cap before and after admission. - R2-11: one Action read per inspection. - R3-2: atLeast(3) renewals. - R4-2: exempt-count rows on the writer-live and stale-boot publish arms. - R2-10: no renewal survives a failed close. - R3-5: a created enqueue resets the streak. - R3-7: a dispose race that reaches the halt bound itself. - R1-4 and R2-18: one test each for the fixes above.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Re-run at the current head ( Thanks for the PR! Template looks good ✓ — every required heading is present, including the Chinese translation. Problem: observed, not theoretical. This lands the Suggestion-level findings #13219 deferred under its post-round-5 Critical-only rule, and each of the 18 items traces to a named review thread with the deferral log linked. Two of them are the kind of claim that is easy to assert and easy to get wrong, so I checked rather than accepted them: the unbounded generation exemption is plainly visible in main's Direction: aligned. AGENTS.md prescribes exactly this mechanism — past roughly five review rounds, land Criticals only and defer the rest to a follow-up with each deferral recorded — and this PR is that follow-up, with the deferral log cited. The one item that needed a new contract field went to #14351 instead of riding along, and R2-18's card removal was reverted to main's behaviour when review showed the service still lists the Action. Both are the right calls. There is no upstream CHANGELOG analogue to check: this is repo-internal control-plane retry semantics, not a CLI surface users compare against another agent. Size: cross-package (cli, core, managed-agent-server, web-shell), so it touches core paths. Breakdown of the 734 changed lines: 148 production (16 of which are comment-only — Approach: minimal for what it claims. No drive-by refactors, no formatting churn, and the test-to-production ratio (~3.3:1) is what a PR whose whole subject is "these tests did not pin what their comments claimed" should look like. One thing I would not have predicted from the description and checked anyway: the Risk: no Stage 1e high-risk path matches. The real gap is evidentiary, not structural: no Moving on to code review. 🔍 中文说明在当前 head( 感谢贡献! 模板完整 ✓ —— 所有必需小节都在,包括中文翻译。 问题:是已观测到的,不是理论性的。本 PR 落地 #13219 按"第 5 轮后只修 Critical"规则搁置的 Suggestion 级发现,18 条每一条都能追溯到具名评审线程,并附了搁置记录链接。其中两条属于"说起来容易、说错也容易"的论断,所以我没有采信而是自己核过:无上限的 generation 豁免在 main 的 方向:对齐。AGENTS.md 规定的正是这个机制 —— 大约五轮评审之后只修 Critical,其余搁置到后续 PR 并逐条记录 —— 本 PR 就是那个后续 PR,并引用了搁置记录。唯一需要新契约字段的那条被拆到 #14351 而不是顺手带上;R2-18 的卡片移除在评审指出服务端仍会返回该 Action 之后回退到 main 的行为。两个决定都是对的。没有可对照的上游 CHANGELOG:这是仓库内部的控制面重试语义,不是用户会拿来和别的 agent 对比的 CLI 表面。 规模:跨包(cli、core、managed-agent-server、web-shell),因此触及核心路径。734 行改动的构成:生产代码 148 行(其中 16 行是仅注释 —— 方案:就其目标而言是最小的。没有顺手重构、没有格式化噪音,测试与生产代码约 3.3:1 的比例,正是一个以"这些测试没有钉住它们注释所声称的东西"为主题的 PR 应有的样子。有一处我从描述里没预料到、于是专门去核了:assembly 里 风险:Stage 1e 的高风险路径没有命中。真正的缺口在证据而非结构:没有任何 进入代码审查 🔍 — Qwen Code · qwen3.8-max-2026-09-02 Reviewed at |
Code reviewMy independent proposal, written from the title and the "Why it's needed" section before I opened the diff: bound the exempt generation wait with a factor-derived cap on consecutive failures and reuse the existing terminal path rather than inventing a new failure code; collapse the double Action read by hoisting one lookup and passing the row down; keep both close failures without mutating the seal error, since a memoized rejection is shared; fix the dead dispose-race test by computing its real bound and driving the streak to it. The PR does all four, and the No Critical findings. What I verified rather than assumed:
One judgement call the maintainer should accept consciously (non-blocking, and the author has already argued it on the R1-8 thread): the cap reads Files changed (20)
TestingEvidence carried here is the PR's own CI, read through the API — this is an unattended run, so I did not build or execute any PR-derived code.
Reading the two non-green entries, because neither is what it looks like:
Not verified, and why:
Sandboxed verification would settle the part CI cannot: 中文说明代码审查。 我在打开 diff 之前先写下了自己的方案:用一个按倍数推导、基于连续失败次数的上限来约束豁免的 generation 等待,并复用既有终态路径而不是另造失败码;把两次 Action 读取合并为一次上提的查询并把行传下去;在不改动 seal 错误对象的前提下同时保住两个 close 失败(因为被记忆化的 rejection 是共享的);对失效的 dispose 竞态测试,先算出它真正的上界再把连续失败驱动到那里。本 PR 四件事都做到了,而且 assembly 里 没有 Critical 发现。 以下是我核实过、而不是采信的内容:改动后的 一个应由维护者有意识接受的判断(非阻塞,作者已在 R1-8 线程里论证):上限读的是 测试。 这里携带的证据是本 PR 自己的 CI,通过 API 读取 —— 这是无人值守运行,我没有构建或执行任何 PR 派生的代码。两个非绿条目都不像表面那样: 未验证的部分及原因:Java 行为改动在本 PR 上没有被任何通道执行过( 沙箱验证可以补足 CI 补不上的部分: — Qwen Code · qwen3.8-max-2026-09-02 Reviewed at |
|
Confidence: 4/5 — I found no correctness defect in the diff and traced every changed path to its consumers; the missing point is that this PR's only substantive behaviour change is Java, and no lane on a Stepping back. My independent proposal and this PR converge on all four items, and the one place it goes beyond me is the Is this needed? Yes, and not only for the deferred findings it lands. The dispose-race test had quietly stopped testing its own subject — its halt bound scales with slot count, so with 10 slots the bound was 100 and its 10 injected failures never approached it. Deleting the guard left the file green. Finding that in a follow-up nobody asked for, and fixing it by computing the real bound and driving the streak to exactly 20 with the dispose racing the last failure, is the opposite of the volume-driven PR this gate is built to be skeptical of. Would I curse this in six months? No. Is every change necessary? Yes — 16 of the 148 production lines are comment-only corrections, two files carry no code change at all, and the one item needing a contract field went to #14351 instead of riding along. Am I approving because I ran out of reasons to object? No. I went looking for a blocker in the two places a change like this usually hides one: consumers of the new error shape, and paths around the new gate. All four What this approval does and does not attest to. It supersedes this account's standing Green CI here means the TypeScript lanes, lint, integration, web-shell and Serve A/B checks. It does not include The one thing I'd ask the maintainer to accept consciously is the R1-8 trade: because the cap reads the aggregate counter, a Turn that waited four budgets behind a live predecessor is failed by the first generation change — the very event that clears its blocker. A per-family counter would avoid it and needs a schema change, which belongs in its own PR. The direction is fail-safe, the counter's meaning is documented in the code and in D9a in both languages, and I agree with shipping it as-is. Approving now, pinned to 中文说明Confidence: 4/5 —— diff 里我没有找到正确性缺陷,每一条改动路径都追到了它的消费者;扣掉的一分在于本 PR 唯一实质性的行为改动是 Java,而 退一步看。我自己的方案与本 PR 在四项上都收敛,而它超出我的一处是 这是必要的吗?是,而且不只因为它落地了那些搁置的发现。dispose 竞态测试已经悄悄不再检验它自己的对象 —— 它的 halt 上界随槽位数伸缩,所以 10 个槽位时上界是 100,它注入的 10 次失败根本靠不近。把守卫删掉整个文件依然全绿。在没人要求的后续 PR 里发现这一点,并通过算出真实上界、把连续失败恰好驱动到 20 次、让 dispose 与最后一次失败竞态来修好它 —— 这与本门禁被设计来警惕的那类刷量 PR 恰好相反。半年后我会骂它吗?不会。每一处改动都必要吗?是 —— 148 行生产代码里有 16 行是仅注释的修正,两个文件根本没有代码改动,而唯一需要新契约字段的那条被拆到 #14351 而不是顺手带上。 我之所以批准,是因为找不到反对理由了吗?不是。我到这类改动最容易藏问题的两个地方去找过阻塞项:新错误形状的消费者,以及新门周围的路径。四个 这次批准证明了什么、没证明什么。 它会取代本账号当前挂着的 这里的 CI 全绿意味着 TypeScript 各通道、lint、集成测试、web-shell 与 Serve A/B 检查。它不包含 唯一希望维护者有意识接受的,是 R1-8 那个取舍:因为上限读的是聚合计数器,一个已经在存活前任后面等了四个预算的 Turn,会被第一次 generation 变化失败掉 —— 而那正是解除其阻塞的事件。按家族分别计数可以避免这一点,但它需要一次 schema 变更,应该单独开 PR。方向是 fail-safe 的,计数器的含义在代码里和 D9a 中都用两种语言写明了,我同意按现状合入。 现在批准,并钉在 — Qwen Code · qwen3.8-max-2026-09-02 Reviewed at |
🖼️ web-shell visual previewRendered against a mock daemon (no real backend): the PR base vs this PR head Screenshots · before / after✅ No screenshot changes against the PR base. Full-resolution recordings (.webm) are attached to the workflow run. — Qwen Code · web-shell visuals |
qwen-code-review-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship — CI landed green after the review. ✅
…ate-followups # Conflicts: # packages/managed-agent-server/src/main/resources/openapi/managed-agent-public-api.openapi.json
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
…ate-followups # Conflicts: # packages/managed-agent-server/src/main/resources/openapi/managed-agent-public-api.openapi.json
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
qwen-code-review-bot
left a comment
There was a problem hiding this comment.
Partially reviewed — gaps disclosed.
Not reviewed: test-efficacy probe — the probe harness produced no parseable runner output for all 7 probes (harnessValidated: null, every verdict inconclusive/no-output, 11 hunks skippedForCap and 6 skippedForBaseline), so mutant survival and hunk necessity were never measured for this diff; test-strength conclusions here rest on the verifiers' own hand-run mutants (R1-6, R1-7, R1-9), not on the probe.
Not reviewed: Java MySQL and recovery profiles — mysql-integration, hosted-harness-mysql, o4-mysql-gates, fault-gates, hosted-process-crashes, operator-recovery and workspace-maintenance-recovery were not run (no MySQL 8.4 instance available in this environment), and no CI lane executes the Java half on a pull_request event at all (sdk-java.yml has no pull_request trigger; the reference-distribution job builds with -DskipTests), so this PR's main behaviour change is verified only by local Maven runs.
Not reviewed: macOS and Windows Test lanes — Test (macos-latest, Node 22.x) and Test (windows-latest, Node 22.x) were skipped in CI while the PR's own test plan leaves those platforms to CI; the changed TypeScript ran only on ubuntu-latest and in local Linux runs, which matters for the filesystem-permission paths behind R1-3 and R1-4 (chmod/EACCES semantics differ on Windows).
Not explored to full depth (tool budget reached): "agent 1c": tracing LocalManagedSessionAuthority.close() to the appendTransaction throw site at managed-session-authority.ts:3196 (finding 2's confidence rests on it)….
中文说明
仅完成部分审查,审查缺口已披露。
未审查(原文为英文):test-efficacy probe — the probe harness produced no parseable runner output for all 7 probes (harnessValidated: null, every verdict inconclusive/no-output, 11 hunks skippedForCap and 6 skippedForBaseline), so mutant survival and hunk necessity were never measured for this diff; test-strength conclusions here rest on the verifiers' own hand-run mutants (R1-6, R1-7, R1-9), not on the probe.
未审查(原文为英文):Java MySQL and recovery profiles — mysql-integration, hosted-harness-mysql, o4-mysql-gates, fault-gates, hosted-process-crashes, operator-recovery and workspace-maintenance-recovery were not run (no MySQL 8.4 instance available in this environment), and no CI lane executes the Java half on a pull_request event at all (sdk-java.yml has no pull_request trigger; the reference-distribution job builds with -DskipTests), so this PR's main behaviour change is verified only by local Maven runs.
未审查(原文为英文):macOS and Windows Test lanes — Test (macos-latest, Node 22.x) and Test (windows-latest, Node 22.x) were skipped in CI while the PR's own test plan leaves those platforms to CI; the changed TypeScript ran only on ubuntu-latest and in local Linux runs, which matters for the filesystem-permission paths behind R1-3 and R1-4 (chmod/EACCES semantics differ on Windows).
未探索到全部深度(达到工具调用预算):"agent 1c":tracing LocalManagedSessionAuthority.close() to the appendTransaction throw site at managed-session-authority.ts:3196 (finding 2's confidence rests on it)…。
— qwen3.8-max via Qwen Code /review (v0.25.2)
|
Local verification: 中文摘要结论:merge-ready——14/14 条脚本化断言全部通过。
Central claim — A/B proofThe generation-churn exemption (a bound Session's Turn retried forever while its Harness restarted between attempts) now lapses after 4 budgets without journaled progress: 20 consecutive failures pre-admission, 40 post-admission. Head test files were run verbatim against each production build (3 named Java suites):
The 5 base-side reds: Mutation matrix — 10/10 killed by the PR's named testsEach fix hunk was reverted in place on the head tree (mutation verified landed before the run), the named suite run, then the file restored; final
M2's red set is itself informative: with the exemption gone, even the healthy single-generation-change case ( Targeted gates
FindingsNone. No correctness, coverage-attribution, or vacuity issues found. (One harness-side false green during the round — a perl Not coveredFull Java suite (only the 3 PR-named classes, 177 tests), MySQL/MariaDB Methodologyaarch64 Linux, JDK 21, Maven 3.9.0, Node v24.13.0, pnpm 11.24.0. Worktrees at the resolved |
doudouOUC
left a comment
There was a problem hiding this comment.
EN
Reviewed at head e6e82153 (the merge of origin/main; the content is still a659033). I traced the two behavior changes to ground rather than reading the diff: the churn cap is exhaustive (exactly one terminal arm fires, scheduleTurnRetry unreachable in that state), it reads the raw counter for the reason you give, fail() re-reads and cancels before failing, and failTurn's owner/status/lease guard plus the conditional UPDATE mean a racing writer cannot double-fail a Turn or leave a terminal row reading as running. I also confirmed the terminal codes the new tests assert are the ones the exception hierarchy produces, that both record fixtures use the right field order, and that the times(3) Action-read pin and the new dispose-race witness really do reach what they claim (the halt bound is 10 × slots, so the old 10-slot test was indeed short of 100). The close() cause attachment and the contract/docs work check out against the code as well.
Two things I'd want an answer on, both Suggestions.
1. The client half of R2-18 comes back. action_response_decision_expired can only be recorded while the projected Action is still requested and past its deadline — settled() returns false only for requested, and the module comment says Java keeps no expiry scanner — so the service keeps returning that Action from the pending list, which filters on state = 'requested' alone (ManagedActionStore:379, through listWebShell and the provider's listPending). The hook drops the card and re-reads, but on the next successful read it un-hides any Action the service still lists (use-managed-actions.ts:143-152, by design: "a wrong report cannot hide an approvable Action"), and it clears the answer warning first (:255-258). Net effect in the real service: the card comes back, this time without the warning — the same dead retry, minus the explanation. The new test only passes because its second page is mocked empty (use-managed-actions.test.tsx:679); with the Action still listed, expect(hook.latest?.action).toBeUndefined() fails. I think this is the same missing terminal signal you split to #14351, so it may just need one sentence in the body — and if the empty second page stays, a comment saying it is an assumption rather than what the service answers.
2. What the churn cap is counting. The cap compares the raw consecutiveFailures(), and scheduleTurnRetry increments that for every retry including the exempt ones, so it also counts the lease-bounded recovery 409s and the await_action wait — the two waits you deliberately keep exempt because "charging it against this Turn would terminally fail a wait that is still resolving on its own". Concretely: a Turn whose recovery attaches all answer the lease-bounded 409 while a live predecessor holds the Session (charged failures stay 0) reaches consecutive_failures == 20, and the next, single, healthy generation change trips the cap and fails it with hosted_harness_unavailable, even though nothing churned and the lease it was waiting on had not lapsed. Your D9a text names consecutive_failures, so this may be exactly what you intend — I'm asking rather than asserting — but if it is, the code comment and the body could say the cap bounds the whole no-progress run rather than churn, because the code it publishes names the Harness for a wait that was a predecessor's. If it is not intended, the cap needs a generation-only counter (budgetExemptFailures is not per-reason).
3. Minor, contract versioning. gh pr checks already reports it: API contract version uniqueness (latest main) says "1.52.0 is unique against main; also claimed by open PRs: #14318", and #14318's head document does declare 1.52.0. Per check-contract-open-prs.js, whichever lands second goes red and has to rebump. The body covers 1.50/1.51 being taken but not this one; worth settling before merge.
On evidence: I reviewed statically and ran nothing, and note that this PR's Java half has no CI lane at all (sdk-java.yml has no pull_request trigger; the reference-distribution job uses -DskipTests), so the churn cap and the three Java test files rest on your local Maven report plus my reading. A workflow_dispatch run of sdk-java.yml at this head, or the module's own mvn -Pmysql-integration verify, is the only independent check available. For finding 1, a two-line change to the test's second mocked page would show it in seconds.
中文
按 head e6e82153 审阅(合入 origin/main 的合并提交;内容仍是 a659033)。我没有只看 diff,而是把两处行为改动追到底:上限是穷尽的(两个终态分支必有一个生效,该状态下 scheduleTurnRetry 不可达),判的是原始计数器(符合你给的理由),fail() 会先重读并取消再终结,而 failTurn 的 owner/状态/租约守卫加上条件 UPDATE 意味着竞态写入者无法重复终结一个 Turn,也不会留下"终态却读作运行中"的行。我也核实了新测试断言的终态码就是异常继承结构会产生的那个、两个 fixture 的字段顺序、times(3) 的 Action 读取钉点,以及新的 dispose 竞态见证确实触达了它声称的守卫(停机阈值是 10 × 槽位数,所以旧的 10 槽用例确实够不到 100)。close() 挂 cause 与契约/文档部分也都与代码对得上。
有两点希望有明确答复,都是 Suggestion。
1. R2-18 的客户端那一半会回退。 action_response_decision_expired 只可能在投影中的 Action 仍是 requested 且已过期时被记录 —— settled() 仅对 requested 返回 false,且模块注释写明 Java 自己不做过期扫描 —— 所以服务端会继续把这个 Action 放在待处理列表里返回(该查询只按 state = 'requested' 过滤,见 ManagedActionStore:379,经 listWebShell 与 provider 的 listPending)。hook 会移除卡片并重新读取,但下一次读取成功时,它会主动取消隐藏服务端仍在列出的 Action(use-managed-actions.ts:143-152,这是刻意的:"错误的报告不能藏住一个可批准的 Action"),并且此前已把应答警告清掉(:255-258)。真实服务端上的净效果是:卡片又回来了,这次连警告都没有 —— 同一次无效重试,只是少了说明。新测试之所以通过,仅仅是因为它把第二次读取 mock 成空页(use-managed-actions.test.tsx:679);若 payload 仍列出该 Action,expect(hook.latest?.action).toBeUndefined() 就会失败。我理解这与你已经拆到 #14351 的"缺少终态信号"是同一个根因,所以在描述里补一句就够了;如果保留这个空页 mock,最好注明它是假设而非服务端的实际应答。
2. 上限到底在数什么。 上限比较的是原始 consecutiveFailures(),而 scheduleTurnRetry 会为每一次重试(包括豁免的那些)递增它,因此它同时把受租约约束的 409 恢复等待与 await_action 等待都算了进去 —— 而这两类正是你刻意保留豁免的理由:"把它算在这个 Turn 上会终结一个仍在自行收敛的等待"。具体场景:一个 Turn 的恢复挂接一直收到受租约约束的 409(有活跃的前任持有 Session,计费失败数恒为 0),于是 consecutive_failures 达到 20,接着一次健康的 generation 变化就会触发上限,以 hosted_harness_unavailable 终结它 —— 尽管并没有任何 churn,而且它所等待的租约尚未过期。你的 D9a 文案写的是 consecutive_failures,所以这可能正是你的本意,我是在提问而不是断言;但如果是,代码注释与描述最好说明该上限约束的是"整段无进展运行"而不是 churn,因为它发布的码指向 Harness,而那个等待其实属于前任。若不是本意,就需要一个只统计 generation 失败的计数器(budgetExemptFailures 并不按原因区分)。
3. 次要:契约版本冲突。 gh pr checks 已经报出来了:API contract version uniqueness (latest main) 写的是 "1.52.0 is unique against main; also claimed by open PRs: #14318",而 #14318 的 head 文档确实声明 1.52.0。按 check-contract-open-prs.js,后合入的那个会变红并需要重新 bump。描述里说到了 1.50/1.51 被占用,但没提这一条;建议合入前先定下来。
关于证据:本次是静态审阅,我什么都没跑;同时注意本 PR 的 Java 部分在 PR CI 上完全没有通道(sdk-java.yml 没有 pull_request 触发器,reference 发行版作业带 -DskipTests),所以 churn 上限与三个 Java 测试文件只有你本地的 Maven 报告加上我的阅读作为依据。在该 head 上以 workflow_dispatch 触发 sdk-java.yml,或跑模块自己的 mvn -Pmysql-integration verify,是唯一可得的独立验证。第 1 点只需改动测试第二次 mock 的那一页,几秒即可验证。
wenshao
left a comment
There was a problem hiding this comment.
Reviewed the full diff at e6e821533e5a13a14b63931fe02a595c11722f43 against 52ae53b02a17d6214e9e4f81578f2ba2725539a6. Please fix the approval regression before merging. I rechecked the existing Critical threads against this exact head rather than opening duplicate threads.
-
[P2] Preserve the failure when an expired approval is still listed — R1-2 still stands. Adding
action_response_decision_expiredtoENDED_ACTION_CODESmakesrespond()resolve without ananswerError. However, the server completes the response operation while the Action remainsrequested, and the pending query still returns that row. The next read removes the ID fromanswered, bringing the unusable card back with no explanation. A focused test mounting the actual hook with a past deadline and the same Action on both reads produced{"outcome":"resolved","pendingReads":2,"visibleAction":"tool_approval_1","answerError":null}. The new committed test instead returns an empty second page, so it misses this path. Preserve the failure until the card can actually be removed, and cover the still-listed case. Existing thread. -
R1-1 disposition: the zero-budget behavior is confirmed; whether it is a defect needs an explicit policy decision. With pre/post budgets both
0and all counters0, the first generation exception callsfailTurnin both phases, cancelling first after admission. The cap is already reached because0 >= 4 * 0. This changes the previous generation exemption, but the existing configuration test explicitly says zero budgets disable retries entirely. I therefore would not independently classify this as an unambiguous Critical without clarifying whether zero should preserve that exemption. Add explicit pre/post zero-budget coverage and align the “single generation change behaves exactly as before” claim with the intended behavior; if preserving recovery is required, the cap needs a positive bound independent of a zero charged-retry budget. Existing thread.
Validation: JDK 21 AdmittedTurnRetryTerminalStateTest passed 24 tests; the existing use-managed-actions.test.tsx passed 32 tests with a minimal jsdom/Vitest config. The focused zero-budget tests failed both assertions that the first generation wait should retry; the hook test failed its assertion that the card must either stay hidden or retain its error. git diff --check, the contract-version check (1.51.0 → 1.52.0), and a structural check that OpenAPI changed only version/descriptions passed. No production source was changed. Full build/typecheck, MySQL/fault profiles and a live Hosted Harness E2E were not run in this review.
中文说明
已按上述精确提交审阅全部差异。建议先修复审批回归再合入:R1-2 仍成立,真实 hook 定向测试确认,应答 Promise 成功返回、同一过期卡片重新显示、错误提示为空。服务端的 operation 终态不会把 Action 从 requested 移走;新增测试把第二次列表设为空,因此没有覆盖实际失败路径。
R1-1 的行为也已复现:零预算下,首次 generation 异常就会终结 Turn,已准入时先取消。但既有配置测试又明确写着“零预算禁用重试”,因此我将它记为需要明确的配置语义,而不是无歧义的新阻塞项。应补充准入前后零预算用例,并使“单次 generation 变化保持原行为”的描述与实现一致。
本次独立运行的 Java 既有测试 24 项、Hook 既有测试 32 项通过;两项零预算重试断言及一项审批可见性/错误提示断言失败,复现了上述行为。契约版本和结构检查通过;未运行完整构建、类型检查、MySQL/故障 profile 或真实 Hosted Harness E2E。
- Floor the generation churn cap at a budget of one, so a zero budget still re-attaches across a single Harness change (R1-1). - Derive the generation wait from the exception instead of a positional flag and drop the delegating overload (R1-5). - State that the cap bounds the whole run without journaled progress, whatever wait filled it, in the code and in D9a (R1-8), and pin the counter with a mixed-history row (R1-6). - Reject a close whose seal and activation release both fail with an AggregateError instead of annotating the seal error, which the lease memoizes and hands back to later seals (R1-3, R1-4). - Leave action_response_decision_expired out of the WebShell hook's ended codes: the service keeps listing the Action, so hiding the card only dropped its reason (R1-2); the test uses a fixture the service can produce (R1-9). - Stub lease renewals to succeed and raise the renewal floor so the period mutant fails (R1-7).
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
…close fails twice Review round 1 made a close whose activation release and writer seal both fail reject with a plain AggregateError. The Hosted load route awaits that close on its refusal branches and classifies the rejection by class, so a fenced writer whose cleanup also hit the writer conflict answered the generic 503 managed_session_open_failed instead of the 409 managed_session_writer_conflict the coordinator exempts from the Turn retry budget. The double failure now rejects with ManagedSessionCloseError, still an AggregateError holding both failures, which exposes the seal failure as sealError. The load route classifies on that seal error and logs the wrapper, so neither failure is lost and the memoized seal rejection stays untouched. A route test covers both a seal-only and a double failure.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
🩺 serve daemon A/BBuilt the PR base vs this PR head ✅ No response changes against the PR base across 12 scenario(s). — Qwen Code · serve A/B |
…ate-followups #14318 landed contract 1.52.0 first, so this PR moves to 1.53.0 and its description sentence is renamed "v1.53 enumerates". The regenerated WebShell client matches the auto-merge. # Conflicts: # packages/managed-agent-server/src/main/resources/openapi/managed-agent-public-api.openapi.json
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
wenshao
left a comment
There was a problem hiding this comment.
Re-reviewed 4024f69028df5b8507376d78fc68799139b60a7c against base b4614845f016ba4e74e38536ce0d98a61d7e764d, including the changes since my previous review and their consumers. My previous P2 is fixed; I found no new blocking correctness issue. This supersedes the blocking conclusion in my previous review.
The close-classification fix is verified on the actual cold-load route, rather than inferred from the resolved thread:
- The original independent reproduction now returns
409 managed_session_writer_conflictfor both seal-only and release-plus-seal writer conflicts. - A contrasting case, where release reports writer-conflict but seal reports an ordinary storage error, correctly returns
503 managed_session_open_failed. The route classifies the seal failure, not whichever nested error happens to be retryable. - The committed route cases pass, including wrapper logging and a successful later load after the one-shot failure clears. The assembly preserves both original error objects, the existing seal cause, and the memoized seal rejection without mutation.
I checked the new error's construction/read sites and the other close consumers: the config recorder adopts its lease and returns before these close steps; Hosted DELETE retains its existing generic close-failure handling and writer-sealed deregistration rule. The changed open/load handler continues operating on the requested Session's resolved stores; the change does not add a runtime fallback or alter authorization. The earlier zero-budget and still-listed approval fixes are unchanged from the previous verified head. The main merge preserves the fix, and the OpenAPI delta against the new base remains version/descriptions only, now advancing 1.52.0 to 1.53.0.
Independent checks this round: 20 tests passed — 3 independent route scenarios, 2 committed route cases, and all 15 assembly tests. Contract-version, structural-contract, changed-file formatting and git diff --check checks also passed.
Evidence limits: these are focused source tests using the existing local Store fixture and injected failures, not a live Java Store fencing race. The review configs bypass the missing built-dist guard and stub an unused model-config loader to throw if called; no stale assembly build was substituted. I did not rerun the unrelated Java/Hook suites or perform a full build/typecheck, Maven verify, MySQL/fault-profile or live Hosted Harness E2E this round. No production code was changed during review.
中文说明
上轮 P2 已在最新提交修复,本轮未发现新的正确性阻塞问题。原来的真实冷加载复现现在在单 seal 失败和双 writer-conflict 失败时都返回 409;补充控制证明,release 为 writer-conflict、seal 为普通错误时仍正确返回 503,不会误给恢复豁免。两项提交内路由测试和 15 项 assembly 测试也通过,共 20 项。
同时检查了其他 close 调用方、main 合并影响和契约版本。之前的零预算与审批错误提示修复保持不变;契约已正确升到 1.53.0。测试边界如上,未将定向测试表述为完整构建或分布式 E2E。
|
@qwen-code /triage |
|
Sandboxed verification: ✅ passed — merge-ready (agent verdict) - workflow run Ran the PR in an isolated, token-free container: A/B against the base build, mock-free harness assertions, targeted gates. Advisory evidence for human reviewers — not a review, an approval, or a CI check. Scripted assertions: 31 passed · 0 failed · 31 total Flakiness gate: ✅ 5 changed test file(s) x 5 identical rounds, no divergence 中文 — 判定:✅ 通过 · 可合入(agent 判定)沙箱验证在隔离、无凭证的容器中执行了该 PR 的代码(与 base 构建 A/B 对照、无 mock harness 断言、定向门禁)。仅作为评审证据,不构成评审、批准或 CI 检查。 脚本断言:31 通过 · 0 失败 · 31 总计 抖动门:✅ 5 changed test file(s) x 5 identical rounds, no divergence Verification reportPR 14358 — Deep VerificationVerdict: Two non-blocking Suggestions (an unpinned overflow guard and an unreachable 中文摘要结论: A/B 结论(中心主张:generation 豁免上限)。 在 新增轴向探针。 作者用例只覆盖预算 5 与 0。另建一次性探针类补齐坐标轴:预算 1(上限 4)、预算 3(上限 12)、准入后预算与准入前不同(pre=2/post=5,上限取 post 的 20)、以及 变异矩阵。 Java 侧 8 个变异体 + 1 个未变异对照(同一 runner 下 185/185 全绿,证明 runner 有效):J1 关闭上限→7 红;J2 改读 门禁全绿。 core / cli / web-shell 三处 未覆盖范围(要点)。 本 lane 无数据库,MySQL/MariaDB failsafe 集成测试(作者自述 676 个)未运行; Central claimA Hosted Harness generation change on a workspace-bound Session, previously Secondary claims verified: (S1) a managed-Session close that fails both to Scenario axes named before choosing the instrument (the diff changes how a Turn
Every other setting is under Not covered. A/B — Java, the three changed test classesControl:
The 8 base-side failures fall in exactly four methods, and each fails its
Witness: A/B — axis probe (settings the committed rows collapse)A scratch JUnit class (created, run on both arms, then deleted; it is in no
The four retry-expecting rows are green on both arms by construction (base
Witness: Mutation matrixJava, all judged by the identical runner (three test classes, 185 tests). The
Five of these are the same mutants the PR description lists, and the TypeScript, 5/5 killed, each on its intended assertion:
T1 is deliberately interface-preserving: T5 independently confirms the PR's test-strength claim. Under the mutant Witnesses: FindingsAll three are Suggestion-level. None is a defect in the shipped behaviour, and F1 — the
|
yiliang114
left a comment
There was a problem hiding this comment.
Re-reviewed 4024f690 against base b4614845. No blocking correctness or security finding — approving.
I traced the production hunks rather than the test/doc surface:
- Close path.
ManagedSessionCloseErrorcarries the seal and release failures while leaving the seal error itself untouched, so the memoized rejection the lease hands to a later seal is not mutated. The reachable shapes keep the old contract: a release-only failure still rejects with the release error, a seal-only failure with the seal error, and the double failure now with both instead of losing the release failure to the seal. - Open/load route. The classification reads
sealErroronly, so a fenced writer still answers409 managed_session_writer_conflictwhile an ordinary seal failure stays503, and the wrapper still reaches stderr. ActionResponseCoordinator.deliver. Hoisting the single Action read preserves the previous absent-row behaviour (settledalready read it unconditionally and threw) and makes the settle and expiry verdicts read one row version.- Generation churn cap.
Math.max(1, budget)floors the cap so a zero-budget deployment still re-attaches on one change, andgenerationChurncan only be true on the two exhaustion arms, so theexemptflag handed toscheduleTurnRetryis unchanged on every path that can reach it.
Two non-blocking points, both already raised and answered in-thread, so I am not re-posting them:
- The cap reads raw
consecutive_failures, so a Turn that spent a long run on lease-bounded 409 waits can be terminated by one later healthy generation change; the mixed-history row ofHarnessCoordinatorTestpins which counter the gate reads, and the code comment plus D9a (both languages) state this is the intended bound. - The client half of the expired-decision case still needs the terminal signal tracked in #14351; the PR body discloses that gap.
reviewDecision stays CHANGES_REQUESTED on the round-1 bot review 5548703755, which is pinned at the superseded e6e82153; 0 review threads are open at this head. This APPROVE does not clear it.
中文说明
按 head 4024f690(base b4614845)复审,未发现 P0/P1 阻塞,投 APPROVE。
只追了生产代码那几段:close 路径(ManagedSessionCloseError 同时保留 seal 与 release 两个失败,且不改动 seal 错误本身,因此租约交给后续 seal 的记忆化拒绝不会被污染;释放失败、封印失败、双失败三种形态与旧契约一致,双失败不再把 release 失败丢掉);open/load 路由按 sealError 分类(fenced writer 仍回 409,普通封印错误仍回 503,wrapper 仍进 stderr);ActionResponseCoordinator 的 Action 单次读取(缺失行行为与原来一致,settle 与 expiry 判定读同一行版本);generation churn 上限(Math.max(1, budget) 让零预算部署仍能重挂,generationChurn 只可能在两条耗尽分支为真,所以传给 scheduleTurnRetry 的 exempt 在所有可达路径上不变)。
两条非阻塞项都在线程里提过并已答复,不重复发帖:上限读原始 consecutive_failures(作者在注释与 D9a 里写明为刻意口径,测试的 mixed-history 行钉住读的是哪个计数器);过期决策的客户端那一半仍需 #14351 的终态信号(正文已披露)。
reviewDecision 仍为 CHANGES_REQUESTED,来自钉在旧 head e6e82153 的第 1 轮 bot 评审 5548703755;当前 head 上 0 条未解决线程。本次 APPROVE 不会清掉它。
qqqys
left a comment
There was a problem hiding this comment.
Reviewed at head 4024f69028df5b8507376d78fc68799139b60a7c (base main). Critical-only, inside a bounded budget. APPROVE. Evidence was taken by fetching refs/pull/14358/head and reading with git show / git grep at that sha plus GitHub's own per-file patches for the PR's diff, not from the working tree and not from the author's or another reviewer's characterisation. (A git diff against my locally fetched upstream/main merge base pulled in main-side content here, so every diff statement below comes from the pulls-files patches or from git show at the head sha.)
The production surface is small and I read all of it: three TypeScript files (hosted-harness-session.ts +13/−1, managed-session-assembly.ts +41/−6, use-managed-actions.ts +6), three Java files (HarnessCoordinator.java +39/−6, ActionResponseCoordinator.java +17/−9, ManagedAgentStore.java +7/−3), and the contract pair.
Both sev:"C" findings are fixed, verified in source at head
R1-1 — a configured retry budget of 0 collapsed the generation churn cap to 0. HarnessCoordinator.java:1160-1168 at head:
boolean generationWait = error instanceof HostedHarnessGenerationException;
int budget = submissionAttempted ? maxPostAdmissionRetries : maxPreAdmissionRetries;
boolean generationChurn = generationWait && exemptFromRetryBudget
&& current.consecutiveFailures() >= (long) Math.max(1, budget) * GENERATION_CHURN_BUDGET_FACTOR;Math.max(1, budget) floors a zero budget to one, so the cap is 4 rather than 0 and a single generation change still re-attaches; the (long) cast keeps the product from overflowing an int at a large configured budget. The new GENERATION_CHURN_BUDGET_FACTOR = 4 carries the reasoning, including that the wait is read off the failure itself so no caller can route a generation change past the cap.
I also checked the change does not widen the terminal arms for anything else. Both arms went from !exemptFromRetryBudget && chargedFailures >= max*Retries to !exempt && (chargedFailures >= max*Retries || generationChurn), where exempt = exemptFromRetryBudget && !generationChurn. For every failure that is not a HostedHarnessGenerationException, generationChurn is false, exempt collapses back to exemptFromRetryBudget, and the disjunct adds nothing — so the condition reduces to the original expression and no previously exempt wait family became terminal.
R1-2 — action_response_decision_expired was listed as an Action end-state although it is an operation-level failure. use-managed-actions.ts at head defines ENDED_ACTION_CODES as exactly action_expired, action_cancelled, action_already_resolved; action_response_decision_expired is absent, with the reason recorded at the site — the service records that code while the Action is still requested, so the pending list keeps returning it and a hidden card would reappear on the next read without its reason, whereas the rejection keeps the reason on screen until the Action's end projects (the missing terminal signal is #14351). endedAction() reads code defensively, so a non-string or absent code answers false. use-managed-actions.test.tsx:689 exercises that code, so the classification is pinned rather than merely commented. The server keeps emitting it (ActionResponseCoordinator.java:214, ManagedActionStore.java:439).
The close-classification fix, and why the old shape was wrong
managed-session-assembly.ts replaces a try/catch/finally with two sequential try blocks and a new ManagedSessionCloseError extends AggregateError carrying sealError and releaseError. The old shape rethrew the release failure from the catch and ran the seal in a finally; a finally that throws replaces the in-flight exception, so when both failed the caller saw only the seal error and the release failure survived solely as a debug line that is off by default. The new shape covers all four combinations: both succeed → resolves; release fails, seal succeeds → throws releaseError; release succeeds, seal fails → throws sealError; both fail → throws the wrapper with both. The invariant the finally existed for is preserved rather than lost — the release catch no longer throws, so control always reaches authority.close() and the seal still runs after a failed release. The seal error object is deliberately left unmutated (no cause written onto it in place), which is right: the lease hands the same memoized rejection to every later seal and the seal often carries a cause of its own.
hosted-harness-session.ts then classifies on the seal failure: in the open/load handler's catch it logs a sanitized line for the wrapper and sets const cause = thrown instanceof ManagedSessionCloseError ? thrown.sealError : thrown; before the existing isRetryableWorkspaceAcquisition(cause) → 409 cause.code chain. For any throw that is not the wrapper, cause === thrown and the classification is byte-identical to before, so nothing else moved; for the wrapper, a fenced writer answers its self-healing 409 instead of the generic 503, which is the finding. That the classification reads the seal error and not whichever nested error happens to be retryable is what keeps the contrasting case honest — a release that reports writer-conflict while the seal reports an ordinary storage error still answers 503.
The other two Java changes carry no behaviour change
ActionResponseCoordinator.java consolidates two reads of the same Action into one, so the settle check and the expiry check are decided against a single row version. I checked the failure direction rather than assuming equivalence: the new action(op, response) uses orElseThrow(), and the old settled(op, response) began with the same actions.find(...).orElseThrow() before any early return — so an absent Action row threw at the same point before and after, and the old decisionExpired's orElse(0L) arm was already unreachable for that case. The expiresAt > 0 && guard survives, so a row without a positive expiry still means "not a deadline, keep waiting". ManagedAgentStore.java is comment-only: the SQL (operation_kind IN ('CLOSE','ARCHIVE','DELETE','CWD_CHANGE') and the state list) appears as unchanged context in the patch, and the comment now names CWD_CHANGE as a delivered kind, which is what the predicate already did.
Contract and generated client agree
The OpenAPI delta is the failure_code description enumerating what a lifecycle operation can end with once its retry budget runs out, advancing the contract to 1.53.0, and the generated client's failureCode @description in packages/web-shell/client/components/managed/generated/managed-agent-api.ts carries the same sentence — so the regenerated client matches the contract rather than drifting from it. API contract version uniqueness (latest main) passes at this head and reports "1.53.0 is unique against main", with the advisory that open PRs #14404 and #14405 also claim 1.53.0; whichever merges later will need to renumber. That is a coordination note between open PRs, not a defect in this diff, and the lane does not block on it.
Historical blocking findings and CI
The bot's round-1 ledger is the source of the standing CHANGES_REQUESTED, and its two sev:"C" items are R1-1 and R1-2 above — both verified fixed at head. Its remaining items are sev:"S" (the seal-cause guard, the in-place cause write, the generationWait parameter shape, the cap reading consecutive_failures, and three test-strength items); under this channel's rules I did not track them, and two are in any case resolved by the code I read: the cause is no longer written in place, and the cap's use of consecutive_failures is now documented at the constant as intended — it bounds the whole run without journaled progress that ends on a generation wait, whichever wait family filled the run, which fails bounded rather than retrying forever. The two Copilot reviews are quota-exceeded stubs with no findings, and the maintainer's newest review at this head reports his previous P2 fixed with an independent route-level reproduction and a contrasting control; I verified that fix in source myself rather than relying on it.
No failing lane attributable to this diff: Test (ubuntu-latest, Node 22.x) pass 28m42s — this is the lane that executes the changed TypeScript suites, so the assembly, route, scheduler and use-managed-actions tests really run at this head — with Lint & Static pass 14m28s, Integration Tests (no-AK, No Sandbox) pass 9m31s, Serve A/B pass 19m30s, Capture web-shell visuals pass 27m32s, TUI parity snapshots and OpenTUI no-flicker gate pass. Build and verify reference distribution shows red but is a cancellation, not a failure: gh api actions/jobs/117148568863 reports conclusion: "cancelled", its only non-success step is skipped, and no log exists for it — so there is no evidence of a build break and, per this channel's rules, a cancellation not attributable to the diff is summarised and never a gate on its own. review-pr is pending; I did not wait on or poll it.
Disclosed limit. No lane on a pull_request event runs Java, so HarnessCoordinator's churn cap, ActionResponseCoordinator's consolidated read and the three Java test files (AdmittedTurnRetryTerminalStateTest +94, HarnessCoordinatorTest +62, OperationRetryTerminalStateTest +40/−11) have no PR CI execution, and no JRE exists on this machine, so I ran nothing. My Java conclusions come from reading the patches and the head source, including the default-path reductions above; the churn cap's actual behaviour at budget = 0 and the generation-wait retry counts rest on the author's and reviewer's local runs. A runtime-only fault in the cap's arithmetic under a real retry sequence would surface on the nightly Java lane, not here.
qwen-code-review-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship. ✅
#14358 landed contract 1.53.0 first, so the D7-1 note moves to v1.54 and the contract to 1.54.0. Both failure_code descriptions keep main's lifecycle wording and add the submit_input and cancel failures; the WebShell types are regenerated.
|
Released in v0.25.3. |





What this PR does
This PR lands the Suggestion-level findings that #13219 recorded as "not in this PR" under its post-round-5, Critical-only rule (see the deferral log). It covers the 18 review threads that were still open when #13219 merged. Each item was re-checked on current main first. One goes to its own issue, and the rest are fixed here.
Behavior changes
hosted_harness_unavailableorhosted_harness_unavailable_after_admission, and an admitted Turn is still cancelled first. The cap counts every attempt of that run, whatever wait filled it, and a zero budget is floored to one, so even then a single change still re-attaches (R1-1, R1-8 of this PR's review). A single generation change, or any run below the cap, behaves exactly as before. No new public code is introduced.ManagedSessionCloseError, anAggregateErrorthat holds both, names both in its message and exposes the seal failure assealError. A caller that classifies a close failure reads that seal error: when a fenced writer's load is refused and its cleanup fails both ways, the Hosted load route still answers409 managed_session_writer_conflict, whose wait the coordinator exempts from the Turn retry budget, instead of the generic503 managed_session_open_failed(review round 2). The route logs the wrapper, so both failures still reach the daemon log. Previously the release failure survived only as a debug line, and debug logging is off by default. The seal error itself is left untouched: the lease hands the same memoized rejection to every later seal, and the seal often carries a cause of its own (R1-3, R1-4 of this PR's review). A seal-only or release-only failure still rejects with the original error.action_response_decision_expiredas an ended Action and hid the card. Review showed that the service records that code while the Action is stillrequested, so the list keeps returning it, and the card came straight back without its reason (R1-2). The hook keeps main's behaviour, where the answer rejects and the reason stays on screen, now pinned by a test that uses a fixture the service can actually produce (R1-9). Making the card leave needs the terminal signal tracked in fix(web-shell): an approval whose response delivery failed after 202 stays hidden until reload #14351.Contract 1.53.0 (R2-2, R2-16, R2-17, R3-4)
failure_code/failureCodenow list every code a lifecycle operation can end with once its retry budget runs out:session_lifecycle_delivery_failed,managed_capability_mismatchandhosted_harness_protocol_errorfor a refused negotiation, a workspace close or lifecycle refusal, another Runtime Broker refusal code, andsession_close_completion_unsettled.runtime_broker_recovery_blockedrefusal is reported asworkspace_close_identity_unverified.session_close_writer_liveis also reported while the journal-writer check itself fails. That check fails open, so the operation keeps waiting in that case.Docs (both languages)
recovery_blockedpublication is described as triggered by the raw attempt count, which includes the waits' own exempt attempts (R2-9).recovery_blockedoutcome is removed (R1-26).Tests. Each new or strengthened witness was checked red against the mutant it pins:
atLeast(8)lease renewals, each stubbed to succeed, across a slowresolveAction, instead ofatLeastOnce()(floor and stub corrected in R1-7).Why it's needed
Reviewer Test Plan
How to verify
AdmittedTurnRetryTerminalStateTestandHarnessCoordinatorTest.aGenerationChangeStillRetriesPastThePostAdmissionBudget(10 and 39 failures) still retries exempt.aGenerationChurnPastTheCapFailsTheAdmittedTurn(40 and 57 failures) cancels the Turn, then fails it withhosted_harness_unavailable_after_admission.boundsTheGenerationExemptionBeforeAdmissiongives retry at 19 andhosted_harness_unavailableat 20 and 33. With a zero budget it retries at 0 and 3 and fails at 4, and a run of 20 with only 16 exempt waits fails at the cap.aZeroBudgetStillAdoptsAGenerationChangedoes the same after admission.node scripts/check-contract-version.js <main openapi> <head openapi>passes, and regenerating the WebShell client produces no diff beyond the committed one.Evidence (Before & After)
Non-UI change. Each witness below was run against its mutant, with the fix reverted in place, and goes red; with the fix it is green.
aGenerationChurnPastTheCapFailsTheAdmittedTurn,boundsTheGenerationExemptionBeforeAdmissionandaZeroBudgetStillAdoptsAGenerationChangefail (7 of 112)aGenerationChangeStillRetriesPastThePostAdmissionBudget[10, 39],adoptsNextHarnessGenerationInsteadOfFailing, and the retry and cap rows fail (13 of 112)decisionExpiredre-reads the ActionanAnsweredResponseTerminatesOnceItsActionExpiredfails (times(3))/ 3dropped)theOperationLeaseIsRenewedAcrossASlowResolveActionfails (3 of 3 runs)rejects with both failures when the seal fails tooandleaves a memoized seal rejection untouched for a later closefailstopRenewal()removed from the head ofseal()lets a same-credential re-attach keep writing after a close-time seal failurefailsresets the failure streak on a created enqueue between failing claimsfails (worker halted)does not halt when disposal races the failure that reaches the boundfails; the old dispose test stays green, showing it never reached the guardENDED_ACTION_CODESkeeps the reason on screen when the answered delivery outlived the ActionfailsfalsebudgetExemptFailuresAggregateErroranswers a writer conflict when both the release and the seal fail while refusing a loadfails (503 for 409); the seal-only row stays greenFull runs:
qwencodeclean install: 252 passed, 9 skipped.managed-agent-server-Pmysql-integration clean verify checkstyle:check checkstyle:check@runtime-broker-checkstyle: 4041 unit tests passed, 105 skipped. 675 of 676 ITs passed. Both Checkstyle executions report 0 violations, and the failsafe report check passes.ManagedAgentMySqlIT#admitsHookExecutionsWithoutReadingTheirHistoryOnMySql("writer grant is stale", ~60 s). It fails identically on main on that box (2/2 on28415ddff3, 3/3 on37f8e851c7).3e376d06dc), on this box: themanaged-agent-serverunit suite ran 4199 tests, 10 skipped, with one error,WorkspaceCsiSessionMainTest#oldWorkspaceCreationDoesNotAcquireTheNewProfileOrRequestPin, which fails identically on the merge base52ae53b02a. Both Checkstyle executions are clean. The changed classes passed three runs each. The integration tests were not re-run: the round touches only the Turn retry decision, the WebShell hook, the close path and tests.df6e2f4685):hosted-harness-session.test.tsand its feat(managed-agent): a second concurrent Session on the same Workspace mount should queue, not fail the Turn terminally #13328 sibling pass 554 tests, the assembly suite passes 15, andtsc --noEmitis clean for core and cli.embedded-harness-scheduler,http-managed-session-storeandmanaged-session-assemblypass 146 tests.client/components/managed/passes 656 tests.tsc --noEmitis clean for core and web-shell, and eslint (--max-warnings 0) and prettier are clean on the changed files.check-contract-version.jsreports "1.53.0 advances past the base ref's 1.52.0" against current main, andcheck-flyway-migrations.jspasses.4024f69028): 988 targetedmanaged-agent-serverunit tests pass, among them the three retry/Harness classes,ManagedAgentApiContractTest,SurfaceAdmissionAcceptanceTestand the SSH Workspace and Runtime classes feat(managed-agent): Add SSH Tool Runtime support #14318 touched. Both Checkstyle executions are clean. TypeScript passes 1392 tests: web-shell managed 675, the twohosted-harness-sessionfiles 562, and core 155.tsc --noEmitis clean for web-shell and cli.Tested on
Linux only: this box (x86_64, JDK 25 for the Mockito unit tests, Node 22) and a Linux aarch64 box (JDK 21, MariaDB 10.11) for the full Java lane. macOS and Windows are left to CI. Java does not run on
pull_requestevents, so the Java results above are local runs.Environment (optional)
Unit tests and real-H2/MariaDB integration tests only; no live Hosted Harness.
Risk & Scope
SETTLED_COMPLETION_BUDGET_FACTORon the lifecycle side. Any journaled progress resets the run. The cap counts every attempt of the run, so a Turn that already waited four budgets on a predecessor's lease-bounded 409 or on an approval fails on the first generation change that follows (R1-8). A generation-only counter would need a schema change and is not part of this PR.Design documents touched: durable lifecycle (EN) / (zh-CN), replaceable Harness (EN) / (zh-CN). Both language copies are updated in the same places.
Round-14 body list triage (not changed here)
The round-14 review of #13219 also listed about 22 Suggestion candidates in its body, deferred under its convergence posture and never posted as threads. Each was checked against this branch:
recovery_blockedbullet (R1-26).createdhalf of the streak reset (R3-5).failure_codestaysplannedbecause "no lifecycle operation sets" it, while §4.6 documents it (both languages).++renewalsinside a polledwaitUntilpredicate inembedded-harness-scheduler.test.ts.writerSealedgetter is untested.HarnessCoordinator.fail()'s admission gate reads the Turn twice.retryDelayinline.LOCK_TIMEOUT.SessionLifecycleCoordinatorconstruction is copy-pasted at 37 sites.SessionLifecycleServiceResumeTeststubs an overload the service never calls.HostedHarnessClient:cause.protocolVersionstill surfaces as a bareDaemonProtocolException.Linked Issues
Follow-up to #13182 and #13219. Splits out #14351.
中文说明
这个 PR 做了什么
本 PR 落地 #13219 按"第 5 轮后只修 Critical"规则记为"本 PR 不做"的 Suggestion 级发现(见搁置记录),覆盖 #13219 合入时仍未关闭的 18 条评审线程。每一条都先在当前 main 上重新核实过:一条拆成单独的 issue,其余都在这里修复。
行为改动
hosted_harness_unavailable或hosted_harness_unavailable_after_admission失败;已准入的 Turn 仍会先被取消。该上限统计这段运行中的每一次尝试,不论由哪种等待构成;预算为零时按一计算,所以即便如此,单次变化仍能重新挂接(本 PR 评审的 R1-1、R1-8)。单次 generation 变化、以及低于上限的任何连续失败,行为与以前完全一致。没有引入新的公开错误码。ManagedSessionCloseErrorreject:它是一个同时包含两者的AggregateError,message 写明两者,并通过sealError暴露封存失败。对 close 失败做分类的调用方读取这个封存错误:writer 已被 fence 的加载被拒绝、且清理时两步都失败时,Hosted 加载路由仍回答409 managed_session_writer_conflict(coordinator 对这种等待不计入 Turn 重试预算),而不是通用的503 managed_session_open_failed(第 2 轮评审)。路由会记录这个包装错误,所以两项失败仍会进入 daemon 日志。以前释放失败只留在一条调试日志里,而调试日志默认关闭。封存错误本身不做任何修改:lease 会把同一个记忆化的拒绝交给之后的每次封存,而且封存错误通常自带 cause(本 PR 评审的 R1-3、R1-4)。只有封存失败或只有释放失败时,仍以原始错误 reject。action_response_decision_expired当作已结束的 Action 并隐藏卡片。评审指出,服务端是在 Action 仍为requested时记录这个码的,列表会继续返回它,于是卡片立刻回来,而且没有了原因提示(R1-2)。现在 hook 保持 main 的行为:应答 reject,原因留在页面上,并由一个使用服务端真实可能返回的 fixture 的测试钉住(R1-9)。要让卡片真正消失,需要 fix(web-shell): an approval whose response delivery failed after 202 stays hidden until reload #14351 跟踪的终态信号。契约 1.53.0(R2-2、R2-16、R2-17、R3-4)
failure_code/failureCode现在列出生命周期 operation 耗尽重试预算后可能带的全部失败码:session_lifecycle_delivery_failed;协商被拒时的managed_capability_mismatch与hosted_harness_protocol_error;workspace 关闭或生命周期拒绝;Runtime Broker 的其他拒绝码;以及session_close_completion_unsettled。runtime_broker_recovery_blocked拒绝报告为workspace_close_identity_unverified。session_close_writer_live。这个检查失败时按存活处理,因此 operation 会继续等待。文档(中英文同步)
recovery_blocked的发布改为按原始尝试次数触发,计入等待自身的豁免尝试(R2-9)。recovery_blocked结果的过时条目(R1-26)。测试。 每个新增或加强的见证都对其钉住的变异体验证过会变红:
resolveAction期间续约atLeast(8)次且每次都桩为成功,取代原来的atLeastOnce()(下限与桩在 R1-7 中修正)。为什么需要
评审测试计划
如何验证
AdmittedTurnRetryTerminalStateTest与HarnessCoordinatorTest。aGenerationChangeStillRetriesPastThePostAdmissionBudget(10 与 39 次失败)仍以豁免方式重试。aGenerationChurnPastTheCapFailsTheAdmittedTurn(40 与 57 次失败)先取消 Turn,再以hosted_harness_unavailable_after_admission失败。boundsTheGenerationExemptionBeforeAdmission在 19 次时重试,在 20 与 33 次时以hosted_harness_unavailable失败;零预算时在 0 与 3 次重试、4 次失败;20 次中只有 16 次豁免的运行也在上限处失败。aZeroBudgetStillAdoptsAGenerationChange在准入后做同样的检查。node scripts/check-contract-version.js <main openapi> <head openapi>通过;重新生成 WebShell 客户端不会产生已提交内容之外的差异。证据(前后对比)
非 UI 改动。下表每个见证都在原地撤销修复后对其变异体运行过,均变红;恢复修复后均为绿。
aGenerationChurnPastTheCapFailsTheAdmittedTurn、boundsTheGenerationExemptionBeforeAdmission与aZeroBudgetStillAdoptsAGenerationChange的上限行失败(112 个中 7 个)aGenerationChangeStillRetriesPastThePostAdmissionBudget[10, 39]、adoptsNextHarnessGenerationInsteadOfFailing以及重试行和上限行失败(112 个中 13 个)decisionExpired重新读取 ActionanAnsweredResponseTerminatesOnceItsActionExpired失败(times(3))/ 3)theOperationLeaseIsRenewedAcrossASlowResolveAction失败(3 次运行均失败)rejects with both failures when the seal fails too与leaves a memoized seal rejection untouched for a later close失败seal()开头的stopRenewal()lets a same-credential re-attach keep writing after a close-time seal failure失败resets the failure streak on a created enqueue between failing claims失败(worker 停机)does not halt when disposal races the failure that reaches the bound失败;旧的 dispose 用例依然通过,说明它从未触达守卫ENDED_ACTION_CODESkeeps the reason on screen when the answered delivery outlived the Action失败falsebudgetExemptFailuresAggregateErroranswers a writer conflict when both the release and the seal fail while refusing a load失败(得到 503 而非 409);仅封存失败的一行保持通过完整运行:
qwencodeclean install:252 个通过,9 个跳过。managed-agent-server-Pmysql-integration clean verify checkstyle:check checkstyle:check@runtime-broker-checkstyle:4041 个单测通过,105 个跳过;676 个集成测试中 675 个通过;两套 Checkstyle 均为 0 违规;failsafe 报告检查通过。ManagedAgentMySqlIT#admitsHookExecutionsWithoutReadingTheirHistoryOnMySql("writer grant is stale",约 60 秒)。它在那台机器上对 main 同样失败(28415ddff3上 2/2,37f8e851c7上 3/3)。3e376d06dc),在本机:managed-agent-server单测共运行 4199 个,跳过 10 个,1 个报错:WorkspaceCsiSessionMainTest#oldWorkspaceCreationDoesNotAcquireTheNewProfileOrRequestPin,它在 merge base52ae53b02a上同样失败。两套 Checkstyle 均干净;改动涉及的测试类各跑 3 次均通过。集成测试没有重跑:这一轮只改了 Turn 重试判定、WebShell hook、close 路径和测试。df6e2f4685):hosted-harness-session.test.ts及其 feat(managed-agent): a second concurrent Session on the same Workspace mount should queue, not fail the Turn terminally #13328 兄弟文件通过 554 个测试,assembly 套件通过 15 个,core 与 cli 的tsc --noEmit均无报错。embedded-harness-scheduler、http-managed-session-store、managed-session-assembly共 146 个测试通过。client/components/managed/共 656 个测试通过。tsc --noEmit干净;改动文件上的 eslint(--max-warnings 0)与 prettier 干净。check-contract-version.js对当前 main 报告 "1.53.0 advances past the base ref's 1.52.0",check-flyway-migrations.js通过。4024f69028):managed-agent-server988 个定向单元测试通过,包括三个重试/Harness 类、ManagedAgentApiContractTest、SurfaceAdmissionAcceptanceTest,以及 feat(managed-agent): Add SSH Tool Runtime support #14318 改动的 SSH Workspace 与 Runtime 类。两项 Checkstyle 均无违规。TypeScript 共 1392 个测试通过:web-shell managed 675 个,两个hosted-harness-session文件 562 个,core 155 个。web-shell 与 cli 的tsc --noEmit均无报错。测试平台
仅在 Linux 上验证:本机(x86_64,Mockito 单测用 JDK 25,Node 22)和一台 Linux aarch64 机器(JDK 21,MariaDB 10.11)跑完整 Java lane。macOS 与 Windows 交给 CI。Java 不在
pull_request事件上运行,因此上面的 Java 结果都是本地运行结果。环境(可选)
仅单测与真实 H2/MariaDB 集成测试,没有接真实的 Hosted Harness。
风险与范围
SETTLED_COMPLETION_BUDGET_FACTOR一致。任何 journal 进展都会重置计数。该上限统计运行中的每一次尝试,所以一个已经因前任受 lease 约束的 409 或审批等待了四个预算的 Turn,会在随后的第一次 generation 变化时失败(R1-8)。只统计 generation 等待的计数器需要 schema 变更,不在本 PR 范围内。涉及的设计文档:durable lifecycle(英文) / (中文)、可替换 Harness(英文) / (中文)。两种语言在相同位置同步更新。
round 14 正文清单分流(本 PR 不改)
#13219 的 round 14 评审还在正文里列了约 22 条 Suggestion 候选,按收敛姿态延后,没有发成线程。每条都对照本分支核查过:
recovery_blocked条目(R1-26)。created那一半没有钉住(R3-5)。failure_code保持planned、"没有生命周期 operation 会设置它",而 §4.6 已经记录了它(中英文都是)。embedded-harness-scheduler.test.ts在轮询的waitUntil判断式里执行++renewals。writerSealedgetter 没有测试。HarnessCoordinator.fail()的准入门读了两次 Turn。retryDelay。LOCK_TIMEOUT。SessionLifecycleCoordinator构造在 37 处复制粘贴。SessionLifecycleServiceResumeTeststub 了一个 service 从不调用的重载。HostedHarnessClient:cause传下去。protocolVersion的 v2 回执仍以裸DaemonProtocolException抛出。关联 Issue
#13182 与 #13219 的后续,拆出 #14351。