Skip to content

test(managed-agent): replay a denied Hook decision after a lost reply - #14701

Merged
wenshao merged 4 commits into
mainfrom
test/14449-fg13f-deny-reply-loss
Oct 19, 2026
Merged

wenshao merged 4 commits into
mainfrom
test/14449-fg13f-deny-reply-loss

Conversation

@wenshao

@wenshao wenshao commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does

Adds the first FG13f decision-delivery cell. A PreToolUse command Hook returns deny, and the broker proxy drops the first settled hook-status reply carrying the deny. The turn records the honest unknown first; a later read of the same operation returns the same decision. Exactly one physical call, outcome=success with permissionDecision=deny, and the tool never runs. The forwarding proxy gains a response-aware one-shot drop so a running receipt cannot consume the rule.

Why it's needed

A deny is a decision, not a result to re-derive. If a lost reply could turn a deny into an allow, or into a second physical call, the Hook would stop being a trustworthy permission gate. The cell pins that the decision is persisted before any downstream effect and replayed identically.

Reviewer Test Plan

How to verify

Run the hosted-harness-mysql lane on Linux with MySQL 8.4 and a delegated cgroup v2 root. The new cell boots the existing reply-loss rig with the fixture's hook-deny mode, drops the first settled hook-status reply, submits one prompt, and asserts one hook.call, one hook.deny, no hook.allow, the unknown first, a later status read settling with outcome=success and permissionDecision=deny, and no file proof. A skipped cell is not a passing gate.

Evidence (Before & After)

N/A — test-only.

Tested on

OS Status
🍏 macOS ✅ compile, checkstyle, CI meta-tests, Prettier
🪟 Windows N/A
🐧 Linux ⚠️ the Hosted lane is CI-only (MySQL 8.4 + cgroup v2 root)

Environment (optional)

Local compile and checkstyle ran on JDK 21; the Hosted integration lane needs the Linux real-process fixture and is left to CI.

Risk & Scope

  • Main risk or tradeoff: the shared failsafe fork grows by 150 s from main's current 7809 s healthy (now 7959 s; fork 8559 s; Verify 153 minutes; job 246); the CI guard and its pinned values move with it.
  • Not validated / out of scope: the rest of FG13f (failClosed failure reply, oversized outputs, the receipt cap and the 16-running quota, a suppressed MessageDisplay reload), FG13b, FG13e, and local non-managed Hooks.
  • Breaking changes / migration notes: none.
  • Design documents: English and 简体中文.

Linked Issues

Part of #14449.

中文说明

本 PR 做了什么

补上 FG13f 决策投递的第一格。PreToolUse 命令 Hook 返回 deny,broker 代理在 worker 已结算后丢弃第一条已结算的 hook-status 回复。该 Turn 先记录诚实的未知;随后读取同一 operation 得到相同决策。恰好一次物理调用、outcome=success 且 permissionDecision=deny、工具绝不运行。转发代理新增响应感知的一次性丢弃,running 回执不会消耗规则。

为什么需要

deny 是一个决策,不是可以重新推导的结果。如果丢失的回复能把 deny 变成 allow,或变成第二次物理调用,Hook 就不再是可信的权限门。这一格钉住:决策在任何下游副作用之前持久化,并逐字节相同地重放。

评审测试计划

如何验证

在 Linux、MySQL 8.4 与委派 cgroup v2 根上运行 hosted-harness-mysql 车道。新用例用现有丢回复装置与夹具的 hook-deny 模式,丢弃第一条已结算的 hook-status 回复,提交一个 prompt,并断言:一次 hook.call、一次 hook.deny、没有 hook.allow、先落未知、随后以 outcome=success 且 permissionDecision=deny 结算、且不含文件证明。被跳过的用例不算通过。

证据(前后对比)

N/A——仅测试改动。

测试环境

OS 状态
🍏 macOS ✅ 编译、checkstyle、CI 元测试、Prettier
🪟 Windows N/A
🐧 Linux ⚠️ Hosted 车道只在 CI 跑(需要 MySQL 8.4 与 cgroup v2 根)

风险与范围

  • 主要风险或取舍:共享 failsafe fork 在 main 当前 7809 s healthy 的基础上增加 150 s(现为 7959 s;fork 8559 s、Verify 153 分钟、job 246);CI 守卫与其钉定值同步移动。
  • 未验证 / 不在范围:FG13f 其余部分(failClosed 失败回复、超大输出、回执上限与 16 个运行名额、被抑制的 MessageDisplay 重载)、FG13b、FG13e,以及本地非托管 Hook。
  • 破坏性变更 / 迁移说明:无。
  • 设计文档:英文与简体中文两版。

关联 Issue

#14449 的一部分。

The deny fixture mode writes a real deny decision; the dropped hook-execute reply must resolve through hook-status to the same decision, leaving one physical call, a blocking result, and a tool that never runs. The shared fork grows by 150 s: healthy 7959 s, fork 8559 s, Verify 153 minutes and the job 246.
@qwen-code-review-bot

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

Copy link
Copy Markdown
Collaborator

⚠️ Deferred approval not posted — the PR head moved (or the PR closed) after the review of d5593c8; approving now would attest to unreviewed code. Re-run @qwen-code /triage on the new head. finalize run

⚠️ 延迟审批未提交 —— 审查 d5593c8 之后 PR head 已变更(或 PR 已关闭),此时审批会为未审查的代码背书。请在新 head 上重新运行 @qwen-code /triage。查看 finalize 运行

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

Suggestion: assert that FG13_DENIED is delivered to the model exactly once. The test currently uses modelRequests.toString().contains("FG13_DENIED"), which only proves at least one occurrence. A regression that replays the persisted deny reason in multiple model requests would still pass, despite the test plan and design case requiring the model to see the reason once. Count the occurrences in the relevant model messages (or assert the number of completion requests carrying the deny reason) so duplicate delivery fails the gate.

@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Thanks for the PR!

Template looks good ✓ — every required heading is present and filled in, including the OS matrix and the bilingual design-doc pair.

Problem: this isn't a bug fix, so there's no before/after reproduction to ask for — it's a coverage cell in a gate matrix the repo already tracks. Issue #14449 is open and enumerates FG13a–FG13f explicitly; FG13a landed the command / catalog / HTTP lost-reply arms, and this adds the first FG13f decision-delivery arm. So the gap is documented and scheduled, not a hypothesis. That satisfies the "does this problem exist" bar for a test-only PR.

Direction: aligned. The claim under test is the right one to pin: a PreToolUse deny is a decision, and if a dropped hook-execute reply could turn it into an allow — or into a second physical call — the Hook stops being a permission gate at all. This is internal Hosted Harness test infrastructure rather than a user-facing surface, so there's no upstream feature-parity signal to weigh; the direction reference is #14449 itself.

Size: no core paths touched (packages/core/src/**, auth, providers, models, config, tools, services), and only one package is involved, so the two-tier core gate doesn't apply. Breakdown of the 150 / 19 lines: 0 production logic, 57 test (the IT cell + the fixture deny mode + the CI meta-test), 90 docs (the EN/zh-CN design pair), 22 build/CI config (pom.xml fork budget + the two sdk-java.yml ceilings). Nothing here approaches the 1000-line advisory.

Approach: the scope feels right and I don't see anything to cut. Reusing the existing FG13a reply-loss rig and growing the fixture with a hook-deny mode is the cheap path — no new harness, no new proxy rule shape. Keeping hook-deny on the solo branch is a nice touch: the process topology stays identical to the allow cell, so the decision is the only variable. No drive-by refactors or unrelated churn in the diff.

Risk: no elevated risk signals — none of the changed files match the revert-correlated path list. One thing worth calling out because it's the easy thing to get wrong here: .github/workflows/sdk-java.yml changed, which triggers the repo's "update the workflow meta-tests" rule. I checked scripts/tests/ for the values this PR moves (231/244, 151, 8409, 7809) and hosted-process-ci.test.js is the only file that pins them — and it's updated in this same diff. The other eight files that parse sdk-java.yml pin structure and job names, not these ceilings. So the obligation is met.

Moving on to code review. 🔍

中文说明

感谢贡献!

模板完整 ✓ —— 所有必填小节都写了,包括操作系统矩阵和中英双语设计文档。

问题: 这不是 bug fix,所以不需要 before/after 复现——它补的是仓库已在跟踪的门禁矩阵中的一格。Issue #14449 处于 open 状态,并明确列出了 FG13a–FG13f;FG13a 已经落地 command / catalog / HTTP 三条丢回复臂,本 PR 补上 FG13f「决策投递」的第一臂。所以这个缺口是有记录、有排期的,不是假设。对仅测试改动的 PR 来说,这满足「问题是否存在」的门槛。

方向: 对齐。要钉住的命题选得对:PreToolUse 的 deny 是一个决策,如果丢失的 hook-execute 回复能把它变成 allow——或变成第二次物理调用——Hook 就完全不再是权限门了。这属于 Hosted Harness 内部测试基础设施,不是用户可见面,所以没有上游功能对标的信号可权衡;方向依据就是 #14449 本身。

规模: 未触及核心路径(packages/core/src/**、auth、providers、models、config、tools、services),且只涉及一个 package,因此两级核心门禁不适用。150 / 19 行的构成:生产逻辑 0 行,测试 57 行(IT 用例 + 夹具 deny 模式 + CI 元测试),文档 90 行(中英设计文档),构建/CI 配置 22 行(pom.xml fork 预算 + sdk-java.yml 两处 ceiling)。远未触及 1000 行大 PR 建议线。

方案: 范围合理,没看到可砍的部分。复用现有 FG13a 丢回复装置、给夹具加一个 hook-deny 模式,是最省的路径——没有新 harness,没有新的代理规则形态。让 hook-deny 走 solo 分支也是个细致处理:进程拓扑与 allow 用例完全一致,唯一的变量就是决策本身。diff 里没有顺手重构或无关改动。

风险: 无升级风险信号——改动文件都不匹配与回滚相关的路径清单。有一点值得点出,因为这里最容易出错:本 PR 改了 .github/workflows/sdk-java.yml,触发仓库「同步更新 workflow 元测试」的规则。我在 scripts/tests/ 里查了本 PR 移动的数值(231/244、151、8409、7809),只有 hosted-process-ci.test.js 钉了它们——而它已在同一个 diff 里更新。其余八个解析 sdk-java.yml 的文件钉的是结构和 job 名,不是这些 ceiling。所以该义务已履行。

进入代码审查 🔍

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

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

@qwen-code-review-bot

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

Copy link
Copy Markdown
Collaborator

Code review

I wrote my independent proposal from the title and the "Why it's needed" section before opening the diff: one @Test in HostedHookReplyLossFaultGatesIT, reusing the existing Rule.drop proxy rig aimed at hook-execute; a real deny mode in the fixture rather than an allow with a relabelled reason; assertions for one physical call, a persisted blocking outcome, the tool never running, and the reason reaching the model once; and the fork/step budgets moved together with their meta-test pins. The PR does that. I didn't find a simpler path it missed.

No critical blockers. What I did verify, since this is a PR whose entire value is whether the gate actually bites:

  • The cell cannot pass vacuously. The proxy-log assertion proves the drop really happened, hookExecution() asserts exactly one hook_execution record (so a second physical call reddens rather than being absorbed), and boot() asserts mysql.url instead of assuming it — a misconfigured lane fails loudly instead of skipping. The class-level @EnabledOnOs(OS.LINUX) is satisfied by the hosted lane. "A skipped cell is not a passing gate" holds here.
  • The fixture plumbing is correct. boot() composes node <fixture> hook <evidence> <holdMs> <signalMode>, so "hook-deny" lands as argv[4], deny is true before both of its uses (no TDZ), and the fixture records hook.deny and writes permissionDecision: 'deny' with reason FG13_DENIED. Folding hook-deny into solo keeps the process topology identical to the FG13a allow cell, so the decision is the only variable — that's what makes the two cells comparable.
  • The budget arithmetic is consistent across all four sites. Healthy sum 7809 → 7959 (+150); fork 8409 → 8559, which is exactly 7959 + 600; Verify step 151 → 153 min; step-ceiling sum 153 + 10 + 20 + 50 = 233; job 244 → 246 = 233 + 13. Both relational guards still hold: timeout-minutes * 60 >= fork + 600 → 9180 ≥ 9159, and ceiling + healthy <= fork → 300 + 7959 = 8259 ≤ 8559.
  • The 8559 is scoped to the right profile. It lands inside hosted-harness-mysql only; event-transport-broker-gates (900) and event-transport-multi-node-gates (3000) are untouched, so the two event-transport meta-tests that read forkedProcessTimeoutInSeconds are unaffected.
  • No later tool call can race the negative assertion. FG13_DENY_LOSS joined the model fixture's tool-call list, and call is gated on results.isEmpty(), so the follow-up request that carries the deny emits FG13_DONE_... and never a second read_file. doesNotContain(PROOF) is therefore asserting against a settled state, not a window.
  • The design docs meet docs/design/README.md. Same base name and date prefix, reciprocal language links directly under both titles, six ## sections in matching order, and the technical identifiers (hook-execute, hook-status, outcome=blocking, failClosed, deny-reply-lost, MySQL 8.4, cgroup v2, the 16-running quota) preserved verbatim rather than translated.

Four non-blocking notes, most substantive first:

  1. The "once" in "the model sees the deny reason once" isn't actually pinned. Both the PR body and the design doc's Expect column promise the reason arrives once, but the cell asserts modelRequests.toString()).contains("FG13_DENIED"), which only proves at-least-one. A regression that replayed the persisted deny reason across several completion requests would still go green. This is the one place where the file's own convention argues for more: both sibling cells that make an exactly-once claim count it explicitly — the FG13a execute arm loops the last request's messages and asserts results == 1 under the comment "a duplicate delivery would otherwise pass", and the catalog arm does the same. @wenshao caught this himself in a self-review on the PR, so it's already in flight; recording it here so it doesn't get lost, since it's the only stated expectation the assertion set doesn't cover. Suggestion, not a blocker — this PR adds no production code, and the load-bearing half (the deny persists, replays as blocking, and the tool never runs) is properly pinned.
  2. The class header comment still reads "FG13a (issues test(managed-agent): Stage F fault gates FG8-FG10 for the capabilities enabled since FG7 #14054/test(managed-agent): Stage F fault gates FG13 for the Hosted Hook domains #14449): lost replies for the managed Hook" and enumerates only the dispatch, catalog and HTTP arms. The file now also carries an FG13f decision-delivery cell, so the header under-describes its own contents — a one-line addition would fix it.
  3. Headroom on the Verify step is getting thin: 153 min = 9180 s against fork + 600 = 9159 s leaves 21 s of margin, down from 51 s. The next +150 s cell has to move the step to 156 min (8709 + 600 = 9309 > 9180). The existing guard catches that, so this is only a heads-up that the ladder is near its next rung.
  4. I checked whether doesNotContain(PROOF) needs the explicit settle window the sibling HTTP cell uses (pollDelay(3s), "give a late retry the chance to land before proving none did") and concluded it doesn't — that cell awaits nothing positive before its negative claim, whereas here the FG13_DENIED wait already proves resolution finished and the single-record assertion runs after settlement. So the design doc's mutation witness does hold. Flagging the reasoning because it's the first thing a reviewer will wonder about.

Testing evidence

This run carries the PR's own CI, read through the API — no PR-derived code was built or executed here. At the reviewed commit there are 0 failing checks; the suite is still in flight. The load-bearing lane for this PR is Hosted process fault gates / MySQL 8.4 / Java 21, which is the only one that actually runs the new cell, and it is still queued. Its result, not the fast lanes, is what substantiates the cell.

Also still pending: Test (ubuntu-latest, Node 22.x) (which runs the updated hosted-process-ci.test.js pins), Lint & Static (Prettier on the new .mjs and both design docs), and SDK Java (fast) / ubuntu-latest / Java 21 (Checkstyle on the new Java). Not verified: the author's 150 s healthy-sum increment and the macOS compile/checkstyle results in the PR body — those are the author's claim, and the budget figure can only be confirmed by the hosted lane actually running the cell.

Final CI results for d5593c8 (auto-updated by the triage finalize job after CI completed):

Check Conclusion
(needs.scope.outputs.tier == 'full' || needs.scope.outputs.touched != 'true' || (github.event_name != 'pull_request' && 🚫 cancelled
SDK Java (fast) / ubuntu-latest / Java 21 🚫 cancelled
Test (ubuntu-latest, Node 22.x) 🚫 cancelled
web-shell E2E Smoke (ubuntu-latest, Node 22.x) 🚫 cancelled
Build and verify reference distribution ✅ success
Classify PR ✅ success
Integration Tests (no-AK, No Sandbox) ✅ success
Lint & Static (ubuntu-latest, Node 22.x) ✅ success
SDK Java (fast) / Flyway migration version uniqueness ✅ success
SDK Java (fast) / Real daemon E2E / Java 11 ✅ success
Select the Managed Agent tier ✅ success

One row per check name (latest run); skipped checks omitted; failures sort first. / 每个检查名一行(取最新一次运行),省略 skipped,失败项排在最前。

Sandboxed verification would settle the part CI can't: @qwen-code /verify — that the new cell is load-bearing is not observable from the diff, and a green hosted lane only proves the cell passes, not that it fails when the behaviour breaks. The design doc's mutation witness (apply the deny only after the dispatch reply arrives, or re-run the command on the retry) is exactly the A/B claim /verify is built for, and it would also settle note 1 empirically. /tmux doesn't apply — nothing here touches a TUI surface.

中文说明

代码审查

在看 diff 之前,我先根据标题和「为什么需要」写下了自己的方案:在 HostedHookReplyLossFaultGatesIT 加一个 @Test,复用现有指向 hook-execute 的 Rule.drop 代理装置;在夹具里加一个真正的 deny 模式,而不是把 allow 换个标签;断言恰好一次物理调用、持久化的 blocking 结果、工具绝不运行、deny 理由只到达模型一次;并让 fork/step 预算与元测试钉定值同步移动。PR 做的正是这些。我没有找到它漏掉的更简路径。

无阻断性问题。 由于这个 PR 的全部价值就在于门禁是否真的会咬人,我重点核实了:

  • 该用例不会空过。 代理日志断言证明丢弃确实发生了;hookExecution() 断言 hook_execution 记录恰好一条(第二次物理调用会红,而不是被吸收);boot() 对 mysql.url 用的是 assert 而非 assume——车道配置不对会直接失败而不是跳过。类级 @EnabledOnOs(OS.LINUX) 由 hosted 车道满足。「被跳过的用例不算通过」在这里成立。
  • 夹具接线正确。 boot() 拼出 node <fixture> hook <evidence> <holdMs> <signalMode>,所以 "hook-deny" 落在 argv[4],deny 在两处使用之前已声明(无 TDZ),夹具记录 hook.deny 并写出 permissionDecision: 'deny' 与理由 FG13_DENIED。把 hook-deny 并入 solo 使进程拓扑与 FG13a 的 allow 用例完全一致,唯一的变量就是决策——这正是两个用例可比的原因。
  • 四处预算算术自洽。 healthy 总和 7809 → 7959(+150);fork 8409 → 8559,恰好等于 7959 + 600;Verify step 151 → 153 分钟;step ceiling 之和 153 + 10 + 20 + 50 = 233;job 244 → 246 = 233 + 13。两个关系型守卫仍成立:timeout-minutes * 60 >= fork + 600 → 9180 ≥ 9159;ceiling + healthy <= fork → 300 + 7959 = 8259 ≤ 8559。
  • 8559 落在正确的 profile。 只进入 hosted-harness-mysql;event-transport-broker-gates(900)与 event-transport-multi-node-gates(3000)未动,所以那两个读取 forkedProcessTimeoutInSeconds 的元测试不受影响。
  • 后续不会有工具调用与负向断言竞争。 FG13_DENY_LOSS 已加入模型夹具的工具调用清单,而 call 以 results.isEmpty() 为条件,因此携带 deny 的后续请求发出的是 FG13_DONE_...,不会再有第二次 read_file。所以 doesNotContain(PROOF) 断言的是已结算状态,不是一个时间窗口。
  • 设计文档符合 docs/design/README.md。 同名同日期前缀,两版标题下方都有互链,六个 ## 小节顺序对应,技术标识符(hook-execute、hook-status、outcome=blocking、failClosed、deny-reply-lost、MySQL 8.4、cgroup v2、16 个运行名额)原样保留而非翻译。

四点非阻断建议,按重要性排列:

  1. 「模型只看到一次 deny 理由」中的「一次」并没有真正钉住。 PR 描述与设计文档的期望列都承诺理由只到达一次,但用例断言的是 modelRequests.toString()).contains("FG13_DENIED"),这只证明了「至少一次」。如果某个回归把已持久化的 deny 理由在多个 completion 请求中重复投递,用例仍会变绿。这恰恰是本文件自身惯例要求更严格的地方:两个做出「恰好一次」承诺的兄弟用例都显式计数——FG13a execute 臂遍历最后一个请求的 messages 并断言 results == 1,注释写着「否则重复投递也能通过」,catalog 臂同理。@wenshao 在 PR 的自审中已经自己发现了这一点,所以它已在处理中;在此记录是为了不让它被漏掉,因为这是断言集合唯一没有覆盖的既定期望。属于建议而非阻断——本 PR 不含生产代码,而承重的那一半(deny 被持久化、以 blocking 重放、工具绝不运行)已经钉得很实。
  2. 类头注释仍写着「FG13a (issues test(managed-agent): Stage F fault gates FG8-FG10 for the capabilities enabled since FG7 #14054/test(managed-agent): Stage F fault gates FG13 for the Hosted Hook domains #14449): lost replies for the managed Hook」,只列举了 dispatch、catalog、HTTP 三臂。该文件现在还承载 FG13f 决策投递用例,头部注释已不足以描述自身内容——补一行即可。
  3. Verify step 的余量变薄:153 分钟 = 9180 s,而 fork + 600 = 9159 s,只剩 21 s(原先 51 s)。下一个 +150 s 的用例必须把该 step 移到 156 分钟(8709 + 600 = 9309 > 9180)。现有守卫会拦住,所以这只是提醒:这个阶梯已接近下一级。
  4. 我核对过 doesNotContain(PROOF) 是否需要兄弟 HTTP 用例那样的显式等待窗(pollDelay(3s),「给迟到重试落地的机会,再证明没有」),结论是不需要——那个用例在负向断言前没有等待任何正向信号,而这里 FG13_DENIED 的等待已经证明解析完成,且单记录断言在结算之后执行。所以设计文档里的变异见证是成立的。之所以写出推理,是因为这是 reviewer 第一个会想到的问题。

测试证据

本次评审携带的是 PR 自身 CI(通过 API 读取)——没有构建或执行任何 PR 代码。在所审 commit 上失败检查为 0,套件仍在运行。本 PR 的关键车道是 Hosted process fault gates / MySQL 8.4 / Java 21,它是唯一真正运行新用例的车道,目前仍为 queued。能证实这个用例的是它的结果,而不是快车道。

同样待定:Test (ubuntu-latest, Node 22.x)(运行更新后的 hosted-process-ci.test.js 钉定值)、Lint & Static(对新 .mjs 与两份设计文档跑 Prettier)、SDK Java (fast) / ubuntu-latest / Java 21(对新 Java 跑 Checkstyle)。未验证:作者给出的 150 s healthy 增量,以及 PR 描述中的 macOS 编译/checkstyle 结果——这些属于作者的自述;预算数字只能由 hosted 车道真正跑过该用例来确认。

沙箱验证可以补上 CI 补不了的那部分:@qwen-code /verify——新用例是否真正承重无法从 diff 观察,hosted 车道变绿只能证明用例通过,不能证明行为被破坏时它会失败。设计文档的变异见证(只在派发回复到达后才应用 deny,或在重试时重跑命令)正是 /verify 的 A/B 命题,它也能实证地判定上面第 1 点。/tmux 不适用——本 PR 不涉及任何 TUI 界面。

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

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

@qwen-code-review-bot

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

Copy link
Copy Markdown
Collaborator

Confidence: 4/5 — clean review, no blockers; the reservations are a test-strength gap the author already flagged himself, a stale header comment, and a heads-up about budget headroom. The only thing standing between this and an approval is that the lane which actually runs the cell hasn't started yet.

Stepping back: this is a well-scoped slice of a tracked matrix, and it reads like the work of someone who has been burned by gates that don't bite. The details that convinced me aren't the assertions themselves — they're the anti-vacuity choices around them. Asserting the proxy log contains the drop means the cell can't go green while the fault silently failed to inject. Asserting exactly one hook_execution record means a duplicate physical call reddens instead of being averaged away. Asserting rather than assuming mysql.url means a lane that lost its MySQL fails loudly instead of reporting a skip as a pass. Those are the three ways a fault gate quietly becomes decoration, and all three are closed.

The fixture design is the part I'd single out. Putting hook-deny on the same solo branch as the allow cell keeps the process topology identical, so the only difference between FG13a's allow arm and this deny arm is the decision itself — which is what makes "a lost reply must not change the decision" a claim the cell actually tests rather than one it merely gestures at. Reusing the rig instead of building a parallel one is also the right call under this repo's simplicity-first rule; the diff is 169 lines and I couldn't point at anything to cut.

My independent proposal and the PR's approach landed in the same place, which is usually a good sign for a change this size. Six months from now this reads as one more cell in a matrix whose budget ladder is documented in-line at every rung — annoying to keep bumping, but that annoyance is deliberate and it's the thing that stops a fork from being killed mid-run and failing undiagnosably.

Three honest reservations, none of them blocking:

  • One stated expectation isn't pinned. The PR body and the design doc's Expect column both promise the model sees the deny reason once, but the cell asserts .contains("FG13_DENIED") — at-least-one, not exactly-one. A regression that replayed the reason across multiple completion requests would still pass. I'd have caught this as the one real gap in an otherwise tight cell, and @wenshao reached it independently in his own self-review on the PR, which is a decent signal the author reviews his gates rather than just shipping them. It stays a Suggestion rather than a blocker: this PR adds no production code, and the load-bearing half — the deny persists, replays as blocking, and the tool never runs — is properly asserted. Both sibling cells that make an exactly-once claim count it explicitly, so there's an in-file pattern to follow when tightening it.
  • The class header comment still describes only FG13a, so it now under-describes the file. Trivial to fix, and fine to defer.
  • The Verify step's margin over fork + 600 is down to 21 s from 51 s. The next +150 s cell must move the step to 156 min. The meta-test enforces that, so it can't slip silently — but the ladder is close to its next rung and whoever adds the next FG13f cell should expect to move it.

I did not build or execute anything from this PR; my confidence rests on reading the diff against the surrounding cells and helpers, on checking every arithmetic guard the meta-tests apply to the new numbers, and on the PR's own CI. That CI is still in flight and 0 checks have failed so far, but Hosted process fault gates / MySQL 8.4 / Java 21 — the only lane that runs the new cell — is still queued, along with the Node lane that checks the updated pins and the Prettier/Checkstyle lanes. Approving now would attest to a result that doesn't exist yet, so approval is deferred until CI lands green on d5593c8636a623c62bc0d61868a0027026e7bf5e; the finalize job posts the commit-pinned approval once every check on that SHA completes, and withholds it if anything lands red or the head moves.

中文说明

信心度:4/5 —— 审查干净、无阻断项;保留意见分别是作者自己已指出的测试强度缺口、一处过期的头部注释,以及关于预算余量的提醒。唯一横在本次评审与批准之间的,是真正运行该用例的车道还没开始跑。

退一步看:这是一个有跟踪矩阵中范围界定良好的一格,读起来像是被「不会咬人的门禁」坑过的人写的。真正说服我的不是断言本身,而是围绕断言的防空过设计。断言代理日志包含这次丢弃,意味着故障静默未注入时用例不会变绿;断言 hook_execution 记录恰好一条,意味着第二次物理调用会红,而不是被平均掉;对 mysql.url 用 assert 而非 assume,意味着丢了 MySQL 的车道会直接失败,而不是把 skip 当成 pass 报上来。故障门禁悄悄变成摆设正是这三条路径,而它们都被关住了。

夹具设计是我要特别点出的一处。让 hook-deny 走与 allow 用例相同的 solo 分支,使进程拓扑完全一致,于是 FG13a 的 allow 臂与这条 deny 臂之间唯一的差别就是决策本身——这才让「丢失的回复不得改变决策」成为用例真正在测的命题,而不只是比划一下。复用装置而不是另建一套,也符合本仓库「简单优先」的规则;diff 共 169 行,我指不出任何可砍的地方。

我的独立方案与 PR 的做法落在同一处,对这种体量的改动来说通常是好兆头。六个月后再读,它是矩阵里新增的一格,而预算阶梯在每一级都有就地注释——维护起来有点烦,但这份烦是刻意的,正是它避免了 fork 在跑到一半时被杀掉、然后无法诊断地失败。

三点如实保留,均不阻断:

  • 有一项既定期望没被钉住。 PR 描述与设计文档的期望列都承诺模型只看到 deny 理由一次,但用例断言的是 .contains("FG13_DENIED")——「至少一次」,不是「恰好一次」。若某个回归把理由在多个 completion 请求中重复投递,用例仍会通过。这本来是我会指出的、在这样一个 otherwise 严密的用例里唯一的实质缺口,而 @wenshao 在 PR 自审中独立得出了同一结论——这说明作者是在审查自己的门禁,而不只是把它们提交上来。它仍属建议而非阻断:本 PR 不含生产代码,而承重的那一半——deny 被持久化、以 blocking 重放、工具绝不运行——都已妥善断言。两个做出「恰好一次」承诺的兄弟用例都显式计数,所以收紧时文件内已有可跟随的范式。
  • 类头注释仍只描述 FG13a,现已不足以描述该文件。修起来很简单,也可以延后。
  • Verify step 相对 fork + 600 的余量从 51 s 降到 21 s。下一个 +150 s 的用例必须把该 step 移到 156 分钟。元测试会强制这一点,所以不会静默漏掉——但阶梯已接近下一级,加下一格 FG13f 的人要有移动它的预期。

我没有构建或执行本 PR 的任何代码;信心来自把 diff 与相邻用例和辅助方法对照阅读、逐一核对元测试对新数值施加的算术守卫,以及 PR 自身的 CI。该 CI 仍在运行,目前失败检查为 0,但 Hosted process fault gates / MySQL 8.4 / Java 21——唯一运行新用例的车道——仍在排队,检查更新钉定值的 Node 车道以及 Prettier/Checkstyle 车道同样未出结果。此刻批准等于为一个尚不存在的结果背书,因此批准推迟到 CI 在 d5593c8636a623c62bc0d61868a0027026e7bf5e 上全绿之后;该 SHA 上所有检查完成后,finalize 任务会发出与 commit 绑定的批准,若有检查变红或 head 移动则不予批准。

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

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

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

评审基于 d5593c8636a623c62bc0d61868a0027026e7bf5e。未发现阻断性问题,新增 1 项非阻断 Suggestion,见行内评论:当前故障丢弃的是 running 受理回执,尚未覆盖设计文档声称的已结算 deny 回复丢失。

已有的“deny 理由恰好投递一次”建议仍成立;当前 contains("FG13_DENIED") 只证明至少一次,本次不重复提交。

验证:在该提交的独立快照上运行 6 个相关 CI 元测试文件,229 项全部通过;变更中的 YAML、Markdown、JavaScript 格式检查及夹具 node --check 通过。另用真实 ManagedHookRuntime、延迟返回 blocking 的 HookRunner 替身核实时序:首次 execute 返回 running,之后 status 才返回 settled/blocking。此探针不等同于完整集成验证。

未运行 Maven 完整验证或 Linux/MySQL/cgroup 集成用例;发布前查询到该 SHA 的 SDK Java (fast) / Hosted process fault gates / MySQL 8.4 / Java 21 检查为 SKIPPED,不能作为新用例已通过的证据。

The proxy gains a response-aware one-shot drop; the deny cell now drops the first settled hook-status reply and settles the same operation through the harness status route. The design docs and PR claims match the exercised fault.

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

复评基于 f4b0b5b2ff69e2553655eb7573cf34beedd5cd9e,已检查相对上一轮的增量和最终 diff。本轮未发现新增的阻断问题或需要追加的建议。

上轮的丢回复时序问题已修复:响应条件满足 settled + blocking 才消耗一次丢弃规则;running 回复直通。用例先确认 recovery_blocked / outcome_unknown,再通过 Harness 状态路由读取同一 operation,并验证持久化的 blocking 结果及一次物理调用。新增字段已有实际调用方,原有 drop / hold / swallow 路径保持原语义。

关于之前的“模型恰好收到一次 deny 理由”建议:PR 正文及两版设计已同步收窄覆盖范围,当前验证决策回执恢复,不再声称覆盖模型侧恰好一次投递。这是范围调整,不代表该投递行为已经验证。

本轮验证:

  • 精确提交快照上的 6 个 CI 元测试文件全部通过,共 229 项。
  • 使用 JDK 21 编译该提交的真实转发代理并执行本地 HTTP 探针:running、settled/success 和不匹配请求正常直通;首次匹配的 settled/blocking 回复被丢弃,后续回复完整返回;5 次上游请求中恰好记录 1 次丢弃。普通 drop、hold、swallow 的触发次数检查通过。
  • 变更中的 YAML、Markdown、JavaScript 格式检查、夹具语法检查及 diff 空白检查通过。

未运行完整 Maven 验证或 Linux/MySQL 8.4/cgroup v2 集成用例。最新 SHA 的相关 CI 尚未给出 Hosted 集成通过结果;以上聚焦验证不替代该结果。

yiliang114
yiliang114 previously approved these changes Oct 19, 2026

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

Approving at f4b0b5b2.

The earlier timing objection is genuinely fixed, and the new cell discriminates rather than self-satisfies. Verified at head:

  • The drop now lands on the decision, not the receipt. Rule.dropResponse is only consumed inside matchesResponse, so a running acknowledgement passes through without spending the occurrence, and consume() is seen.incrementAndGet() <= 1 — strictly one-shot. The drop also happens after client.send(...), which is the right semantics for "the reply was lost once the worker had already settled": the physical call still happened exactly once, the DROP branch records PROXY dropped <name> and returns before sendResponseHeaders, and the exchange closes in finally. That is the exact string the cell asserts on.
  • The emitter chain actually reaches the cell. modelReply's prompt allow-list now contains FG13_DENY_LOSS, so the double emits a tool_call for this prompt and a PreToolUse Hook fires at all — without that literal the cell would have died on its first events("hook.call") wait. In the fixture, hook-deny joins solo and records hook.deny with permissionDecision: 'deny' / reason FG13_DENIED, so both hook.deny hasSize(1) and hook.allow isEmpty() are satisfiable and would fail on a mislabelled allow.
  • The budget arithmetic is internally consistent end to end: 7959 + 600 = 8559 in the pom; the Verify step at 153 minutes wraps 8559 + 600 = 9159s; step ceilings 153 + 10 + 20 + 50 = 233; job timeout 233 + 13 = 246; and the meta-test pins ['hosted-harness-mysql', 233, 246], toBe(8559) and hostedForkHealthySeconds = 7959 to match. Every helper the cell uses exists at this head, and java.util.function.Predicate is imported.
  • The scope narrowing is honest. The "deny reason reaches the model exactly once" claim is gone from the PR body and from both design docs rather than left asserted-but-untested, and your re-review says plainly that this is a scope adjustment, not verification of that delivery. The Case table's Expect column now matches what the cell pins, and the EN / zh-CN twins stay parallel section for section.

One non-blocking heads-up: main is only three commits past your base and still carries 8409 / 7809 / 231 / 244, so there is no collision today — but the FG sibling PRs all raise these same constants from a common base, so whichever merges second will have to rebase and recompute forkedProcessTimeoutInSeconds, hostedForkHealthySeconds and the two step-ceiling rows as a set rather than one at a time.

I did not run the Maven/MySQL lane (no JDK on this machine); the read is head-source only, alongside your reported 229 meta-test passes and the compiled-proxy HTTP probe at this SHA.

@yiliang114 yiliang114 added scope/ci-cd Continuous integration/deployment scope/testing Test frameworks and cases labels Oct 19, 2026
@wenshao

wenshao commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

Local verification — real Hosted lane (Linux + MySQL 8.4 + cgroup v2)

Verdict: not merge-ready. 1 blocker: the new fg13f cell cannot pass on the only lane where it runs.

I ran the PR's own test command on a real rig, not a self-satisfying stub. CI's Hosted process fault gates / MySQL 8.4 / Java 21 is skipping on this PR, so this is the only real evidence for the cell.

Head measured f4b0b5b2ff69e2553655eb7573cf34beedd5cd9e (also d5593c86, the previous head)
Host 192.168.0.75, Linux 6.6.89 aarch64, 12 cores
Runtime Temurin 21, Maven 3.9.0, MySQL 8.4.11, delegated cgroup v2 root /sys/fs/cgroup/fg14701
CLI under test dist/cli.js built from the PR head (pnpm install 7m28s + npm run bundle), production diff vs d5593c86 is zero
Command mvn -B -Phosted-harness-mysql test-compile failsafe:integration-test failsafe:verify -Dit.test=HostedHookReplyLossFaultGatesIT …
When 2026-10-19 20:29–20:51 CST (UTC+8)

F1 (Critical) — the cell expects an outcome that a command-Hook deny never produces

A hook-deny command Hook settles as a successful evaluation carrying a deny decision:

{"success":true,"outcome":"success","duration":1222,"output":{"hookSpecificOutput":
 {"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"FG13_DENIED"}}}

That is the row actually persisted in ma_resource after the run. Two places in the new cell assume outcome=blocking instead:

  1. The drop predicate never fires. HostedHookReplyLossFaultGatesIT.java:433-434 consumes the drop only when the hook-status reply contains both "state":"settled" and "outcome":"blocking". The settled reply carries "outcome":"success", so the predicate never matches: measured PROXY dropped = 0. Nothing is lost, the record settles normally, and the first waitFor fails with expected: "recovery_blocked" but was: "settled" within 1 minutes (86.75 s).
  2. The final assertion is wrong too. With only the predicate corrected (experiment E1), the drop fires (PROXY dropped = 1) and the cell reaches line 459, then fails with expected: "blocking" but was: "success" (28.85 s).

This is not a product bug. ManagedHookRuntime.settle passes the core result's outcome through unchanged, and HostedHookSession.settleExecution only substitutes blocking for a failed failClosed evaluation. A deny is expressed in output.hookSpecificOutput.permissionDecision, while outcome reports whether the evaluation itself succeeded. The deny is persisted before any downstream effect, the tool never runs, and the model receives the deny reason exactly once (measured: one {"error":"FG13_DENIED"} tool result) — the behaviour the cell wants is already there; the assertions just look for a value the product never emits.

Fix (measured). Predicate on the settled deny reply, and assert the stored shape:

reply -> reply.contains("\"state\":\"settled\"")
        && reply.contains("\"permissionDecision\":\"deny\""),
…
JsonNode denied = hookResult(session);
assertThat(denied.path("outcome").asText()).isEqualTo("success");
assertThat(denied.at("/output/hookSpecificOutput/permissionDecision").asText()).isEqualTo("deny");
assertThat(denied.at("/output/hookSpecificOutput/permissionDecisionReason").asText()).isEqualTo("FG13_DENIED");

With exactly those two changes the cell passes in 28.86 s (experiment E2). The design doc's outcome=blocking wording needs the same correction in both language files.

Note on the previous head: at d5593c86 the cell dropped the hook-execute reply and failed at the same outcome assertion (27.96 s). The rewrite in f4b0b5b2 correctly moves the drop to the settled decision, but carries the same wrong assumption into the new predicate — so the cell still cannot reach its own inject.

The rest of the change is sound

  • Whole class at f4b0b5b2: 5 run, 1 error — only the new cell; the four existing FG13a cells pass (140.3 s).
  • Budget pins: fork 8559 = 600 + 7959 (zero slack, same convention as before); Verify step 153 min wraps fork + 600 s (9159 s) with 21 s margin; job 246 = 233 + 13. scripts/tests/hosted-process-ci.test.js is 58/58 green, and its liveness probe (8559→8409) goes red with expected 8409 to be 8559 (14 failed / 44 passed), so the guard is not dead.
  • Checkstyle (CI-identical command, JDK 21): 0 violations.
  • Model-side "exactly once" delivery is out of scope in the narrowed doc; I measured it as exactly one anyway in E2.

Evidence

1. Clean head f4b0b5b2 — the drop never fires, the cell times out
drop never fires

2. Why the predicate misses — persisted result vs lines 433-434 / 459
stored deny shape

3. E1: predicate fixed only — drop fires (1), then fails on outcome
predicate fixed only

4. E2: predicate + assertion use the stored shape — PASS 28.86 s
both fixed

5. Whole class on the clean head — 5 run, 1 error
whole class

6. Fork-budget meta-test 58/58, and 14 red when the pom pin is poked
budget meta

7. Checkstyle — 0 violations
checkstyle

中文摘要(点击展开)

本地真实车道验证 — PR 14701(Linux + MySQL 8.4 + cgroup v2)

结论:暂不可合并。 1 个阻断项:新增的 fg13f 用例在唯一会运行它的车道上必然失败。

CI 的 Hosted process fault gates / MySQL 8.4 / Java 21 在本 PR 上是 skipping,所以本地这次实跑是这条用例目前唯一的真实证据。

测量对象:head f4b0b5b2(同时测了上一版 d5593c86);宿主机 192.168.0.75(kernel 6.6、Temurin 21、Maven 3.9.0、MySQL 8.4.11、委派 cgroup v2 根 /sys/fs/cgroup/fg14701);被测 CLI 是从 head 重新构建的 dist/cli.js(pnpm install 7m28s + npm run bundle,与上一版的生产代码 diff 为 0)。时间:2026-10-19 20:29–20:51(北京时间)。

F1(阻断)— 用例期待的 outcome,命令 Hook 的 deny 根本不会产生

hook-deny 夹具落库的真实结果是:

{"success":true,"outcome":"success","duration":1222,"output":{"hookSpecificOutput":
 {"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"FG13_DENIED"}}}

新用例有两处假设了 outcome=blocking:

  1. 丢弃谓词永不命中。 HostedHookReplyLossFaultGatesIT.java:433-434 只有在 hook-status 回复同时含 "state":"settled" 与 "outcome":"blocking" 时才消耗丢弃;实际 settled 回复是 "outcome":"success",所以 PROXY dropped 实测为 0。回复没被丢,记录正常结算,第一个 waitFor 以 expected: "recovery_blocked" but was: "settled" within 1 minutes 失败(86.75 s)。
  2. 最后一条断言也错。 只修谓词(实验 E1)后丢弃命中(PROXY dropped = 1),用例走到第 459 行,再以 expected: "blocking" but was: "success" 失败(28.85 s)。

这不是产品缺陷:ManagedHookRuntime.settle 原样透传 core 的 outcome,HostedHookSession.settleExecution 只在 failClosed 求值失败时才替换为 blocking;deny 由 output.hookSpecificOutput.permissionDecision 表达,outcome 表达的是“求值本身是否成功”。deny 已在任何下游副作用之前持久化,工具没运行,模型恰好收到一次 deny 理由(实测一条 {"error":"FG13_DENIED"})——行为本身是对的,只是断言在找一个产品不会产出的值。

修法(已实测): 谓词改为匹配 "state":"settled" + "permissionDecision":"deny";断言改为 outcome == "success",并断言 permissionDecision == "deny"、permissionDecisionReason == "FG13_DENIED"。两处都改后该用例 28.86 s 通过(实验 E2)。设计文档(英文与中文)里的 outcome=blocking 也需同步更正。

补充:上一版 d5593c86 丢的是 hook-execute 回复,在同一处 outcome 断言失败(27.96 s)。f4b0b5b2 把丢弃点改到已结算决策是对的,但把同一个错误假设带进了新谓词,所以用例仍然走不到自己的注入点。

其余部分是好的

  • 新 head 整类: 5 run / 1 error,只有新用例失败;4 条既有 FG13a 用例通过(140.3 s)。
  • 预算 pin: fork 8559 = 600 + 7959(零余量,沿用既有约定);Verify step 153 min 包住 fork + 600 s(9159 s),余量 21 s;job 246 = 233 + 13。元测试 58/58 绿,活性探针(8559→8409)红出 expected 8409 to be 8559(14 失败 / 44 通过),守卫是活的。
  • Checkstyle(CI 同款命令,JDK 21):0 violations。
  • 模型侧“恰好一次”已按收窄后的文档移出范围;即便如此,E2 中实测仍恰好一次。

证据

见上方 7 张截图(原文正文中的英文说明)。

The persisted deny is outcome=success with output.hookSpecificOutput.permissionDecision=deny, not blocking. The drop predicate and the terminal assertions now use that shape, matching the measured E2 run.
@wenshao

wenshao commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

F1 confirmed and fixed at 22ae19b9504936a83bd2fb091570f89aeb5dd7b5.

The persisted deny is outcome=success with output.hookSpecificOutput.permissionDecision=deny, so the cell now drops the first settled hook-status reply matching "state":"settled" + "permissionDecision":"deny", and asserts outcome == "success", permissionDecision == "deny", and permissionDecisionReason == "FG13_DENIED" after the later read. The design docs (EN/zh) and the PR body now use the stored shape.

Local compile, checkstyle, the CI meta-test (58/58) and Prettier pass. The real-lane run remains the evidence; this commit follows your measured E2 shape exactly.

@wenshao

wenshao commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

Local verification round 2 — 22ae19b9

Verdict: merge-ready from the Linux real-lane perspective. The round-1 blocker is fixed; no new findings.

This is the same real rig as round 1: .75 Linux 6.6 / aarch64, Temurin 21, Maven 3.9.0, MySQL 8.4.11, delegated cgroup v2 root /sys/fs/cgroup/fg14701, CLI bundle built at the head and driven through the PR's own failsafe command, 2026-10-19 20:59–21:05 CST (UTC+8).

Prior finding status

Finding Status at 22ae19b9
F1 (Critical) — the drop predicate keyed on "outcome":"blocking" never matched, and the final assertion expected an outcome a command-Hook deny never produces Fixed. Predicate now matches "state":"settled" + "permissionDecision":"deny"; the assertion checks outcome=success, permissionDecision=deny, and permissionDecisionReason=FG13_DENIED; both design docs say the same.

The delta from f4b0b5b2 is exactly the PR-owned test and the two design docs (+14/−10); the production diff over packages/core/src and packages/cli/src is zero, so the CLI bundle from round 1 is the same artifact and only the changed test needed re-measuring.

Measured at 22ae19b9

  • New cell, clean tree: PASS in 28.95 s, and the proxy log shows 1 PROXY dropped hook-deny-settled-reply — the inject now really fires.
  • Whole class: 5/5 PASS in 82.13 s (the four FG13a cells plus the new FG13f cell).
  • Fork-budget meta-test: 58/58 — the 8559 / 7959 / 153 / 246 pins are internally consistent.
  • Checkstyle (CI-identical command, JDK 21): 0 violations.

Teeth check (the cell is not self-satisfying)

With the clean tree green, I mutated the built Harness chunk so lookup()'s lost-reply fallback returns a forged settled receipt instead of outcome_unknown:

catch{return{operationId:…,state:"outcome_unknown"}}
  → catch{return{operationId:…,state:"settled",result:{success:true,outcome:"success",duration:0}}}

The cell goes red in 86.38 s with expected: "recovery_blocked" but was: "settled" within 1 minutes — the inject is load-bearing, not decorative. The chunk was then restored and its sha256 matched the pristine artifact byte-for-byte.

Scope note: the model-side "deny reason delivered exactly once" claim was narrowed out of the design doc in f4b0b5b2; I did not re-assert it here. CI's Hosted process fault gates lane is still skipping on this PR, so this local run remains the only real evidence for the cell.

Evidence

1. New cell PASS, DROP=1
new cell passes

2. Whole class 5/5
whole class

3. M2 mutant — forged settled receipt turns the cell red
mutant m2

4. Fork-budget meta-test 58/58
budget meta

5. Checkstyle 0 violations
checkstyle

中文摘要(点击展开)

本地真实车道验证 第 2 轮 — 22ae19b9

结论:从 Linux 真实车道看可以合并。 第 1 轮的阻断项已修复,本轮没有新发现。

环境与第 1 轮相同:.75 Linux 6.6 / aarch64、Temurin 21、Maven 3.9.0、MySQL 8.4.11、委派 cgroup v2 根 /sys/fs/cgroup/fg14701,被测 CLI 用 head 构建,经 PR 自己的 failsafe 命令驱动;时间 2026-10-19 20:59–21:05(北京时间)。

上轮 finding 状态

Finding 22ae19b9 上的状态
F1(阻断) — 丢弃谓词按 "outcome":"blocking" 匹配,永不命中;最终断言也期待命令 Hook 的 deny 不会产生的 outcome 已修复。 谓词改为 "state":"settled" + "permissionDecision":"deny";断言改为 outcome=success、permissionDecision=deny、permissionDecisionReason=FG13_DENIED;两版设计文档同步更正。

相对 f4b0b5b2 的增量就是 PR 自己的测试与两版设计文档(+14/−10);packages/core/src 与 packages/cli/src 的生产 diff 为 0,所以沿用第 1 轮构建的同一个 CLI 产物,只重测了变化的用例。

22ae19b9 上的实测

  • 新用例(干净树): 28.95 s 通过,代理日志出现 1 次 PROXY dropped hook-deny-settled-reply——注入这次真的触发了。
  • 整个类: 5/5 通过(82.13 s),含 4 条既有 FG13a 用例。
  • fork 预算元测试: 58/58,8559 / 7959 / 153 / 246 的 pin 自洽。
  • Checkstyle(CI 同款命令,JDK 21):0 violations。

门禁有牙(不是自证)

干净树全绿后,我在构建出的 Harness chunk 里做了一次变异:把 lookup() 丢回复时的兜底从 outcome_unknown 改成伪造的“已结算成功回执”。用例随即在 86.38 s 变红:expected: "recovery_blocked" but was: "settled" within 1 minutes。随后恢复 chunk,sha256 与原始产物逐字节一致。

范围说明:模型侧“deny 理由恰好一次”已在 f4b0b5b2 从设计文档中收窄移出,本轮不再断言。CI 的 Hosted process fault gates 车道在本 PR 上仍是 skipping,所以本地这次实跑仍是该用例唯一的真实证据。

证据

见上方 5 张截图。

yiliang114
yiliang114 previously approved these changes Oct 19, 2026

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

Approving at 22ae19b9.

Verified against head source (proxy, fixture, IT, budget guard, workflow). The Hosted process fault gates / MySQL 8.4 / Java 21 lane is still queued on this commit, so this is a source-level verification, not a hosted run.

  • The drop keys on the decision, not the receipt. Rule.dropResponse is consulted only after client.send(...), and the one-shot is spent inside matchesResponse+consume(), so a running receipt passes through without consuming the rule. Existing drop/hold/swallow rules keep their request-time semantics (responseMatcher == null branch unchanged).
  • The deny path is a real deny. hook-deny records hook.deny and answers permissionDecision: deny / FG13_DENIED; the cell asserts one hook.call, no hook.allow, recovery_blocked / outcome_unknown first, then the same operation settles through the Harness status route with outcome=success, the persisted deny decision and its reason, and no file proof.
  • The cell discriminates. Without the settled-reply drop it never observes the unknown; a re-derived allow fails the no-proof assertion; a re-run on retry fails the one-call assertion.
  • Budget chain moves consistently. fork 8409→8559, healthy 7809→7959, Verify 151→153 min, job 244→246, guard pins 233/246; 8559 + 600 <= 153*60 and 233 + 13 = 246, and the per-class ceiling rule still holds (300 + 7959 <= 8559).
  • Earlier feedback. The running-receipt timing objection is fixed; the "deny reason delivered exactly once to the model" suggestion was narrowed out of this PR's stated scope rather than left as an unverified claim, which is the right call for this cell.

Design docs are EN/zh-CN consistent with the asserted behavior.

qqqys
qqqys previously approved these changes Oct 19, 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.

APPROVE — reviewed at head 22ae19b9504936a83bd2fb091570f89aeb5dd7b5.

The head is newer than the one review that assessed it, which a later push dismissed, so I re-verified at this SHA rather than inheriting it. No blocking finding was ever filed here — the one Suggestion is what produced the design this PR ships — and I found no Critical.

The shared fixture change is backward-compatible, which is the main risk in this diff. HostedSessionRelayForwardingProxy is used by sibling gate classes, so a behaviour change here would reach past this PR's own cell. It does not: Rule gains a responseMatcher field, and all three pre-existing factories — drop, hold, swallow — pass null for it. The rewritten selection loop branches on exactly that, so a rule with no response matcher takes if (rule.fires(method, path, text)) { armed = rule; break; }, identical to the previous code, and only dropResponse rules reach the new else if. fires() itself is untouched. Precedence is also right: the post-send block is gated on armed == null, so an explicitly armed request-level rule wins over a response-level one rather than being double-applied.

The new rule fixes the defect the Suggestion named, and its one-shot property is real. The cell previously dropped the first hook-execute reply, which only carries state: running — so it exercised receipt loss and then a normal hook-status retrieval, while the design doc claimed a decision-delivery scenario that was never injected. dropResponse requires the reply body to satisfy the predicate before the occurrence is spent, and because matchesResponse(...) is evaluated ahead of consume() in a short-circuit &&, a non-matching reply passes through without incrementing seen. That is what keeps a running acknowledgement from spending the settled drop. consume() is seen.incrementAndGet() <= occurrences with occurrences 1, so the drop is strictly one-shot, and it happens after client.send(...) — the right semantics for "the reply was lost once the worker had already settled", since the physical call still occurred exactly once.

The head commit strengthens the cell rather than relaxing it. The single outcome == "blocking" assertion, which did not match the shape actually stored, is replaced by three: outcome is success, /output/hookSpecificOutput/permissionDecision is deny, and /output/hookSpecificOutput/permissionDecisionReason is FG13_DENIED. The drop predicate moved to "permissionDecision":"deny" to match. So the cell now pins that the deny decision and its reason survive a lost reply and are replayed intact — which is the property the PR title claims — instead of asserting a field shape the store does not produce.

The cell is reachable and non-vacuous. FG13_DENY_LOSS is in the model double's tool-call allow-list at L551-554 alongside the other four prompts, so the double emits the tool_call that fires the PreToolUse Hook; without that literal the cell would die on its first events("hook.call") wait, which is the unreachable-gate defect that broke a sibling slice. Three independent witnesses remain: events("hook.call") at size 1 for one physical call, modelRequests.toString() not containing PROOF so the denied tool never ran, and proxy.log containing PROXY dropped hook-deny-settled-reply proving the drop occurred rather than being assumed. @Test and @Timeout counts are balanced at 5, all cells at @Timeout(300).

The budget re-pin is consistent and minimal, and those files did not move after the dismissed verification — the single commit since touched only the cell and both design docs, so the fixture, the .mjs, the pom, the workflow and the guard are unchanged. At head: pom fork 8559, meta-test literal toBe(8559), hostedForkHealthySeconds 7959, pin ['hosted-harness-mysql', 233, 246], Verify step 153 and job 246. 8559 − 7959 = 600 preserves the identity, 600 + 7959 = 8559 lands the per-class bound exactly, 8559 + 600 = 9159 ≤ 153 × 60 = 9180 while 152 × 60 = 9120 would be too small so 153 is minimal, and 153 + 10 + 20 + 50 = 233 ≤ 246 with 233 + 13 = 246. The values compose onto main's current 7809 / 8409 / 231 / 244 by exactly this slice's +150, so nothing already landed was dropped. The scope narrowing is honest too: the "deny reason reaches the model exactly once" claim was removed from the PR body and both design docs rather than left asserted-but-untested, and the twins moved symmetrically in the head commit.

CI at this head is very fresh and mostly unreported: authorize, assign and label pass, while Test (ubuntu-latest, Node 22.x) — the lane that runs the budget meta-test — Lint & Static, Integration Tests (no-AK, No Sandbox) and Build and verify reference distribution were all still pending. Nothing is failing and I did not poll, so pending lanes are not a gate; but it does mean the pins above are verified by my own arithmetic and by reading, not yet by an executed meta-test, and as on the sibling slices the Hosted process fault gates / MySQL 8.4 / Java 21 lane that would run the cell skips on the PR event, leaving the five cells' green evidence as the author's local runs.

Disclosure: I read the full proxy-fixture diff and traced the rule-selection precedence, the head commit's cell change, the allow-list and the @Test/@Timeout census at head, and the budget chain in the guard; the pom and workflow literals rest on files I confirmed by compare are byte-identical to the head where they were verified in detail. I did not read the new design docs' prose line by line or the .mjs fixture diff beyond the hook-deny mode, and I ran nothing locally.

@wenshao
wenshao enabled auto-merge (squash) October 19, 2026 13:19
Recompute the shared fork budget from main's 7809 s healthy plus this slice's 150 s: healthy 7959 s, fork 8559 s, Verify 153 minutes and the job 246. Keep the branch's hosted-harness-mysql ceiling row and adopt main's nineteen failover arms.
@wenshao
wenshao dismissed stale reviews from qqqys and yiliang114 via 033b6db October 19, 2026 14:28

@yiliang114 yiliang114 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM — the FG13f deny cell pins the Hook decision before any downstream effect and replays it identically after the dropped hook-status reply, with the response-aware one-shot drop keeping a running receipt from consuming the rule. Test-only change, no production surface affected. Earlier inline suggestions are non-blocking.

@wenshao
wenshao merged commit b83c89f into main Oct 19, 2026
75 of 82 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

SDK Java failed

Run 39269391180 · commit 033b6db49b81

Failing tests

  • com.alibaba.qwen.code.managedagent.HostedHookFaultGatesIT.fg13cWorkerKillLeavesTheHookUnknownAndKeepsTheSessionOnMySql
  • com.alibaba.qwen.code.managedagent.HostedSessionRelayFaultGatesIT.fg9bRefusedJournalCommitsHealOnlyThroughTheOriginalCommandOnMySql
  • com.alibaba.qwen.code.managedagent.HostedWorkspaceToolTurnIT.sessionStoreFailuresNeverReplayEffectsOnMySql(CapturedOutput)
  • com.alibaba.qwen.code.managedagent.HostedAutomationFaultGatesIT.fg11bHarnessStoreFaultsNeverRunTwiceOnMySql
  • com.alibaba.qwen.code.managedagent.HostedExtensionsIT.disconnectedMcpEffectIsNotReplayedAfterHarnessReplacementOnMySql
  • com.alibaba.qwen.code.managedagent.HostedTeamMemberCommandMySqlIT.memberHarnessRestartDuringCommandWait
  • com.alibaba.qwen.code.managedagent.HostedWorkflowRelayFaultGatesIT.fg10cRefusedRelayCommitsNeverAdvanceAWorkflowOnMySql

Tracking issue

@github-actions

Copy link
Copy Markdown
Contributor

Managed Agent gate failed

Run 39270611174 · commit 033b6db49b81

Failing tests

  • com.alibaba.qwen.code.managedagent.HostedHookFaultGatesIT.fg13cWorkerKillLeavesTheHookUnknownAndKeepsTheSessionOnMySql
  • com.alibaba.qwen.code.managedagent.HostedSessionRelayFaultGatesIT.fg9bRefusedJournalCommitsHealOnlyThroughTheOriginalCommandOnMySql
  • com.alibaba.qwen.code.managedagent.HostedWorkspaceToolTurnIT.sessionStoreFailuresNeverReplayEffectsOnMySql(CapturedOutput)
  • com.alibaba.qwen.code.managedagent.HostedAutomationFaultGatesIT.fg11bHarnessStoreFaultsNeverRunTwiceOnMySql
  • com.alibaba.qwen.code.managedagent.HostedExtensionsIT.disconnectedMcpEffectIsNotReplayedAfterHarnessReplacementOnMySql
  • com.alibaba.qwen.code.managedagent.HostedTeamMemberCommandMySqlIT.memberHarnessRestartDuringCommandWait
  • com.alibaba.qwen.code.managedagent.HostedWorkflowRelayFaultGatesIT.fg10cRefusedRelayCommitsNeverAdvanceAWorkflowOnMySql

Tracking issue

@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Released in v0.26.0.

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

Labels

scope/ci-cd Continuous integration/deployment scope/testing Test frameworks and cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants