Repository navigation
fix(review): gate the recovered incremental anchor on the model that certified it #9184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
5f3f779
cb366f5
4938c6b
79acdfd
7b7fa1e
c16d871
37923d4
0791c2f
cc5d36e
5e0e625
cc7a514
06c07ac
73dbd4d
59d25be
e862d00
148ba9a
f01c75b
bb66bce
a3de5af
ef2e5f3
4112877
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,7 +194,12 @@ export interface ComposeReviewInput { | |
| * handler strips it, as it does `env` and `prBodyFetcher`). | ||
| */ | ||
| draftedComments?: Array<{ path?: unknown; line?: unknown; body?: unknown }>; | ||
| /** Model id for the footer, e.g. `qwen3.7-max`. */ | ||
| /** | ||
| * Model id for the footer, e.g. `qwen3.7-max`. The marker's anchor takes | ||
| * the session-published identity instead when the CLI boundary injects one | ||
| * (`composeReview`'s `runtimeModelId`); this field is its fallback for runs | ||
| * no session published, and what the visible footer names either way. | ||
| */ | ||
| modelId: string; | ||
| } | ||
|
|
||
|
|
@@ -474,14 +479,27 @@ export function composeReview( | |
| input: ComposeReviewInput, | ||
| cliVersion = 'unknown', | ||
| attribution = true, | ||
| /** | ||
| * The model identity the RUNTIME publishes as active — `QWEN_CODE_MODEL`, | ||
| * injected by the two CLI boundaries from the environment the session | ||
| * exports. The marker's anchor certifies with THIS, never with the | ||
| * model-written state field alone; `input.modelId` is the fallback for | ||
| * runs no session published. Undefined in tests that call this directly. | ||
| */ | ||
| runtimeModelId?: string, | ||
| ): ComposeReviewResult { | ||
| const result = composeReviewBody(input, cliVersion, attribution); | ||
| // The ledger marker rides the body THIS function returns, because this — not | ||
| // the CLI handler — is what `submit` calls and posts. Appending it in the | ||
| // handler left the feature inert end to end: the marker reached only the | ||
| // composed JSON on disk, which nothing in the posting path reads, so no | ||
| // posted review ever carried one and every round recovered `null`. | ||
| const marker = ledgerMarkerFor(input, result.cappedBy); | ||
| const marker = ledgerMarkerFor( | ||
| input, | ||
| result.cappedBy, | ||
| attribution, | ||
| runtimeModelId, | ||
| ); | ||
| return marker ? { ...result, body: `${result.body}\n\n${marker}` } : result; | ||
| } | ||
|
|
||
|
|
@@ -493,6 +511,8 @@ export function composeReview( | |
| function ledgerMarkerFor( | ||
| input: ComposeReviewInput, | ||
| cappedBy: string[], | ||
| attribution: boolean, | ||
| runtimeModelId: string | undefined, | ||
| ): string | null { | ||
| try { | ||
| if (!input.planPath) return null; | ||
|
|
@@ -543,6 +563,25 @@ function ledgerMarkerFor( | |
| !failClosed && typeof plan.fetchedSha === 'string' | ||
| ? plan.fetchedSha | ||
| : undefined; | ||
| // The anchor's same-model qualifier: "clean up to `sha`" is THIS model's | ||
| // verdict, and Step 1's recovered-anchor gate refuses to scope another | ||
| // model's round to it. The identity is the one the RUNTIME published — | ||
| // the boundaries inject it, a model cannot type it — with the | ||
| // model-written field only as the fallback for runs no session published | ||
| // (and boundary-validated then whenever attribution is on): a review | ||
| // running under one model could otherwise type another's id and certify | ||
| // the range to a model that never reviewed it. Withheld entirely when | ||
| // attribution is off: the setting's contract is "whether the posted | ||
| // review names its model", the marker rides the posted body, and a | ||
| // suppression the footer honours must reach the invisible half too — the | ||
| // anchor then degrades to the skill's absent-model fail-safe. The | ||
| // serializer writes it only beside a sha. | ||
| const runtime = | ||
| typeof runtimeModelId === 'string' ? runtimeModelId.trim() : ''; | ||
| const declared = | ||
| typeof input.modelId === 'string' ? input.modelId.trim() : ''; | ||
| const certifying = runtime !== '' ? runtime : declared; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still escalated for a maintainer decision — deliberately unchanged this round. The point turns on the identity contract: accept the bare runtime model id ( 中文说明仍在等待维护者决策——本轮刻意未做改动。这一点取决于身份契约的选择:接受裸运行时模型 id(
Comment on lines
+999
to
+1003
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Round disposition: escalated to maintainers — no code change this round (thread stays open). Re-verified at this head: both identity arms are still bare model strings ( The decision requested is one of:
Either answer lands as ordinary feedback next round; option A would add the limitation note to DESIGN.md before merge. 中文说明本轮处置:升级给维护者——本轮不改代码(线程保持开放)。 已在当前 head 上复核:两个身份分支仍是裸的模型字符串( 请求的决策二选一:
任一答复都会在下一轮作为普通反馈落地;若选 A,合入前会把局限说明补进 DESIGN.md。
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still escalated, not implemented — this finding turns on the maintainer decision that has been open since round 1, and this round changed nothing about the identity (verified at The decision, as before:
Recommendation: Option A. The collision needs two live configurations that agree on a model id but disagree on the underlying model; the findings work list still crosses configurations intact (only the anchor travels on the id); and this PR is at round 5 under the diff-growth brake — option B adds identity machinery beside the auth path to a diff already over budget. If the limitation is unacceptable, B is the honest fix, but it is a design change a maintainer should shape. Question for the maintainer: A or B (or a third option)? The answer lands as ordinary feedback next round; until then this thread stays open. 中文说明仍然保持升级上报状态,未实施——该发现取决于自第 1 轮起一直开放的维护者决策,且本轮未对身份做任何改动(已在 决策与之前一致:
建议:选项 A。该碰撞需要两套模型 id 相同、底层模型却不同的在线配置;findings 工作列表仍会完整跨配置传递(只有 anchor 依赖该 id);且本 PR 已进行到第 5 轮并处于 diff 增长刹车之下——选项 B 会在认证路径旁为已超预算的 diff 增加身份机制。若该局限不可接受,B 才是诚实的修法,但那是应由维护者主导的设计变更。 给维护者的问题: A 还是 B(或第三种方案)?答复将在下一轮作为普通反馈进入;在此之前本线程保持开放。
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This round is a maintainer-decision handoff: the growth brake engaged (3+ rounds over budget), which forbids further code changes this round, and this finding has been escalated for exactly this decision since round 1. Re-verified at the current HEAD — both arms of The open question for the maintainer: option A — accept the bare runtime id as this PR's identity contract, record the two-provider limitation in DESIGN.md, and track a provider-aware identity as a follow-up issue; or option B — implement the provider-aware identity before merge. Recommendation on record: A — the collision trigger is exotic, the marker channel is already documented as not a forgery boundary, the gate fails safe on mismatch, and option B is follow-up-sized — but the call is the maintainer's. Thread stays open until it is answered. 中文说明本轮是一次交由维护者决策的交接:增长刹车已触发(连续 3 轮以上超出预算),本轮禁止再做任何代码修改,而本条发现自第 1 轮起升级上报的正是这一决策。已在当前 HEAD 复核 —— 留给维护者的问题:选项 A —— 接受裸运行时 id 作为本 PR 的身份契约,把双 provider 局限记录进 DESIGN.md,并将 provider 感知的身份作为跟进 issue 追踪;或 选项 B —— 在合并前实现 provider 感知的身份。已记录的推荐:A —— 碰撞触发条件苛刻,marker 通道本就记录在案、不是防伪造边界,闸门在不匹配时 fail safe,且选项 B 属于跟进级别的工作量 —— 但决定权在维护者。线程保持开放,等待答复。 |
||
| const model = attribution && certifying !== '' ? certifying : undefined; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This round deliberately leaves the blocker unresolved. At this commit the marker's certifying identity is still the bare runtime model string ( The previous round escalated exactly this point for a maintainer decision, and that decision is still open. The two options, restated:
Recommendation on record: Option A. This PR's threat model is forgery through model-typed channels, which the runtime injection closes; cross-provider id collision is a narrower scenario, and fixing it requires a design decision across the core auth/provider/config surface, which is maintainer-only per AGENTS.md. This thread stays UNRESOLVED until a maintainer chooses; the answer arrives as ordinary feedback next round. 中文说明本轮有意保持该阻断项未解决。在本提交上,marker 的认证身份仍是裸的运行时模型字符串( 上一轮已就这一点升级上报、等待维护者决策,该决策仍未落地。两个选项重述如下:
记录在案的建议:选项 A。本 PR 的威胁模型是经由模型可填写通道的伪造,运行时注入已经关闭了该通道;跨 provider 的 id 冲突是更窄的场景,其修复需要在 core 的 auth/provider/config 表面做设计决策——按 AGENTS.md 属维护者专属。该线程保持未解决,直到维护者作出选择;答复会在下一轮作为普通反馈到达。 |
||
| return serializeLedger({ | ||
| ...buildLedger( | ||
| prevRound + 1, | ||
|
|
@@ -556,6 +595,7 @@ function ledgerMarkerFor( | |
| .filter((entry) => entry.trim() !== ''), | ||
| ), | ||
| ...(sha ? { sha } : {}), | ||
| ...(model ? { model } : {}), | ||
| }); | ||
| } catch { | ||
| // A carry-forward convenience, never worth failing the verdict over. | ||
|
|
@@ -2342,6 +2382,10 @@ export const composeReviewCommand: CommandModule = { | |
| footerVersion(process.env['QWEN_CODE_STARTUP_VERSION']) ?? | ||
| (await getCliVersion()), | ||
| operatorReviewSettings().attribution, | ||
| // The anchor's certifying identity is the model the session ACTUALLY | ||
| // runs — Config publishes it per session, the shell tool injects it | ||
| // into this subprocess — not the id the state JSON typed. | ||
| process.env['QWEN_CODE_MODEL'], | ||
| ); | ||
| // The exact terminal verdict, persisted beside the fields it is computed | ||
| // from. `event` + `cappedBy` alone cannot reconstruct it — a presubmit | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accepted — the trim→declared-fallback branch is unpinned as described, and the proposed test is the right shape. Deferred this round for two recorded reasons: the growth brake forbids further changes of any kind this round, and tests are exactly the bucket over budget (482/400), so even a one-test pin grows the overage. Slated for the same bounded round as the R6-1 fix if the maintainer approves the handoff recommendation; otherwise it will be tracked with it as a follow-up. Thread stays open.
中文说明
接受 —— trim→填写值回退分支确实如描述所述没有被测试固定,提议的测试形态也是对的。本轮延后,记录两条原因:增长刹车禁止本轮做任何改动;测试恰是超预算的桶(482/400),即便只加一个测试也会扩大超出量。若维护者批准交接中的建议,它与 R6-1 的修复安排在同一有界轮次;否则作为跟进事项一并追踪。线程保持开放。