Repository navigation
test(managed-agent): replay a denied Hook decision after a lost reply - #14701
Conversation
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.
|
|
wenshao
left a comment
There was a problem hiding this comment.
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.
|
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 Size: no core paths touched ( 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 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: Moving on to code review. 🔍 中文说明感谢贡献! 模板完整 ✓ —— 所有必填小节都写了,包括操作系统矩阵和中英双语设计文档。 问题: 这不是 bug fix,所以不需要 before/after 复现——它补的是仓库已在跟踪的门禁矩阵中的一格。Issue #14449 处于 open 状态,并明确列出了 FG13a–FG13f;FG13a 已经落地 command / catalog / HTTP 三条丢回复臂,本 PR 补上 FG13f「决策投递」的第一臂。所以这个缺口是有记录、有排期的,不是假设。对仅测试改动的 PR 来说,这满足「问题是否存在」的门槛。 方向: 对齐。要钉住的命题选得对: 规模: 未触及核心路径( 方案: 范围合理,没看到可砍的部分。复用现有 FG13a 丢回复装置、给夹具加一个 风险: 无升级风险信号——改动文件都不匹配与回滚相关的路径清单。有一点值得点出,因为这里最容易出错:本 PR 改了 进入代码审查 🔍 — Qwen Code · qwen3.8-max-2026-09-02 Reviewed at |
Code reviewI wrote my independent proposal from the title and the "Why it's needed" section before opening the diff: one No critical blockers. What I did verify, since this is a PR whose entire value is whether the gate actually bites:
Four non-blocking notes, most substantive first:
Testing evidenceThis 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 Also still pending: Final CI results for
One row per check name (latest run); skipped checks omitted; failures sort first. / 每个检查名一行(取最新一次运行),省略 skipped,失败项排在最前。 Sandboxed verification would settle the part CI can't: 中文说明代码审查在看 diff 之前,我先根据标题和「为什么需要」写下了自己的方案:在 无阻断性问题。 由于这个 PR 的全部价值就在于门禁是否真的会咬人,我重点核实了:
四点非阻断建议,按重要性排列:
测试证据本次评审携带的是 PR 自身 CI(通过 API 读取)——没有构建或执行任何 PR 代码。在所审 commit 上失败检查为 0,套件仍在运行。本 PR 的关键车道是 同样待定: 沙箱验证可以补上 CI 补不了的那部分: — Qwen Code · qwen3.8-max-2026-09-02 Reviewed at |
|
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 The fixture design is the part I'd single out. Putting 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:
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 中文说明信心度:4/5 —— 审查干净、无阻断项;保留意见分别是作者自己已指出的测试强度缺口、一处过期的头部注释,以及关于预算余量的提醒。唯一横在本次评审与批准之间的,是真正运行该用例的车道还没开始跑。 退一步看:这是一个有跟踪矩阵中范围界定良好的一格,读起来像是被「不会咬人的门禁」坑过的人写的。真正说服我的不是断言本身,而是围绕断言的防空过设计。断言代理日志包含这次丢弃,意味着故障静默未注入时用例不会变绿;断言 夹具设计是我要特别点出的一处。让 我的独立方案与 PR 的做法落在同一处,对这种体量的改动来说通常是好兆头。六个月后再读,它是矩阵里新增的一格,而预算阶梯在每一级都有就地注释——维护起来有点烦,但这份烦是刻意的,正是它避免了 fork 在跑到一半时被杀掉、然后无法诊断地失败。 三点如实保留,均不阻断:
我没有构建或执行本 PR 的任何代码;信心来自把 diff 与相邻用例和辅助方法对照阅读、逐一核对元测试对新数值施加的算术守卫,以及 PR 自身的 CI。该 CI 仍在运行,目前失败检查为 0,但 — Qwen Code · qwen3.8-max-2026-09-02 Reviewed at |
wenshao
left a comment
There was a problem hiding this comment.
评审基于 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
left a comment
There was a problem hiding this comment.
复评基于 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
left a comment
There was a problem hiding this comment.
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.dropResponseis only consumed insidematchesResponse, so arunningacknowledgement passes through without spending the occurrence, andconsume()isseen.incrementAndGet() <= 1— strictly one-shot. The drop also happens afterclient.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 recordsPROXY dropped <name>and returns beforesendResponseHeaders, and the exchange closes infinally. That is the exact string the cell asserts on. - The emitter chain actually reaches the cell.
modelReply's prompt allow-list now containsFG13_DENY_LOSS, so the double emits atool_callfor this prompt and a PreToolUse Hook fires at all — without that literal the cell would have died on its firstevents("hook.call")wait. In the fixture,hook-denyjoinssoloand recordshook.denywithpermissionDecision: 'deny'/ reasonFG13_DENIED, so bothhook.deny hasSize(1)andhook.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)andhostedForkHealthySeconds = 7959to match. Every helper the cell uses exists at this head, andjava.util.function.Predicateis 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.
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.
|
F1 confirmed and fixed at The persisted deny is 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. |
Local verification round 2 —
|
| 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 / 246pins 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
3. M2 mutant — forged settled receipt turns the cell red

4. Fork-budget meta-test 58/58

中文摘要(点击展开)
本地真实车道验证 第 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
left a comment
There was a problem hiding this comment.
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.dropResponseis consulted only afterclient.send(...), and the one-shot is spent insidematchesResponse+consume(), so arunningreceipt passes through without consuming the rule. Existing drop/hold/swallow rules keep their request-time semantics (responseMatcher == nullbranch unchanged). - The deny path is a real deny.
hook-denyrecordshook.denyand answerspermissionDecision: deny/FG13_DENIED; the cell asserts onehook.call, nohook.allow,recovery_blocked/outcome_unknownfirst, then the same operation settles through the Harness status route withoutcome=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*60and233 + 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
left a comment
There was a problem hiding this comment.
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.
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.
yiliang114
left a comment
There was a problem hiding this comment.
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.
|
|
|
Released in v0.26.0. |










What this PR does
Adds the first FG13f decision-delivery cell. A
PreToolUsecommand Hook returns deny, and the broker proxy drops the first settledhook-statusreply 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=successwithpermissionDecision=deny, and the tool never runs. The forwarding proxy gains a response-aware one-shot drop so arunningreceipt 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-mysqllane on Linux with MySQL 8.4 and a delegated cgroup v2 root. The new cell boots the existing reply-loss rig with the fixture'shook-denymode, drops the first settledhook-statusreply, submits one prompt, and asserts onehook.call, onehook.deny, nohook.allow, the unknown first, a later status read settling withoutcome=successandpermissionDecision=deny, and no file proof. A skipped cell is not a passing gate.Evidence (Before & After)
N/A — test-only.
Tested on
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
failClosedfailure reply, oversized outputs, the receipt cap and the 16-running quota, a suppressedMessageDisplayreload), FG13b, FG13e, and local non-managed Hooks.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——仅测试改动。
测试环境
风险与范围
failClosed失败回复、超大输出、回执上限与 16 个运行名额、被抑制的MessageDisplay重载)、FG13b、FG13e,以及本地非托管 Hook。关联 Issue
#14449 的一部分。