Skip to content

fix(managed-agent): close the deferred #13182 terminal-state suggestions - #14358

Merged
wenshao merged 7 commits into
mainfrom
fix/13182-terminal-state-followups
Oct 16, 2026
Merged

wenshao merged 7 commits into
mainfrom
fix/13182-terminal-state-followups

Conversation

@wenshao

@wenshao wenshao commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • A bounded generation exemption (R3-6, R3-3). On a workspace-bound Session, a Hosted Harness generation change was exempt from the Turn retry budgets both before and after admission. The reason was that one change is bounded by the prior generation's lease. A Harness that restarts between every attempt therefore kept a Turn retrying forever, and nothing distinguished it from a healthy retry. The exemption now lapses once the Turn has gone four budgets without journaled progress: 20 consecutive failures before admission, 40 after. Past that, the Turn fails the way a spent budget does, with hosted_harness_unavailable or hosted_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.
  • One Action read per inspection (R2-11). When an answered response keeps failing on projection lag, the delivery's catch block used to read the Action row twice per attempt: once to check for settlement and once to check expiry. It now reads it once and judges both against the same row version.
  • No lost release failure (R1-4). When closing a managed Session fails both to release the activation and to seal the writer, the close now rejects with a ManagedSessionCloseError, an AggregateError that holds both, names both in its message and exposes the seal failure as sealError. 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 answers 409 managed_session_writer_conflict, whose wait the coordinator exempts from the Turn retry budget, instead of the generic 503 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.
  • Decision-expired approvals keep their reason (R2-18, revised). The first version treated action_response_decision_expired as an ended Action and hid the card. Review showed that the service records that code while the Action is still requested, 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 / failureCode now list every code a lifecycle operation can end with once its retry budget runs out: session_lifecycle_delivery_failed, managed_capability_mismatch and hosted_harness_protocol_error for a refused negotiation, a workspace close or lifecycle refusal, another Runtime Broker refusal code, and session_close_completion_unsettled.
  • They state that a runtime_broker_recovery_blocked refusal is reported as workspace_close_identity_unverified.
  • They state that session_close_writer_live is also reported while the journal-writer check itself fails. That check fails open, so the operation keeps waiting in that case.
  • The generated WebShell client is regenerated.

Docs (both languages)

  • The recovery-scan population names the kinds it actually delivers, close, delete and cwd change (R2-15).
  • recovery_blocked publication is described as triggered by the raw attempt count, which includes the waits' own exempt attempts (R2-9).
  • The stale §8 follow-up bullet for an already-shipped recovery_blocked outcome is removed (R1-26).
  • The generation cap is documented next to D9a in the replaceable-Harness design.

Tests. Each new or strengthened witness was checked red against the mutant it pins:

  • R3-3: the generation exemption still retries below the cap.
  • R3-6: the cap, before and after admission, including a zero budget (R1-1) and a mixed-history row that pins which counter the cap reads (R1-6).
  • R2-11: exactly one Action read per inspection.
  • R3-2: atLeast(8) lease renewals, each stubbed to succeed, across a slow resolveAction, instead of atLeastOnce() (floor and stub corrected in R1-7).
  • R4-2: fixtures whose exempt count equals the attempt count, on the writer-live and stale-boot publication arms.
  • R2-10: no renewal survives a failed close.
  • R3-5: a created enqueue resets the store-failure streak.
  • R3-7: a dispose race that really reaches the halt bound (see Why it's needed).
  • R1-4: a double failure rejects with both failures, and a memoized seal rejection stays untouched for a later close. A load refused while the writer is fenced still answers the writer-conflict 409 when its close fails on the seal alone or on both steps.
  • R2-18: the reason survives a re-read that still lists the Action.

Why it's needed

  • The generation exemption was the one remaining unbounded and invisible retry in the Turn path. The lifecycle side already publishes or bounds its equivalent waits.
  • The contract text listed a closed set of two codes, while the code could publish several more.
  • Several tests did not pin what their comments claimed. One example: the existing dispose-race scheduler test could no longer reach the escalation guard at all. Its halt bound scales with the slot count since R7-1, so with 10 slots the bound is 100 failures, and its 10 injected failures never come close. Deleting the guard left the whole file green.

Reviewer Test Plan

How to verify

  • Generation cap. Run AdmittedTurnRetryTerminalStateTest and HarnessCoordinatorTest. aGenerationChangeStillRetriesPastThePostAdmissionBudget (10 and 39 failures) still retries exempt. aGenerationChurnPastTheCapFailsTheAdmittedTurn (40 and 57 failures) cancels the Turn, then fails it with hosted_harness_unavailable_after_admission. boundsTheGenerationExemptionBeforeAdmission gives retry at 19 and hosted_harness_unavailable at 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. aZeroBudgetStillAdoptsAGenerationChange does the same after admission.
  • Mutation proofs. Revert each fix and the named test goes red. The mutants are listed under Evidence.
  • Contract. 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.

Finding Mutant Result
R3-6 churn cap disabled the cap rows of aGenerationChurnPastTheCapFailsTheAdmittedTurn, boundsTheGenerationExemptionBeforeAdmission and aZeroBudgetStillAdoptsAGenerationChange fail (7 of 112)
R3-3 generation exemption removed aGenerationChangeStillRetriesPastThePostAdmissionBudget [10, 39], adoptsNextHarnessGenerationInsteadOfFailing, and the retry and cap rows fail (13 of 112)
R2-11 decisionExpired re-reads the Action anAnsweredResponseTerminatesOnceItsActionExpired fails (times(3))
R3-2 renewal period equal to the lease (/ 3 dropped) theOperationLeaseIsRenewedAcrossASlowResolveAction fails (3 of 3 runs)
R4-2 publish gates on the charged count exactly the three new exempt rows fail
R1-4 the seal error annotated in place again rejects with both failures when the seal fails too and leaves a memoized seal rejection untouched for a later close fail
R2-10 stopRenewal() removed from the head of seal() lets a same-credential re-attach keep writing after a close-time seal failure fails
R3-5 created-enqueue reset removed resets the failure streak on a created enqueue between failing claims fails (worker halted)
R3-7 dispose guard removed does not halt when disposal races the failure that reaches the bound fails; the old dispose test stays green, showing it never reached the guard
R2-18 the code put back in ENDED_ACTION_CODES keeps the reason on screen when the answered delivery outlived the Action fails
R1-1 zero-budget floor removed the four zero-budget retry rows fail
R1-5 generation-wait derivation stubbed to false 7 cap cases fail
R1-6 churn term reads budgetExemptFailures only the mixed-history row fails
R2 (close classification) the load route classifies the wrapper instead of its seal error; separately, the assembly throws a plain AggregateError answers a writer conflict when both the release and the seal fail while refusing a load fails (503 for 409); the seal-only row stays green

Full runs:

  • Linux aarch64 (JDK 21, MariaDB 10.11), mirroring CI's Java lane:
    • qwencode clean 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.
    • The one IT error is ManagedAgentMySqlIT#admitsHookExecutionsWithoutReadingTheirHistoryOnMySql ("writer grant is stale", ~60 s). It fails identically on main on that box (2/2 on 28415ddff3, 3/3 on 37f8e851c7).
  • After review round 1 (head 3e376d06dc), on this box: the managed-agent-server unit suite ran 4199 tests, 10 skipped, with one error, WorkspaceCsiSessionMainTest#oldWorkspaceCreationDoesNotAcquireTheNewProfileOrRequestPin, which fails identically on the merge base 52ae53b02a. 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.
  • After review round 2 (head df6e2f4685): hosted-harness-session.test.ts and 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, and tsc --noEmit is clean for core and cli.
  • TypeScript:
    • core: embedded-harness-scheduler, http-managed-session-store and managed-session-assembly pass 146 tests.
    • web-shell: client/components/managed/ passes 656 tests.
    • tsc --noEmit is clean for core and web-shell, and eslint (--max-warnings 0) and prettier are clean on the changed files.
  • Guards: check-contract-version.js reports "1.53.0 advances past the base ref's 1.52.0" against current main, and check-flyway-migrations.js passes.
  • After merging main with feat(managed-agent): Add SSH Tool Runtime support #14318 (head 4024f69028): 988 targeted managed-agent-server unit tests pass, among them the three retry/Harness classes, ManagedAgentApiContractTest, SurfaceAdmissionAcceptanceTest and 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 two hosted-harness-session files 562, and core 155. tsc --noEmit is clean for web-shell and cli.

Tested on

OS Status
🍏 macOS ⚠️
🪟 Windows ⚠️
🐧 Linux ✅

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_request events, 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

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:

  • Covered by this PR (5):
    • The §8 recovery_blocked bullet (R1-26).
    • The zh-CN recovery-scan population (R2-15).
    • The dispose-race test's lone negative assertion (R3-7).
    • The unpinned created half of the streak reset (R3-5).
    • The failed-seal test observing no renewals (R2-10).
  • No longer applicable (1): a remark on fix(managed-agent): bound retry loops with terminal states #13219's own description (memory-blocked credit).
  • Still valid, not changed here (14). These are mostly test-strength or doc items with no behavior change; left for a later pass.
    • Doc:
      • §4.1 still says failure_code stays planned because "no lifecycle operation sets" it, while §4.6 documents it (both languages).
    • Core tests:
      • ++renewals inside a polled waitUntil predicate in embedded-harness-scheduler.test.ts.
      • The HTTP handle's writerSealed getter is untested.
    • Server code:
      • HarnessCoordinator.fail()'s admission gate reads the Turn twice.
    • Server tests:
      • An integration test re-implements retryDelay inline.
      • A mirror-sync test comment promises rescheduling coverage it does not exercise.
      • The gap-heal fixtures only ever have one-sequence gaps.
      • The gap-heal H2 URL has no LOCK_TIMEOUT.
      • The 12-argument SessionLifecycleCoordinator construction is copy-pasted at 37 sites.
      • SessionLifecycleServiceResumeTest stubs an overload the service never calls.
    • HostedHarnessClient:
      • The busy-turn probe's generation re-throw is untested.
      • The probe drops the caught failure as cause.
      • A non-JSON 200 lifecycle body is untested, and a v2 receipt missing protocolVersion still surfaces as a bare DaemonProtocolException.
      • The two fail-closed probe tests assert only the excluded exception types.
  • Not checked (2): the review lists two more only in its run report, which this branch cannot see.

Linked Issues

Follow-up to #13182 and #13219. Splits out #14351.

中文说明

这个 PR 做了什么

本 PR 落地 #13219 按"第 5 轮后只修 Critical"规则记为"本 PR 不做"的 Suggestion 级发现(见搁置记录),覆盖 #13219 合入时仍未关闭的 18 条评审线程。每一条都先在当前 main 上重新核实过:一条拆成单独的 issue,其余都在这里修复。

行为改动

  • 给 generation 豁免加上限(R3-6、R3-3)。 在绑定了 workspace 的 Session 上,Hosted Harness 的 generation 变化在准入前后都豁免于 Turn 的重试预算,理由是单次变化受上一代 lease 约束。因此一个每次尝试之间都重启的 Harness 会让 Turn 无限重试,且外界无法把它和健康的重试区分开。现在 Turn 连续四个预算都没有 journal 进展后(准入前 20 次连续失败,准入后 40 次),豁免即告失效。之后 Turn 按预算耗尽处理,以 hosted_harness_unavailable 或 hosted_harness_unavailable_after_admission 失败;已准入的 Turn 仍会先被取消。该上限统计这段运行中的每一次尝试,不论由哪种等待构成;预算为零时按一计算,所以即便如此,单次变化仍能重新挂接(本 PR 评审的 R1-1、R1-8)。单次 generation 变化、以及低于上限的任何连续失败,行为与以前完全一致。没有引入新的公开错误码。
  • 每次检查只读一次 Action(R2-11)。 已应答的 response 因投影滞后反复失败时,投递 catch 块原先每次尝试要读两次 Action 行:一次判断是否已结算,一次判断是否过期。现在只读一次,并用同一个行版本做两项判断。
  • 不再丢失释放失败(R1-4)。 关闭 managed Session 时,如果释放 activation 和封存 writer 都失败,close 现在以 ManagedSessionCloseError reject:它是一个同时包含两者的 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。
  • 决定已过期的审批保留原因提示(R2-18,已修订)。 第一版把 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。
  • 写明 journal writer 检查本身失败时同样报告 session_close_writer_live。这个检查失败时按存活处理,因此 operation 会继续等待。
  • 重新生成了 WebShell 客户端。

文档(中英文同步)

  • 恢复扫描的口径改为列出实际投递的种类:close、delete 与 cwd change(R2-15)。
  • recovery_blocked 的发布改为按原始尝试次数触发,计入等待自身的豁免尝试(R2-9)。
  • 删除 §8 中关于已交付的 recovery_blocked 结果的过时条目(R1-26)。
  • 在可替换 Harness 设计文档的 D9a 旁记录了 generation 上限。

测试。 每个新增或加强的见证都对其钉住的变异体验证过会变红:

  • R3-3: 上限以下 generation 豁免仍然重试。
  • R3-6: 准入前后的上限,包括零预算(R1-1)和一个钉住上限读取哪个计数器的混合历史用例(R1-6)。
  • R2-11: 每次检查恰好读一次 Action。
  • R3-2: 慢 resolveAction 期间续约 atLeast(8) 次且每次都桩为成功,取代原来的 atLeastOnce()(下限与桩在 R1-7 中修正)。
  • R4-2: 在 writer 存活和 boot 视图过期两条发布分支上,加入豁免次数等于尝试次数的 fixture。
  • R2-10: 失败的 close 之后没有残留的续约节拍。
  • R3-5: 新建的 enqueue 会重置 store 连续失败计数。
  • R3-7: 一个真正到达停机阈值的 dispose 竞态(见"为什么需要")。
  • R1-4: 双重失败时以两者 reject;记忆化的封存拒绝在之后的 close 中保持不变。writer 被 fence 时被拒绝的加载,无论 close 只在封存失败还是两步都失败,仍回答 writer-conflict 409。
  • R2-18: 重新读取仍列出该 Action 时,原因提示依然保留。

为什么需要

  • generation 豁免是 Turn 路径上最后一处无界且不可见的重试。生命周期一侧的同类等待已经会发布状态或受上限约束。
  • 契约文案只列出了包含两个码的封闭集合,而代码实际可能发布更多。
  • 有几个测试没有钉住它们注释所声称的内容。 例如现有的 dispose 竞态调度器测试已经完全到不了升级守卫:自 R7-1 起停机阈值随槽位数放大,10 个槽位时阈值是 100 次失败,它注入的 10 次失败远远不够。删掉守卫,整个文件依然全绿。

评审测试计划

如何验证

  • generation 上限。 运行 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 改动。下表每个见证都在原地撤销修复后对其变异体运行过,均变红;恢复修复后均为绿。

发现 变异 结果
R3-6 关闭上限 aGenerationChurnPastTheCapFailsTheAdmittedTurn、boundsTheGenerationExemptionBeforeAdmission 与 aZeroBudgetStillAdoptsAGenerationChange 的上限行失败(112 个中 7 个)
R3-3 去掉 generation 豁免 aGenerationChangeStillRetriesPastThePostAdmissionBudget [10, 39]、adoptsNextHarnessGenerationInsteadOfFailing 以及重试行和上限行失败(112 个中 13 个)
R2-11 decisionExpired 重新读取 Action anAnsweredResponseTerminatesOnceItsActionExpired 失败(times(3))
R3-2 续约周期等于 lease(去掉 / 3) theOperationLeaseIsRenewedAcrossASlowResolveAction 失败(3 次运行均失败)
R4-2 发布判据改为计费次数 恰好新增的三行豁免参数失败
R1-4 重新就地修改封存错误 rejects with both failures when the seal fails too 与 leaves a memoized seal rejection untouched for a later close 失败
R2-10 去掉 seal() 开头的 stopRenewal() lets a same-credential re-attach keep writing after a close-time seal failure 失败
R3-5 去掉新建 enqueue 时的重置 resets the failure streak on a created enqueue between failing claims 失败(worker 停机)
R3-7 去掉 dispose 守卫 does not halt when disposal races the failure that reaches the bound 失败;旧的 dispose 用例依然通过,说明它从未触达守卫
R2-18 把该码放回 ENDED_ACTION_CODES keeps the reason on screen when the answered delivery outlived the Action 失败
R1-1 去掉零预算下限 四个零预算重试行失败
R1-5 generation 等待的推导桩为 false 7 个上限用例失败
R1-6 churn 项改读 budgetExemptFailures 只有混合历史那一行失败
R2(close 分类) 加载路由对包装错误而非其封存错误做分类;另一变异:assembly 抛出普通 AggregateError answers a writer conflict when both the release and the seal fail while refusing a load 失败(得到 503 而非 409);仅封存失败的一行保持通过

完整运行:

  • Linux aarch64(JDK 21,MariaDB 10.11),对齐 CI 的 Java lane:
    • qwencode clean 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)。
  • 评审第 1 轮之后(head 3e376d06dc),在本机: managed-agent-server 单测共运行 4199 个,跳过 10 个,1 个报错:WorkspaceCsiSessionMainTest#oldWorkspaceCreationDoesNotAcquireTheNewProfileOrRequestPin,它在 merge base 52ae53b02a 上同样失败。两套 Checkstyle 均干净;改动涉及的测试类各跑 3 次均通过。集成测试没有重跑:这一轮只改了 Turn 重试判定、WebShell hook、close 路径和测试。
  • 第 2 轮评审之后(head 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 均无报错。
  • TypeScript:
    • core:embedded-harness-scheduler、http-managed-session-store、managed-session-assembly 共 146 个测试通过。
    • web-shell:client/components/managed/ 共 656 个测试通过。
    • core 与 web-shell 的 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 通过。
  • 合入含 feat(managed-agent): Add SSH Tool Runtime support #14318 的 main 之后(head 4024f69028): managed-agent-server 988 个定向单元测试通过,包括三个重试/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 均无报错。

测试平台

OS 状态
🍏 macOS ⚠️
🪟 Windows ⚠️
🐧 Linux ✅

仅在 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。

风险与范围

涉及的设计文档:durable lifecycle(英文) / (中文)、可替换 Harness(英文) / (中文)。两种语言在相同位置同步更新。

round 14 正文清单分流(本 PR 不改)

#13219 的 round 14 评审还在正文里列了约 22 条 Suggestion 候选,按收敛姿态延后,没有发成线程。每条都对照本分支核查过:

  • 已被本 PR 覆盖(5 条):
    • §8 的 recovery_blocked 条目(R1-26)。
    • 中文版恢复扫描口径(R2-15)。
    • dispose 竞态测试只有一个负面断言(R3-7)。
    • 连续失败计数重置中 created 那一半没有钉住(R3-5)。
    • 封存失败测试没有观察续约(R2-10)。
  • 已不适用(1 条): 针对 fix(managed-agent): bound retry loops with terminal states #13219 自身描述的意见(memory-blocked 的归属)。
  • 仍成立、本 PR 不改(14 条)。 大多是测试强度或文档问题,不涉及行为变更,留待后续处理。
    • 文档:
      • §4.1 仍说 failure_code 保持 planned、"没有生命周期 operation 会设置它",而 §4.6 已经记录了它(中英文都是)。
    • core 测试:
      • embedded-harness-scheduler.test.ts 在轮询的 waitUntil 判断式里执行 ++renewals。
      • HTTP handle 的 writerSealed getter 没有测试。
    • server 代码:
      • HarnessCoordinator.fail() 的准入门读了两次 Turn。
    • server 测试:
      • 一个集成测试在内联重写 retryDelay。
      • 一个镜像同步测试的注释承诺了它并未执行的重新调度覆盖。
      • gap-heal fixture 的缺口都只有一个序号宽。
      • gap-heal 的 H2 URL 没有设置 LOCK_TIMEOUT。
      • 12 个参数的 SessionLifecycleCoordinator 构造在 37 处复制粘贴。
      • SessionLifecycleServiceResumeTest stub 了一个 service 从不调用的重载。
    • HostedHarnessClient:
      • busy-turn 探测中 generation 重新抛出的分支没有测试。
      • 探测丢掉了捕获到的失败,没有作为 cause 传下去。
      • 非 JSON 的 200 生命周期响应体没有测试;缺少 protocolVersion 的 v2 回执仍以裸 DaemonProtocolException 抛出。
      • 两个 fail-closed 探测测试只断言了被排除的异常类型。
  • 未核查(2 条): 评审称还有两条只在其 run report 里,本分支看不到。

关联 Issue

#13182 与 #13219 的后续,拆出 #14351。

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

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

Copy link
Copy Markdown
Collaborator

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

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

@qwen-code-review-bot

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

Copy link
Copy Markdown
Collaborator

Re-run at the current head (4024f69), which is four commits past what the previous pass reviewed — the whole gate ran again from scratch rather than carrying the old verdict forward.

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 transientFailure (the exemption is granted on recoveryPath.get() with nothing bounding it), and the dead dispose-race guard is arithmetic — the halt bound is MAX_TRANSIENT_STORE_FAILURES_PER_SLOT (10) × maxActiveSlots, that test ran 10 slots with 10 injected failures, so the bound was 100 and the guard was unreachable. Deleting it left the file green. That is a real defect in a shipped test, found by nobody's request.

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 — ManagedAgentStore.java and use-managed-actions.ts carry no code change), 493 test, 83 docs, 8 contract description text, 2 generated. That is well under the 500-line escalation threshold and under the 1000-line advisory. The author is a maintainer (admin), so the two-tier core gate's hard block does not apply, and the title is fix, not refactor, in any case.

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 close() rewrite in the assembly drops the finally for two sequential try blocks, which is the only way to keep both failures without mutating the seal error — the seal rejection is memoized by the lease and handed to every later seal, so annotating it in place would leak one close's failure into the next. The simpler-looking fix is the wrong one here, and the code says why.

Risk: no Stage 1e high-risk path matches. The real gap is evidentiary, not structural: no pull_request CI lane executes the Java half, so the churn cap — this PR's only substantive behaviour change — has no CI execution evidence. I have carried that into the code review rather than treating a green tick as coverage.

Moving on to code review. 🔍

中文说明

在当前 head(4024f69)上重新运行 —— 它比上一轮审查的 commit 又前进了四个提交,所以整个门禁从头跑了一遍,没有沿用旧结论。

感谢贡献!

模板完整 ✓ —— 所有必需小节都在,包括中文翻译。

问题:是已观测到的,不是理论性的。本 PR 落地 #13219 按"第 5 轮后只修 Critical"规则搁置的 Suggestion 级发现,18 条每一条都能追溯到具名评审线程,并附了搁置记录链接。其中两条属于"说起来容易、说错也容易"的论断,所以我没有采信而是自己核过:无上限的 generation 豁免在 main 的 transientFailure 里清晰可见(豁免由 recoveryPath.get() 授予,没有任何东西约束它);失效的 dispose 竞态守卫是纯算术 —— halt 上界是 MAX_TRANSIENT_STORE_FAILURES_PER_SLOT (10) × maxActiveSlots,那个测试用 10 个槽位、注入 10 次失败,于是上界是 100,守卫根本触不到。把它删掉整个文件依然全绿。这是一个已合入测试里的真实缺陷,而且是没人要求他去查的。

方向:对齐。AGENTS.md 规定的正是这个机制 —— 大约五轮评审之后只修 Critical,其余搁置到后续 PR 并逐条记录 —— 本 PR 就是那个后续 PR,并引用了搁置记录。唯一需要新契约字段的那条被拆到 #14351 而不是顺手带上;R2-18 的卡片移除在评审指出服务端仍会返回该 Action 之后回退到 main 的行为。两个决定都是对的。没有可对照的上游 CHANGELOG:这是仓库内部的控制面重试语义,不是用户会拿来和别的 agent 对比的 CLI 表面。

规模:跨包(cli、core、managed-agent-server、web-shell),因此触及核心路径。734 行改动的构成:生产代码 148 行(其中 16 行是仅注释 —— ManagedAgentStore.java 与 use-managed-actions.ts 没有代码改动)、测试 493 行、文档 83 行、契约描述文本 8 行、生成代码 2 行。远低于 500 行的升级阈值,也低于 1000 行的大 PR 建议线。作者是维护者(admin),因此核心两级门禁的硬性拦截不适用;何况标题是 fix 而非 refactor。

方案:就其目标而言是最小的。没有顺手重构、没有格式化噪音,测试与生产代码约 3.3:1 的比例,正是一个以"这些测试没有钉住它们注释所声称的东西"为主题的 PR 应有的样子。有一处我从描述里没预料到、于是专门去核了:assembly 里 close() 的重写把 finally 换成了两个顺序的 try 块 —— 这是唯一能在不改动 seal 错误对象的前提下同时保住两个失败的做法;seal 的 rejection 由 lease 记忆化并交给之后每一次 seal,所以就地标注会让一次 close 的失败泄漏到下一次。看起来更简单的改法在这里是错的,代码里也写明了原因。

风险:Stage 1e 的高风险路径没有命中。真正的缺口在证据而非结构:没有任何 pull_request CI 通道执行 Java 那一半,所以 churn 上限 —— 本 PR 唯一实质性的行为改动 —— 没有 CI 执行证据。我把这一点带进了代码审查,而不是把绿色的勾当成覆盖。

进入代码审查 🔍

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

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

@qwen-code-review-bot

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

Copy link
Copy Markdown
Collaborator

Code review

My 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 close() restructuring is better than what I had in mind — I would probably have reached for cause annotation first, which is exactly the trap the lease's memoization sets.

No Critical findings. What I verified rather than assumed:

  • Every consumer of the changed close() semantics is named. openManagedSession has exactly two production callers. The changed rejection shape (both steps failing now yields the wrapper where main's finally yielded the seal error) reaches four sites: hosted-harness-session.ts:5917, the open-refusal catch, which this PR updates to classify on sealError — without that unwrap the fenced-writer load would have regressed from 409 managed_session_writer_conflict to 503 managed_session_open_failed, and the new test pins both the seal-only and the both-fail arms; hosted-harness-session.ts:10101, the DELETE route, whose catch classifies only HostedHookRecoveryRequiredError and otherwise answers a generic 503 managed_session_close_failed, so its status is unchanged and only its log line gets better (it now names both failures); config.ts:486 via stopAdvancing, whose caller swallows the rejection in an empty catch; and the managed?.close().catch(() => undefined) cleanup in the same refusal path. No consumer regresses.
  • Both Criticals from the earlier /review round are fixed at this head, and all ten review threads are resolved. R1-1: the cap floors a zero budget with Math.max(1, budget) before multiplying, and the cast to long is on the multiplicand so the product cannot overflow. R1-2: action_response_decision_expired stays out of ENDED_ACTION_CODES, with the reason now recorded in a comment and pinned by a test whose fixture is one the service can actually produce (past deadline, still requested, still listed).
  • The churn gate cannot be routed around. It derives generationWait from the error itself inside transientFailure rather than from a new parameter, so all six call sites inherit it, and the exemption it caps is granted exactly where recoveryPath.get() is true. Both terminal arms return fail(...) on every branch, so when the cap fires the Turn is failed and scheduleTurnRetry is never reached — which also means the exemptFromRetryBudget → exempt change at the schedule call is unreachable-with-churn today. It is honest defensive coding, not a behaviour change, but worth knowing it cannot be exercised.
  • The Action-read consolidation preserves semantics. Main's settled(op, response) already did .orElseThrow() at that same point, so hoisting the lookup one line earlier changes the query count, not the throw behaviour. The two-argument settled overload keeps its three other callers, so it is not dead code. The times(3) assertion in OperationRetryTerminalStateTest is what pins it.
  • The contract change is description-only. I diffed main's and this head's OpenAPI with every description normalised: the only remaining difference is 1.52.0 → 1.53.0. The regenerated WebShell client is consistent — the contract carries that text on one schema (WebShellCommandOperation; the other two failureCode schemas have no description), and the generated file's single occurrence is updated. One pre-existing oddity this PR did not introduce and does not fix: info.description has sentences for v1.50 and v1.51 but none for v1.52, so the list skips straight to v1.53. That gap landed with feat(managed-agent): Add SSH Tool Runtime support #14318 on main.
  • The renewal assertion really runs under fake timers (http-managed-session-store.test.ts:2022 installs them for that test), so advancing 60 s and still seeing renewCount === 1 is a genuine witness for R2-10 rather than a same-tick no-op. Given this PR's subject is tests that do not pin what they claim, I checked the new witnesses for that failure mode specifically.

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 consecutive_failures, which every budget-exempt wait family increments. So a Turn that spent 20 attempts (40 after admission) waiting behind a live predecessor on lease-bounded 409s is terminally failed by the first generation change — and a generation change is precisely the event that ends that wait. The Turn is killed as its blocker clears. A generation-only counter would avoid it and needs durable state the record does not carry (a column, its migration, projection, and reset at the three journaled-progress writes), which is a schema change beyond a follow-up PR. The direction is fail-safe — nothing executes, and an admitted Turn is cancelled before it is failed — and both the code comment and the D9a design text now state plainly that the counter is family-agnostic, in both languages. I agree with shipping it and tracking per-family caps separately; I am flagging it because it is the one place where this PR can fail a Turn that would previously have recovered.

Files changed (20)
File What changed
docs/design/2026-09-28-managed-agent-durable-lifecycle.md Publication now says it reads the raw attempt count; the recovery-scan population names close, delete and cwd change; §4.6 enumerates the full terminal code set; the stale §8 bullet is dropped.
docs/design/2026-09-28-managed-agent-durable-lifecycle.zh-CN.md The same four edits, in the same places, in Chinese.
docs/design/2026-10-02-hosted-replaceable-harness.md New D9a paragraph: the churn cap, its family-agnostic counter, and the zero-budget floor.
docs/design/2026-10-02-hosted-replaceable-harness.zh-CN.md The same paragraph in Chinese.
packages/cli/src/serve/hosted-harness-session.test.ts Parameterized case: a refused load whose cleanup fails on the seal alone, and on both steps, still answers the writer-conflict 409; only the both-fail case logs.
packages/cli/src/serve/hosted-harness-session.ts The open-refusal catch logs the wrapper, then classifies on its seal error instead of the wrapper.
packages/core/src/managed-runtime/embedded-harness-scheduler.test.ts New created-enqueue streak-reset case; a new dispose race that actually reaches the halt bound (2 slots, streak to 20); the old dispose test gains a note that its bound is 100.
packages/core/src/managed-runtime/http-managed-session-store.test.ts Six lines: advance 60 s under the test's fake timers and assert no renewal survived the failed close.
packages/core/src/managed-runtime/managed-session-assembly.test.ts A both-fail close rejects with the wrapper carrying both errors; a memoized seal rejection stays untouched for a later close.
packages/core/src/managed-runtime/managed-session-assembly.ts New close-error wrapper; the seal moves out of a finally into a second try, so neither failure is lost and the seal error is never mutated.
packages/managed-agent-server/.../service/ActionResponseCoordinator.java One Action read per inspection: the catch block's lookup is hoisted and shared by the settle and expiry checks.
packages/managed-agent-server/.../service/HarnessCoordinator.java The churn factor, the gate inside the transient-failure decision, both terminal arms gaining the churn condition, and the retry recording the effective exemption.
packages/managed-agent-server/.../store/ManagedAgentStore.java Comment only: the deliverable-population comment names CLOSE, DELETE and CWD_CHANGE. The SQL is untouched.
packages/managed-agent-server/.../openapi/managed-agent-public-api.openapi.json 1.52.0 to 1.53.0 and two failure-code descriptions. No structural change.
packages/managed-agent-server/.../service/AdmittedTurnRetryTerminalStateTest.java Post-admission rows: still retries at 10 and 39; churn past the cap (40, 57) cancels then fails. The helper gains an exempt-count overload.
packages/managed-agent-server/.../service/HarnessCoordinatorTest.java Pre-admission cap rows: 19 retries; 20 and 33 fail; 20 with only 16 exempt fails; a zero budget retries at 0 and 3 and fails at 4.
packages/managed-agent-server/.../service/OperationRetryTerminalStateTest.java Publication gains rows whose exempt count equals the attempt count; the lease-renewal assertion is stubbed to succeed and raised to at-least-eight; the expired-Action case pins exactly three Action reads.
packages/web-shell/client/components/managed/generated/managed-agent-api.ts Regenerated: the one failure-code description line.
packages/web-shell/client/components/managed/use-managed-actions.test.tsx New case: an expired-but-still-listed Action keeps its card and its reason across a later read.
packages/web-shell/client/components/managed/use-managed-actions.ts Comment only: records why the decision-expired code stays out of the ended set, pointing at #14351.

Testing

Evidence 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.

Check Conclusion
Test (ubuntu-latest, Node 22.x) success
Lint & Static (ubuntu-latest, Node 22.x) success
Integration Tests (no-AK, No Sandbox) success
web-shell E2E Smoke (ubuntu-latest, Node 22.x) success
Serve A/B (ubuntu-latest, Node 22.x) success
Capture web-shell visuals (ubuntu-latest, Node 22.x) success
OpenTUI no-flicker gate success
TUI parity snapshots (ink vs opentui) success
Classify PR success
Build and verify reference distribution cancelled
Publish experimental reference distribution skipped
Integration Tests (CLI, No Sandbox) skipped
Test (macos-latest, Node 22.x) skipped
Test (windows-latest, Node 22.x) skipped

Reading the two non-green entries, because neither is what it looks like:

  • Build and verify reference distribution — cancelled, but not failed. Every one of its 18 work steps completed successfully, including Build Java components, Assemble reference distribution, Verify and boot the exact archive and Upload verified release assets; the run was cancelled in post-job teardown (Post Set up Java 21 still in progress, Stop containers never started), and its logs are already gone (BlobNotFound). Infrastructure teardown, not a PR-caused failure. It also proves less than its name suggests: this lane builds with -DskipTests, so it validates packaging and boot, never the Java test suite.
  • Test (macos-latest …) and Test (windows-latest …) — skipped by design. Both jobs are gated on merge_group, schedule or workflow_dispatch, so they never run on a pull_request at all. The PR's Tested-on table leaving those platforms to CI is consistent with repo policy, and the merge queue is where they will actually execute. That corrects the previous pass, which reported them as a gap in this PR's evidence.

Not verified, and why:

  • not verified: the Java behaviour change was never executed by any lane on this PR. sdk-java.yml has no pull_request trigger and the reference-distribution dry run skips tests, so the churn cap and all three Java test files rest on my static reading of the diff plus the author's reported local Maven runs. Those reports are the author's claim, not evidence I re-ran — 4041 unit tests and 675/676 ITs on a Linux aarch64 box with MariaDB 10.11, the single IT error reproducing identically on main at two different SHAs, and 988 targeted tests after the merge of feat(managed-agent): Add SSH Tool Runtime support #14318. I could not and did not run them myself.
  • not verified: the mutation proofs. The Evidence table lists a mutant per witness and reports each going red. I confirmed the witnesses are shaped so they could discriminate (the fake-timer check above, the mixed-history row that pins which counter the cap reads, the atLeast(8) renewal floor), but I did not revert any fix and re-run.
  • not verified: MySQL 8.4, fault-gate, hosted-process-crash and operator-recovery profiles. None ran anywhere; the author states this explicitly.

Sandboxed verification would settle the part CI cannot: @qwen-code /verify — that the churn cap actually fails a Turn at 20 pre-admission and 40 post-admission attempts, and that a run of 20 with only 16 exempt waits still fails, is not observable from the diff, and no lane on this PR executes the Java code that decides it. For the Java half specifically, a workflow_dispatch run of sdk-java.yml at 4024f69 is the only way to get mvn verify executed in CI rather than reported. The author has write access, so both lanes are available; /tmux is not worth naming here, as nothing in this change reaches a TUI surface.

中文说明

代码审查。 我在打开 diff 之前先写下了自己的方案:用一个按倍数推导、基于连续失败次数的上限来约束豁免的 generation 等待,并复用既有终态路径而不是另造失败码;把两次 Action 读取合并为一次上提的查询并把行传下去;在不改动 seal 错误对象的前提下同时保住两个 close 失败(因为被记忆化的 rejection 是共享的);对失效的 dispose 竞态测试,先算出它真正的上界再把连续失败驱动到那里。本 PR 四件事都做到了,而且 assembly 里 close() 的重构比我想的更好 —— 我大概会先去挂 cause,而那正是 lease 的记忆化设下的陷阱。

没有 Critical 发现。 以下是我核实过、而不是采信的内容:改动后的 close() 语义,其每一个消费者都已点名(生产调用方只有两个,受影响的四个点里只有 open 拒绝路径需要解包 seal 错误,DELETE 路由的状态码不变、只是日志更完整,另两处吞掉 rejection),没有任何消费者退化;上一轮 /review 的两个 Critical 在本 head 上确实修好了(零预算经 Math.max(1, budget) 兜底,乘积不会溢出;decision 过期码保持在终态集合之外,并由一个服务端真能产出的 fixture 钉住),十条评审线程全部 resolved;churn 门无法被绕过(它从错误本身推导,六个调用点全部继承,且两个终态分支在所有路径上都 return,因此触发上限时绝不会走到 scheduleTurnRetry —— 这也意味着调度处 exempt 那个改动今天不可达,是诚实的防御性写法而非行为变化);Action 读取合并没有改变语义(main 的 settled 本来就在同一位置 orElseThrow(),两参重载仍有三个调用方,不是死代码);契约改动确实只有描述文本(把两边所有 description 归一化后对比,唯一剩下的差异是版本号 1.52.0 → 1.53.0),生成的 WebShell 客户端与之一致;新的续约断言确实运行在 fake timers 之下,所以推进 60 秒后 renewCount 仍为 1 是 R2-10 的真实见证。考虑到本 PR 的主题正是"测试没有钉住它声称的东西",我专门按这个失效模式检查了新增见证。另外有一个既有怪现象不是本 PR 引入也不由它修:info.description 有 v1.50、v1.51 的句子却没有 v1.52,所以列表直接跳到 v1.53 —— 那个缺口随 #14318 落在 main 上。

一个应由维护者有意识接受的判断(非阻塞,作者已在 R1-8 线程里论证):上限读的是 consecutive_failures,而每一种预算豁免的等待家族都会增加它。于是一个花了 20 次尝试(准入后 40 次)等前任存活、每次都拿到受 lease 约束的 409 的 Turn,会被第一次 generation 变化终结 —— 而 generation 变化恰恰是结束那个等待的事件。Turn 在它的阻塞正好解除时被杀掉。只统计 generation 的计数器可以避免这一点,但它需要记录里没有的持久状态(一个新列、其迁移、投影,以及三处 journal 进展写入处的重置),这超出了后续 PR 的范围。方向是 fail-safe 的 —— 什么都没执行,已准入的 Turn 会先被取消再失败 —— 而且代码注释和 D9a 设计文本现在都用两种语言明确写出这个计数器不区分等待家族。我同意先合入、把按家族设上限单独跟踪;之所以点出来,是因为这是本 PR 唯一一处会让以前本可恢复的 Turn 失败的地方。

测试。 这里携带的证据是本 PR 自己的 CI,通过 API 读取 —— 这是无人值守运行,我没有构建或执行任何 PR 派生的代码。两个非绿条目都不像表面那样:Build and verify reference distribution 是 cancelled 而非 failed,它 18 个工作步骤全部成功(含 Java 构建、组装、校验并启动归档、上传),取消发生在作业收尾阶段,日志已不可取(BlobNotFound),属于基础设施收尾问题;而且这条通道用 -DskipTests 构建,验证的是打包与启动,从不验证 Java 测试套件。macOS 与 Windows 两个 Test 作业是按设计跳过的:它们的条件是 merge_group、schedule 或 workflow_dispatch,在 pull_request 上根本不跑,所以 PR 的 Tested-on 表把这两个平台交给 CI 与仓库策略一致,它们真正执行的地方是合并队列 —— 这也修正了上一轮把它们当作本 PR 证据缺口的说法。

未验证的部分及原因:Java 行为改动在本 PR 上没有被任何通道执行过(sdk-java.yml 没有 pull_request 触发器,参考发行版的 dry run 跳过测试),churn 上限和三个 Java 测试文件只有我对 diff 的静态阅读加作者报告的本地 Maven 运行 —— 那些是作者的声明,不是我重跑的证据;变异体证明未经我复现(我确认了这些见证在形状上具备区分能力,但没有回退任何修复重跑);MySQL 8.4、fault-gate、hosted-process-crash 与 operator-recovery 各 profile 在任何地方都没有跑过,作者也明确说明了。

沙箱验证可以补足 CI 补不上的部分:@qwen-code /verify —— 上限是否真的在准入前 20 次、准入后 40 次尝试时让 Turn 失败,以及"20 次里只有 16 次豁免"的那一行为何仍然失败,从 diff 里看不出来,而本 PR 上没有任何通道执行做此决定的 Java 代码。就 Java 那一半而言,在 4024f69 上以 workflow_dispatch 触发 sdk-java.yml,是唯一能让 mvn verify 在 CI 里真正执行而不是靠报告的办法。作者有写权限,两条通道都可用;这里不值得点 /tmux,因为本改动不涉及任何 TUI 表面。

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

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

@qwen-code-review-bot

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

Copy link
Copy Markdown
Collaborator

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 pull_request executes it, so that half rests on static reading plus the author's reported local runs.

Stepping back. My independent proposal and this PR converge on all four items, and the one place it goes beyond me is the close() rewrite: I would have annotated the seal error with a cause, which is precisely what the lease's memoized rejection makes unsafe — the same instance is handed to every later seal, so annotating it leaks one close's failure into the next and a later, successful-release close would report an earlier failure. The wrapper that carries both errors while leaving the seal error untouched is the better design, and the test that pins the memoized-rejection case is the one that would catch a regression to my worse version.

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 close() consumers are named and none regresses — the one that needed the unwrap got it, and its test covers both the seal-only and the both-fail arm. The gate derives its wait family from the error itself, so no call site can route a generation change around it, and both terminal arms return on every branch, so a capped Turn is failed and never also rescheduled.

What this approval does and does not attest to. It supersedes this account's standing CHANGES_REQUESTED review, which was submitted by the /review run at e6e8215 — four commits behind this head — and which is what currently holds reviewDecision at changes-requested. Before approving over it I checked each of its findings against the code as it stands rather than trusting the thread flags: both Criticals are fixed at this head (the zero-budget floor, and the decision-expired code kept out of the ended set with a fixture the service can actually produce), all ten threads read resolved, and the two Suggestions that survived to this head were answered — R1-9 by a rewritten test, R1-8 by a documented, deliberate decision to keep the family-agnostic counter. Copilot's review at this head produced no findings (it hit a quota limit and reviewed nothing), so there is no fresh machine finding I am approving past.

Green CI here means the TypeScript lanes, lint, integration, web-shell and Serve A/B checks. It does not include mvn verify: sdk-java.yml has no pull_request trigger, and the reference-distribution dry run that did execute builds with -DskipTests (it completed all 18 work steps successfully and was cancelled only in teardown). The churn cap and the three Java test files are covered by my reading of the diff and by the author's reported local Maven runs — nothing more. @qwen-code /verify at this head, or a workflow_dispatch run of sdk-java.yml, is how that gap closes if you want execution evidence before merging. Given the author is the module maintainer, the change is surgical, and this is the follow-up mechanism AGENTS.md prescribes, I don't think that should hold the PR up — but I would rather name it than let a green tick imply coverage that does not exist.

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 4024f69028df5b8507376d78fc68799139b60a7c: every pull_request workflow run on that commit has completed, so there is nothing left to wait for.

中文说明

Confidence: 4/5 —— diff 里我没有找到正确性缺陷,每一条改动路径都追到了它的消费者;扣掉的一分在于本 PR 唯一实质性的行为改动是 Java,而 pull_request 上没有任何通道执行它,所以那一半依靠的是静态阅读加作者报告的本地运行。

退一步看。我自己的方案与本 PR 在四项上都收敛,而它超出我的一处是 close() 的重写:我本来会去给 seal 错误挂 cause,而那恰恰是 lease 记忆化 rejection 所不安全的做法 —— 同一个实例会交给之后每一次 seal,所以标注它会让一次 close 的失败泄漏到下一次,一次后来释放成功的 close 会报告更早的失败。用一个同时携带两个错误、又不改动 seal 错误本身的包装类,是更好的设计;而钉住"记忆化 rejection"那个场景的测试,正是能抓住退回我那个更差版本的测试。

这是必要的吗?是,而且不只因为它落地了那些搁置的发现。dispose 竞态测试已经悄悄不再检验它自己的对象 —— 它的 halt 上界随槽位数伸缩,所以 10 个槽位时上界是 100,它注入的 10 次失败根本靠不近。把守卫删掉整个文件依然全绿。在没人要求的后续 PR 里发现这一点,并通过算出真实上界、把连续失败恰好驱动到 20 次、让 dispose 与最后一次失败竞态来修好它 —— 这与本门禁被设计来警惕的那类刷量 PR 恰好相反。半年后我会骂它吗?不会。每一处改动都必要吗?是 —— 148 行生产代码里有 16 行是仅注释的修正,两个文件根本没有代码改动,而唯一需要新契约字段的那条被拆到 #14351 而不是顺手带上。

我之所以批准,是因为找不到反对理由了吗?不是。我到这类改动最容易藏问题的两个地方去找过阻塞项:新错误形状的消费者,以及新门周围的路径。四个 close() 消费者全部点名,没有一个退化 —— 需要解包的那一处解包了,其测试同时覆盖"仅 seal 失败"与"两步都失败"两个分支。门从错误本身推导等待家族,所以没有任何调用点能把 generation 变化绕开它;两个终态分支在所有路径上都 return,所以触发上限的 Turn 会被失败,绝不会同时被重新调度。

这次批准证明了什么、没证明什么。 它会取代本账号当前挂着的 CHANGES_REQUESTED 评审 —— 那是 /review 在 e6e8215(比本 head 落后四个提交)提交的,也正是它现在把 reviewDecision 压在 changes-requested 上。在批准之前,我逐条把它的发现对照当前代码核实,而不是采信线程标记:两个 Critical 在本 head 上已修好(零预算兜底;decision 过期码保持在终态集合之外,并使用服务端真能产出的 fixture),十条线程全部 resolved,活到本 head 的两个 Suggestion 也都有交代 —— R1-9 由重写后的测试解决,R1-8 是一个有记录、有意识的决定:保留不区分家族的计数器。Copilot 在本 head 的评审没有产出任何发现(它触及配额上限、什么都没审),所以不存在我是在批准掉某个新的机器发现。

这里的 CI 全绿意味着 TypeScript 各通道、lint、集成测试、web-shell 与 Serve A/B 检查。它不包含 mvn verify:sdk-java.yml 没有 pull_request 触发器,而确实执行了的参考发行版 dry run 用 -DskipTests 构建(它 18 个工作步骤全部成功,只在收尾阶段被取消)。churn 上限和三个 Java 测试文件,覆盖它们的只有我对 diff 的阅读和作者报告的本地 Maven 运行 —— 仅此而已。如果你想在合并前拿到执行证据,办法是在本 head 上跑 @qwen-code /verify,或以 workflow_dispatch 触发 sdk-java.yml。考虑到作者是该模块的维护者、改动很精准、而且这正是 AGENTS.md 规定的后续机制,我认为这不该拖住本 PR —— 但我宁愿点明,也不愿让一个绿色的勾暗示出不存在的覆盖。

唯一希望维护者有意识接受的,是 R1-8 那个取舍:因为上限读的是聚合计数器,一个已经在存活前任后面等了四个预算的 Turn,会被第一次 generation 变化失败掉 —— 而那正是解除其阻塞的事件。按家族分别计数可以避免这一点,但它需要一次 schema 变更,应该单独开 PR。方向是 fail-safe 的,计数器的含义在代码里和 D9a 中都用两种语言写明了,我同意按现状合入。

现在批准,并钉在 4024f69028df5b8507376d78fc68799139b60a7c 上:该 commit 上所有 pull_request 工作流运行都已完成,没有需要再等的东西。

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

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

@qwen-code-review-bot

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

Copy link
Copy Markdown
Collaborator

🖼️ web-shell visual preview

Rendered against a mock daemon (no real backend): the PR base vs this PR head 4024f69. Only screenshots that changed are shown (flows below, if any, are head-only) — refreshes on every push.

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 qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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
@wenshao
wenshao requested a balanced review from Copilot October 16, 2026 09:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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)

@wenshao

wenshao commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

Local verification: merge-ready — 14/14 scripted assertions passed, 0 failed. Verified head e6e8215, base 52ae53b0 (resolved OIDs). First verification round on this PR.

中文摘要

结论:merge-ready——14/14 条脚本化断言全部通过。

  • 中心主张(generation churn cap)load-bearing 得证:把 head 的三个测试文件原样换入 base 树(base 生产代码不动),177 个测试中恰好 5 个红——4 个 cap 参数化用例(pre-admission 20/33,post-admission 40/57)+ 单次读取计数用例;同批测试在 head 全绿(177/177)。
  • 变异矩阵 10/10 全部被点名的测试杀死,与 PR 证据表逐一吻合:M1(cap 失效→恰好 4 红)、M2(exemption 移除→恰好 8 红,含健康 adopt 用例)、M3(双重读取→times(3) 红)、M4(续约周期 ×3→1 红)、M5(发布门改 charged count→恰好 3 个新 exempt 行红)、M6–M10(R1-4/R2-18/R3-5/R3-7/R2-10)各恰好 1 红。
  • 门禁:core 145/145、web-shell 32/32 绿;契约检查通过(1.52.0 > 1.51.0);web-shell client 重新生成零 diff;文档 EN/zh-CN 同位置同步。
  • 未发现新问题。
  • 未覆盖:Java 全套件(只跑 3 个点名类)、MySQL/MariaDB IT、checkstyle、web-shell managed 全目录、live Hosted Harness、fault-gate profile。

Central claim — A/B proof

The 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):

cell production tests result
base 52ae53b0 head copies 5 red / 177 — exactly the discriminating cases
head e6e8215 as shipped 177 green / 177

The 5 base-side reds: boundsTheGenerationExemptionBeforeAdmission[2,3] (cap at 20 and 33), aGenerationChurnPastTheCapFailsTheAdmittedTurn[1,2] (cap at 40 and 57), anAnsweredResponseTerminatesOnceItsActionExpired (R2-11 times(3); base reads 4). The R3-3 still-retries cases stay green on base, as expected — the exemption itself pre-existed.

A/B: head test files vs base production

Mutation matrix — 10/10 killed by the PR's named tests

Each 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 git status clean on both trees.

mutant finding expected → actual red
churn cap disabled (FACTOR → MAX_VALUE) R3-6 4 cap cases → exactly those 4
exemption removed (G3 passes false) R3-3 exactly 8: aGenerationChangeStillRetries…[1,2], both cap cases ×2, adoptsNextHarnessGenerationInsteadOfFailing, bounds…[1,2,3]
decisionExpired re-reads the Action R2-11 anAnsweredResponseTerminatesOnceItsActionExpired → 1 red
renewal period lease/3 → lease*3 R3-2 theOperationLeaseIsRenewedAcrossASlowResolveAction → 1 red
publication gates on the charged count R4-2 exactly the 3 new exempt rows
no cause attachment R1-4 keeps the release failure as the cause… → 1 red
code dropped from ENDED_ACTION_CODES R2-18 drops an approval whose answered delivery outlived the Action → 1 red
created-enqueue reset removed R3-5 resets the failure streak… → 1 red
dispose guard removed R3-7 does not halt when disposal races… → 1 red
stopRenewal() removed from head of seal() R2-10 lets a same-credential re-attach keep writing… → 1 red

M2's red set is itself informative: with the exemption gone, even the healthy single-generation-change case (adoptsNextHarnessGenerationInsteadOfFailing) can terminal-fail — the reason R3-3 exists. All counts match this PR's Evidence table ("4 of 105", "8 of 105", "exactly the three new exempt rows").

assertion matrix: 14 pass / 0 fail

Targeted gates

  • packages/core scoped vitest on the 3 changed suites: 145/145 green.
  • packages/web-shell scoped vitest on use-managed-actions.test.tsx: 32/32 green.
  • check-contract-version.js base→head: pass ("1.52.0 advances past the base ref's 1.51.0").
  • npm run generate:managed-agent-api on head: regenerates the committed client with zero diff.
  • Docs: the 4 design-doc diffs update EN and zh-CN in the same places (R2-15 scan population, R2-9 raw-attempt publication, R1-26 stale bullet removal, the generation cap beside D9a).

Findings

None. No correctness, coverage-attribution, or vacuity issues found. (One harness-side false green during the round — a perl /s regex that silently matched nothing on the R2-10 mutant — was caught by the landed-mutation check, redone with a line-exact edit, and produced the expected red; the redo is the cell counted above.)

Not covered

Full Java suite (only the 3 PR-named classes, 177 tests), MySQL/MariaDB *MySqlIT lanes, checkstyle/spotbugs, the full web-shell client/components/managed/ directory (526 tests — the author's run), live Hosted Harness, fault-gate profile. Docs checked for bilingual positional sync, not line-by-line translation fidelity. CI's own lanes not re-run; this round supplies the behavioral evidence they cannot (A/B + mutation proofs).

Methodology

aarch64 Linux, JDK 21, Maven 3.9.0, Node v24.13.0, pnpm 11.24.0. Worktrees at the resolved baseRefOid/headRefOid; qwencode-sdk 0.1.0-alpha installed from the head tree (byte-identical between base and head per git diff). A/B copied only the 3 head test files into the base tree. check-results.mjs recomputes all 14 assertions from the raw logs; logs, scripts, and panel sources preserved in the local artifact directory tmp/pr14358-verify-20261016-212549/.

@doudouOUC doudouOUC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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 wenshao left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

  1. [P2] Preserve the failure when an expired approval is still listed — R1-2 still stands. Adding action_response_decision_expired to ENDED_ACTION_CODES makes respond() resolve without an answerError. However, the server completes the response operation while the Action remains requested, and the pending query still returns that row. The next read removes the ID from answered, 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.

  2. R1-1 disposition: the zero-budget behavior is confirmed; whether it is a defect needs an explicit policy decision. With pre/post budgets both 0 and all counters 0, the first generation exception calls failTurn in both phases, cancelling first after admission. The cap is already reached because 0 >= 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).
@wenshao
wenshao requested a balanced review from Copilot October 16, 2026 14:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.
@wenshao
wenshao requested a balanced review from Copilot October 16, 2026 17:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

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

Copy link
Copy Markdown
Collaborator

🩺 serve daemon A/B

Built the PR base vs this PR head 4024f69, drove a fixed endpoint set against each, and diffed the JSON responses. Only fields that changed are shown.

✅ 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
@wenshao
wenshao requested a balanced review from Copilot October 16, 2026 19:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 wenshao left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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_conflict for 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。

@wenshao

wenshao commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

@qwen-code /triage

@wenshao
wenshao enabled auto-merge (squash) October 16, 2026 22:36
@qwen-code-review-bot

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

Copy link
Copy Markdown
Collaborator

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 report

PR 14358 — Deep Verification

Verdict: merge-ready — 31 scripted assertions executed, 31 pass / 0 fail.
Verified head 4024f69028df5b8507376d78fc68799139b60a7c (merge commit 5b12ec6, base tip b461484).

Two non-blocking Suggestions (an unpinned overflow guard and an unreachable
argument distinction) are listed under Findings; neither is a defect in the
shipped behaviour.

中文摘要

结论:merge-ready —— 共执行 31 条脚本化断言,31 通过 / 0 失败。被验证的 head 为 4024f69028(merge commit 5b12ec6,base tip b461484)。

A/B 结论(中心主张:generation 豁免上限)。 在 b461484 建立 base worktree,仅把 head 的三个测试文件按字节复制进去(sha256 一致),base 侧生产代码经确认不含 GENERATION_CHURN_BUDGET_FACTOR(grep 计数 0)。同一命令下:head 185/185 全绿,base 185 中 8 条红,且红的正好是四个预期方法(准入后上限、零预算、准入前上限、以及 R2-11 的 Action 读取次数)。base 侧失败的是预期断言本身:终态行报 Wanted but not invoked: harnessConnector.cancel(...),R2-11 报 Wanted 3 times / But was 4 times,不是编译或 import 断裂。详见下表「A/B — Java」与图 01-java-ab-base-vs-head.png。

新增轴向探针。 作者用例只覆盖预算 5 与 0。另建一次性探针类补齐坐标轴:预算 1(上限 4)、预算 3(上限 12)、准入后预算与准入前不同(pre=2/post=5,上限取 post 的 20)、以及 (long) 强转的溢出边界。探针在 head 7/7 全绿、base 3 条红(红的正是三条 terminal=true 行)。探针还测出:构造器校验 0 <= pre <= post,负预算与 pre > post 都在构造期抛错,因此 Math.max(1, budget) 的负数分支不可达,其唯一可达作用是零预算下限(已被作者用例与 J3 钉住)。探针类已删除,未进入任何提交。

变异矩阵。 Java 侧 8 个变异体 + 1 个未变异对照(同一 runner 下 185/185 全绿,证明 runner 有效):J1 关闭上限→7 红;J2 改读 budgetExemptFailures→仅混合历史 1 行红;J3 去掉零预算下限→4 红;J4 generationWait 桩为 false→7 红;J6 decisionExpired 重读 Action→1 红。J5、J7 存活(见 Findings)。TS 侧 5 个变异体 全部被杀,且每个都失败在预期断言上:T1 expected Error: journal seal failed to be an instance of ManagedSessionCloseError、T2 expected 503 to be 409、T3 promise resolved "undefined" instead of rejecting、T4 expected 3 to be 1、T5 expected Error: Harness Worker 'worker-a' halted… to be undefined。T5 同时验证了作者的测试强度主张:新 R3-7 用例变红,而旧的 dispose 用例仍绿,即旧用例从未触达该守卫。详见图 02-java-mutation-matrix.png、03-ts-matrix-and-axis-probe.png。

门禁全绿。 core / cli / web-shell 三处 tsc --noEmit 均 exit 0;Java 两次 Checkstyle 执行均报 0 违规;改动文件上 eslint(--max-warnings 0)与 prettier 干净;head 侧测试 core 155、cli hosted-harness-session 561、web-shell managed 675 全通过。契约方面:check-contract-version.js 报「1.53.0 advances past the base ref's 1.52.0」;递归剥离所有 description 后两份 openapi 结构完全一致,证实「仅描述变更」;重新生成 WebShell 客户端后 0 文件差异,即已提交的生成物可精确复现。文档中英文在同一位置同步更新。

未覆盖范围(要点)。 本 lane 无数据库,MySQL/MariaDB failsafe 集成测试(作者自述 676 个)未运行;mvn verify 的 SpotBugs 高置信门禁未运行;模块完整单测(约 4000+)未运行,只跑了三个改动类加探针;无真实 Hosted Harness。浅克隆(depth 2)下 git rev-list --count HEAD^1..HEAD^2 返回 1,而元数据有 7 个 commit,故逐 commit 归因不可达,本轮验证的是 HEAD^1..HEAD 的聚合 diff。详见「Not covered」。

Central claim

A Hosted Harness generation change on a workspace-bound Session, previously
exempt from the Turn retry budget without bound, is now bounded by a churn cap
of 4 × the phase's budget (floored at budget 1), read off
consecutive_failures. Below the cap behaviour is unchanged; at or above it
the Turn fails with that phase's hosted_harness_unavailable[_after_admission]
code, and an admitted Turn is cancelled first.

Secondary claims verified: (S1) a managed-Session close that fails both to
release the activation and to seal the writer rejects with a
ManagedSessionCloseError exposing sealError, which the Hosted load route
classifies on so a fenced writer still answers 409; (S2) an answered Action
response costs one Action read per inspection instead of two.

Scenario axes named before choosing the instrument (the diff changes how a Turn
is retried and failed, so the axes are stated whether or not they are the
central claim):

Axis Settings the author's cells use Settings this round added
Phase pre-admission (budget 5), post-admission (budget 10) post-admission with pre=2/post=5, so the post cap (20) differs from the pre cap (8)
Budget value 5 and 0 1 and 3 (caps 4 and 12); 600 000 000 (overflow boundary)
Failure composition all-exempt; 20 consecutive / 16 exempt unchanged (author's mixed row already pins which counter the cap reads; J2 confirms)
Cancellation admitted Turn cancelled before the terminal unchanged
Wait family filling the run counters set directly, family not modelled unchanged — see Findings F3

Every other setting is under Not covered.

A/B — Java, the three changed test classes

Control: git worktree add tmp/base-tree HEAD^1 (b461484 = the snapshot's
baseRefOid), then head's three test files copied in byte-identically
(sha256 71bbc749… for HarnessCoordinatorTest.java on both sides). Base
production code asserted to lack the fix before running:
grep -c GENERATION_CHURN_BUDGET_FACTOR → 0. packages/sdk-java/, every
pom.xml and pnpm-lock.yaml are untouched by this PR, so the SDK artifact
the lane installed from this checkout is valid for both arms and the warmed
Maven repository is a clean shared control.

Cell Environment Oracle Result
head merge commit 5b12ec6, JDK 21, module built from head sources mvn test exit + Surefire counts 185 run, 0 failures, BUILD SUCCESS
base (control) worktree at b461484 + head's test files same command 185 run, 8 failures, BUILD FAILURE (expected red → assertion passed)

The 8 base-side failures fall in exactly four methods, and each fails its
intended assertion rather than a compile or import break:

Method (base arm red) Failing assertion
AdmittedTurnRetryTerminalStateTest.aGenerationChurnPastTheCapFailsTheAdmittedTurn (rows 40, 57) Wanted but not invoked: harnessConnector.cancel("tenant","session")
AdmittedTurnRetryTerminalStateTest.aZeroBudgetStillAdoptsAGenerationChange (row 4) Wanted but not invoked: harnessConnector.cancel("tenant","session")
HarnessCoordinatorTest.boundsTheGenerationExemptionBeforeAdmission (4 terminal rows) line 1739 = verify(store).failTurn(…, eq("hosted_harness_unavailable"), …)
OperationRetryTerminalStateTest.anAnsweredResponseTerminatesOnceItsActionExpired Wanted 3 times: … But was 4 times — base reads the Action row 4× per inspection, head 3× (S2 proven)

Witness: 01-java-ab-base-vs-head.png.

A/B — axis probe (settings the committed rows collapse)

A scratch JUnit class (created, run on both arms, then deleted; it is in no
commit) drove head's production code through the added axis settings.

Cell Result
probe on head 7 run, 0 failures
probe on base 7 run, 3 failures — exactly the three terminal=true rows (expected red → assertion passed)

The four retry-expecting rows are green on both arms by construction (base
always retries a generation wait), so they are non-discriminating controls; the
three terminal rows carry the A/B. Two results are worth separating:

  • The cap scales with configuration. budget 1 → terminal at 4 consecutive
    exempt failures, not at 20; budget 3 → terminal at 12. A hardcoded cap of 20
    would fail these.
  • The post-admission arm reads the post budget. With pre=2 / post=5, an
    admitted Turn at 19 consecutive exempt failures retries (post cap 20) and at
    20 it is cancelled then failed
    hosted_harness_unavailable_after_admission. Had the arm read the pre
    budget (cap 8), the 19 row would have gone terminal.
  • The constructor bounds the reachable configuration space. Probing a
    negative budget and pre > post both threw
    IllegalStateException: Managed dispatch retry limits are invalid at
    construction (HarnessCoordinator.java:159-172). So 0 <= pre <= post is
    the whole space the cap can see.

Witness: 03-ts-matrix-and-axis-probe.png (lower half).

Mutation matrix

Java, all judged by the identical runner (three test classes, 185 tests). The
unmutated control ran through the same script first and was green, which is
what makes the kills and the survivors alike meaningful.

ID Mutant (interface-preserving) Result Failing
CTRL none — unmutated control green 185/185 — (positive control)
J1 churn cap disabled (generationChurn = false) KILLED, 7 failures the 3 cap methods
J2 churn term reads budgetExemptFailures KILLED, 1 failure boundsTheGenerationExemptionBeforeAdmission (mixed-history row only)
J3 Math.max(1, budget) → budget (zero floor removed) KILLED, 4 failures zero-budget rows
J4 generationWait stubbed false KILLED, 7 failures the 3 cap methods
J5 scheduleTurnRetry(…, exempt) → …, exemptFromRetryBudget SURVIVED 185/185, and 7/7 under the probe (J5p) see F2
J6 decisionExpired(currentAction) → re-reads the Action KILLED, 1 failure anAnsweredResponseTerminatesOnceItsActionExpired
J7 (long) cast dropped from the cap product SURVIVED 185/185 see F1
J7p same J7 mutant, judged by the axis probe KILLED, 1 failure overflow row

Five of these are the same mutants the PR description lists, and the
failure counts match what it claims — J1/R3-6 → 7, J2/R1-6 → 1,
J3/R1-1 → 4, J4/R1-5 → 7, J6/R2-11 → 1 — measured independently here. The
denominators differ (the body quotes "7 of 112", this round 185) because the
selection differs: this runner collects three test classes, not two. The PR's
R3-3 mutant ("generation exemption removed", claimed 13 of 112) was not
re-run; J1 removes the cap while leaving the exemption intact, which is the
stricter direction for the central claim.

TypeScript, 5/5 killed, each on its intended assertion:

ID Mutant Result Assertion that went red
T1 close no longer wraps a double failure (base finally semantics, class still exported) KILLED 2 failed / 13 passed expected Error: journal seal failed to be an instance of ManagedSessionCloseError
T2 load route classifies the wrapper instead of thrown.sealError KILLED 1 failed / 560 passed expected 503 to be 409
T3 action_response_decision_expired put back in ENDED_ACTION_CODES KILLED 1 failed / 31 passed promise resolved "undefined" instead of rejecting
T4 stopRenewal() removed from the head of seal() KILLED 1 failed / 95 passed expected 3 to be 1 (renewals surviving a failed close)
T5 dispose guard removed from noteStoreOutcome KILLED 1 failed / 43 passed expected Error: Harness Worker 'worker-a' halted… to be undefined

T1 is deliberately interface-preserving: ManagedSessionCloseError stays
exported and the seal error still propagates, so the red is the behavioural
mismatch the test exists to catch, not a broken import.

T5 independently confirms the PR's test-strength claim. Under the mutant
the new R3-7 case goes red while the pre-existing case
does not halt when disposal races a streak of transient release failures
stays green — exactly the author's assertion that the old test could no
longer reach the escalation guard (its 10 injected failures against a halt
bound of 100 at 10 slots).

Witnesses: 02-java-mutation-matrix.png, 03-ts-matrix-and-axis-probe.png.

Findings

All three are Suggestion-level. None is a defect in the shipped behaviour, and
none blocks merge.

F1 — the (long) cast in the cap product is unpinned by the committed suite (Suggestion)

HarnessCoordinator.java:1164-1167 computes the cap as
(long) Math.max(1, budget) * GENERATION_CHURN_BUDGET_FACTOR. Dropping the
cast (J7) leaves all 185 committed tests green; only the scratch probe's
overflow row caught it (J7p, 1 failure). Without the cast, any budget above
536 870 911 overflows the product to a negative number, making
consecutiveFailures() >= negative always true — the exemption would lapse on
the first generation change, the exact opposite of the intended fail-safe.

The code is correct as written; the gap is that nothing in the repository pins
it. The reachable configuration space is 0 <= pre <= post with no upper
bound validated (ManagedAgentProperties has no @Max, and the constructor
only rejects negatives), so such a budget is a misconfiguration rather than
impossible. A one-row addition to the existing parameterised test —
"600000000, 600000000, 2147483647, 2147483647, false" — would pin it. That
row is measured green on head and red under J7.

F2 — exempt can never differ from exemptFromRetryBudget at the scheduleTurnRetry call (Suggestion)

Line 1238 now passes the derived exempt instead of exemptFromRetryBudget.
Reverting it (J5) survives 185/185 committed tests and 7/7 probe rows, so
nothing observes the difference — and reading the method shows why: when
generationChurn is true, exempt is false, and the two terminal arms are
exhaustive over submissionAttempted (the first requires !submissionAttempted,
the second submissionAttempted), so one of them always returns before the
retry is scheduled. scheduleTurnRetry is therefore only reachable when
generationChurn is false, where exempt == exemptFromRetryBudget.

Classification: unreachable distinction, not a defect — the argument is
correct and arguably clearer than the raw flag. Reported so a future reader
does not hunt for the case that exercises it. No change needed; if the author
wants it pinned, the mutation is behaviour-preserving by construction and no
fixture can distinguish it.

F3 — the cap counts wait families it cannot name (measured, matches the disclosed tradeoff)

The cap reads consecutive_failures, which no counter splits by wait family.
J2 proves the choice is load-bearing: reading budgetExemptFailures instead
changes behaviour on exactly the mixed-history row (20 consecutive / 16
exempt). The consequence — a Turn that spent four budgets on a predecessor's
lease-bounded 409 or an approval fails on the first generation change that
follows — is disclosed in the PR body under Risk & Scope (R1-8) and documented
in both languages next to D9a. This round confirms the disclosure is
accurate
rather than finding a problem. Note the asymmetry it creates, which
the docs also state: other exempt families stay uncapped while they are the
current failure, yet they consume the generation cap's allowance.

Description wording (nit)

The generation-cap bullet ends "No new public code is introduced." In context
(and in the Chinese text, 没有引入新的公开错误码) this means no new public
failure code, which is accurate — the cap reuses
hosted_harness_unavailable and hosted_harness_unavailable_after_admission.
Read as English prose it can suggest no new API surface, while the PR does add
a new exported class, ManagedSessionCloseError, on a public core subpath
(@qwen-code/qwen-code-core/managed-runtime/managed-session-assembly.js),
consumed cross-package by packages/cli. Consider "no new public failure
code". Text-only; no code change implied.

Not covered

  • No database in this lane. The MySQL/MariaDB failsafe integration tests
    (the author reports 675/676 on an aarch64 box) were not run. Nothing
    here establishes MySQL behaviour, and the one IT the author marks as failing
    identically on main was not reproduced.
  • mvn verify not run, so the SpotBugs high-confidence gate is unverified;
    both Checkstyle executions were run and report 0 violations.
  • Module-wide Java suite not run (the author reports ~4000 unit tests).
    This round ran the three changed classes (185 tests) plus the 7-row probe.
    Regressions in other classes of the module would not appear here.
  • Per-commit attribution is out of reach. The checkout is depth 2:
    git rev-list --count HEAD^1..HEAD^2 returns 1 while the metadata
    snapshot lists 7 commits, and git rev-parse --is-shallow-repository is
    true. Per the shallow-boundary rule this means the 7 commits are not
    individually reachable, so everything here verifies the aggregate
    HEAD^1..HEAD diff. The three review-round fix commits named in the
    description (3e376d06dc, df6e2f4685, a6590337a9) were not exercised
    separately.
  • No trial merge against a newer main. The checkout already is the
    merge of 4024f69 into base tip b461484, and the PR head is itself a merge
    of origin/main, so the merged tree is what was tested. Whether main has
    advanced since b461484 cannot be determined here (no reliable network git),
    so a stale-base semantic conflict cannot be ruled out.
  • No live Hosted Harness, no fault-gate profile, no MySQL 8.4 — matching
    the author's own scope note.
  • Suites run only for the changed files. core (155), cli
    hosted-harness-session.test.ts (561) and web-shell client/components/managed/
    (675) are green, but the full per-package suites were not run.
  • The PR's R3-3 mutant was not re-run ("generation exemption removed",
    claimed 13 of 112). J1 is the stricter direction for the central claim — it
    removes the cap while leaving the exemption intact — so the exemption's own
    load-bearingness rests on the base arm, where all four cap methods go red,
    rather than on a dedicated mutant.
  • Deferred items by design. R2-32 and R2-18's card removal are tracked in
    fix(web-shell): an approval whose response delivery failed after 202 stays hidden until reload #14351 and are correctly out of this diff; the 14 "still valid, not changed
    here" items the body lists were not independently re-triaged.
  • Docs verified for structure, not for every factual claim. Both languages
    are updated in the same places and the cap description (4 × budget, zero
    floored to one, cap of four attempts) matches the measured behaviour. The
    pre-existing §4.1 failure_code inconsistency the body itself lists as
    unchanged was not audited.

Methodology

Everything ran inside the CI verify container (node:22-bookworm, 64 cores,
247 GB) on the merge-ref checkout, with Temurin JDK 21 and Maven 3.9.11 from
$JAVA_HOME/PATH and MAVEN_ARGS pointing at the lane's warmed repository;
java-prepare.log ends qwencode=0, and since packages/sdk-java/ is
untouched by this PR that installed artifact is valid for both arms. The warmed
repository held only the SDK's closure, so the first Maven run needed network
for the Spring Boot parent POM (Maven Central reachable, HTTP 200 in 44 ms) and
grew it from 98 MB to 200 MB; all later runs were effectively local. The Java
A/B used a scratch git worktree at HEAD^1 with head's test files copied in,
rebuilding only the managed-agent-server module per arm (~33 s), and was
removed with git worktree remove --force afterwards. TypeScript arms reused
the lane's prebuilt dist/ and root node_modules; the PR touches no
manifest or lockfile, so that reuse is a clean control. Every mutant is an
interface-preserving edit applied by perl -0pi, verified to have matched by
content diff (git diff --quiet), and reverted with git checkout --; two
harness bugs found and fixed mid-round are worth recording because both would
otherwise have fabricated results — a relative log path made every Java mutant
run fail before Maven started, and a s/.../.../ expression whose anchor
contained // truncated a production file to zero bytes (restored, and the
runner now refuses any mutation that shrinks a file by more than half). The
unmutated control was run through the identical runner before any mutant was
believed. Raw logs, both mutation runners, the ledger generator and the
results ledger live in this artifact directory: per-cell Maven and vitest
output under logs/, machine-readable rows in results-ledger.txt,
mutation-matrix-java.txt and mutation-matrix-ts.txt. Every number quoted
above is generated from those files by build-ledger.sh, not transcribed. The
working tree is clean apart from tmp/.

Flakiness gate log

rounds=5 files=5 skipped=0
file packages/cli/src/serve/hosted-harness-session.test.ts: (cd packages/cli) npx --no-install vitest run ./src/serve/hosted-harness-session.test.ts
file packages/core/src/managed-runtime/embedded-harness-scheduler.test.ts: (cd packages/core) npx --no-install vitest run ./src/managed-runtime/embedded-harness-scheduler.test.ts
file packages/core/src/managed-runtime/http-managed-session-store.test.ts: (cd packages/core) npx --no-install vitest run ./src/managed-runtime/http-managed-session-store.test.ts
file packages/core/src/managed-runtime/managed-session-assembly.test.ts: (cd packages/core) npx --no-install vitest run ./src/managed-runtime/managed-session-assembly.test.ts
file packages/web-shell/client/components/managed/use-managed-actions.test.tsx: (cd packages/web-shell) npx --no-install vitest run ./client/components/managed/use-managed-actions.test.tsx


per-file results (P=pass F=fail I=infra-exit, one letter per run):
  packages/cli/src/serve/hosted-harness-session.test.ts: PPPPP
  packages/core/src/managed-runtime/embedded-harness-scheduler.test.ts: PPPPP
  packages/core/src/managed-runtime/http-managed-session-store.test.ts: PPPPP
  packages/core/src/managed-runtime/managed-session-assembly.test.ts: PPPPP
  packages/web-shell/client/components/managed/use-managed-actions.test.tsx: PPPPP

verdict: pass
summary: 5 changed test file(s) x 5 identical rounds, no divergence

--- per-invocation detail (full copy in the artifact) ---
round 1 · packages/cli/src/serve/hosted-harness-session.test.ts: P (exit 0)
round 1 · packages/core/src/managed-runtime/embedded-harness-scheduler.test.ts: P (exit 0)
round 1 · packages/core/src/managed-runtime/http-managed-session-store.test.ts: P (exit 0)
round 1 · packages/core/src/managed-runtime/managed-session-assembly.test.ts: P (exit 0)
round 1 · packages/web-shell/client/components/managed/use-managed-actions.test.tsx: P (exit 0)
round 2 · packages/cli/src/serve/hosted-harness-session.test.ts: P (exit 0)
round 2 · packages/core/src/managed-runtime/embedded-harness-scheduler.test.ts: P (exit 0)
round 2 · packages/core/src/managed-runtime/http-managed-session-store.test.ts: P (exit 0)
round 2 · packages/core/src/managed-runtime/managed-session-assembly.test.ts: P (exit 0)
round 2 · packages/web-shell/client/components/managed/use-managed-actions.test.tsx: P (exit 0)
round 3 · packages/cli/src/serve/hosted-harness-session.test.ts: P (exit 0)
round 3 · packages/core/src/managed-runtime/embedded-harness-scheduler.test.ts: P (exit 0)
round 3 · packages/core/src/managed-runtime/http-managed-session-store.test.ts: P (exit 0)
round 3 · packages/core/src/managed-runtime/managed-session-assembly.test.ts: P (exit 0)
round 3 · packages/web-shell/client/components/managed/use-managed-actions.test.tsx: P (exit 0)
round 4 · packages/cli/src/serve/hosted-harness-session.test.ts: P (exit 0)
round 4 · packages/core/src/managed-runtime/embedded-harness-scheduler.test.ts: P (exit 0)
round 4 · packages/core/src/managed-runtime/http-managed-session-store.test.ts: P (exit 0)
round 4 · packages/core/src/managed-runtime/managed-session-assembly.test.ts: P (exit 0)
round 4 · packages/web-shell/client/components/managed/use-managed-actions.test.tsx: P (exit 0)
round 5 · packages/cli/src/serve/hosted-harness-session.test.ts: P (exit 0)
round 5 · packages/core/src/managed-runtime/embedded-harness-scheduler.test.ts: P (exit 0)
round 5 · packages/core/src/managed-runtime/http-managed-session-store.test.ts: P (exit 0)
round 5 · packages/core/src/managed-runtime/managed-session-assembly.test.ts: P (exit 0)
round 5 · packages/web-shell/client/components/managed/use-managed-actions.test.tsx: P (exit 0)

Evidence images

01-java-ab-base-vs-head

02-java-mutation-matrix

03-ts-matrix-and-axis-probe

Harness scripts and raw logs are in the workflow run artifacts (7-day retention).

— Qwen Code · sandboxed verification

@yiliang114 yiliang114 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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. ManagedSessionCloseError carries 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 sealError only, so a fenced writer still answers 409 managed_session_writer_conflict while an ordinary seal failure stays 503, and the wrapper still reaches stderr.
  • ActionResponseCoordinator.deliver. Hoisting the single Action read preserves the previous absent-row behaviour (settled already 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, and generationChurn can only be true on the two exhaustion arms, so the exempt flag handed to scheduleTurnRetry is 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 of HarnessCoordinatorTest pins 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 不会清掉它。

@yiliang114 yiliang114 added category/core Core engine and logic daemon type/bug Something isn't working as expected labels Oct 16, 2026

@qqqys qqqys left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@wenshao
wenshao merged commit d11e5c2 into main Oct 16, 2026
117 of 119 checks passed

@qwen-code-review-bot qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, looks ready to ship. ✅

wenshao added a commit that referenced this pull request Oct 16, 2026
#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.
@wenshao
wenshao deleted the fix/13182-terminal-state-followups branch October 17, 2026 03:40
@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Released in v0.25.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category/core Core engine and logic daemon type/bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants