Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

πŸ”¨ chore(deep-review): add release-risk dimension and scope control (#17606)

YuTengjing77774238a4a9
diff --git a/.agents/skills/deep-review/SKILL.md b/.agents/skills/deep-review/SKILL.md
index 61a96402350..02d49205a0f 100644
--- a/.agents/skills/deep-review/SKILL.md
+++ b/.agents/skills/deep-review/SKILL.md
@@ -30,36 +30,38 @@ Do not auto-escalate light to deep. Do not run deep mode for a casual "ηœ‹ηœ‹θΏ™
Rules live in one place: [`references/dimensions/`](references/dimensions/), one file per dimension. Both modes read the same files (light mode reads only the `Quick checklist` section; deep-mode subagents read the full file plus its listed rule sources).
-| Dimension | id prefix | Covers | Verified? |
-| ----------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
-| [code-style](references/dimensions/code-style.md) | `style` | naming, readability, dead code, comments, i18n hardcoding, UI-library and styling conventions | yes |
-| [logic](references/dimensions/logic.md) | `logic` | logic correctness: edge cases, null, races, error handling, state machines, requirement deviation, test coverage | yes |
-| [business-logic](references/dimensions/business-logic.md) | `design` | design judgment: framework misuse, best-practice violations, solution-weight mismatch, self-inflicted complexity | yes |
-| [reuse-architecture](references/dimensions/reuse-architecture.md) | `reuse` | duplicate implementations, unused existing patterns, extensibility, architectural boundaries | yes |
-| [performance](references/dimensions/performance.md) | `perf` | N+1, blocking calls, resource leaks, render-path waste, **DB migration locking and idempotency** | yes |
-| [security](references/dimensions/security.md) | `sec` | injection, auth bypass, secret/PII leakage, business-slot confidentiality | yes |
-| [compatibility](references/dimensions/compatibility.md) | `compat` | light/dark theme, desktop app / web (desktop, mobile) / RN, released-client API compatibility, client vs server agent runtime (gateway on/off), Vercel vs Docker deploys, paired router configs | yes |
-| [ux](references/dimensions/ux.md) | `ux` | empty/loading/error states, async feedback, confirmation flows, design-value adherence | yes |
-| [observability](references/dimensions/observability.md) | `obs` | bug fixes without explanatory comments/issue links, uncommented hacks, silent catches, missing logs on key paths | yes |
-| [workflow](references/dimensions/workflow.md) | `flow` | issue tracking state, PR description freshness, undocumented key decisions, CI / preview build status | no (objective state) |
-| [skill-freshness](references/dimensions/skill-freshness.md) | `skill` | agent skills invalidated by this diff, knowledge worth distilling into a new skill | no (advisory) |
-
-`Verified? no` means findings from that dimension are objective state checks or advisories β€” they skip the verify pass and go straight to the report.
+| Dimension | id prefix | Covers | Verified? |
+| ----------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
+| [code-style](references/dimensions/code-style.md) | `style` | naming, readability, dead code, comments, i18n hardcoding, UI-library and styling conventions | yes |
+| [logic](references/dimensions/logic.md) | `logic` | logic correctness: edge cases, null, races, error handling, state machines, requirement deviation, test coverage | yes |
+| [business-logic](references/dimensions/business-logic.md) | `design` | design judgment: framework misuse, best-practice violations, solution-weight mismatch, self-inflicted complexity | yes |
+| [reuse-architecture](references/dimensions/reuse-architecture.md) | `reuse` | duplicate implementations, unused existing patterns, extensibility, architectural boundaries | yes |
+| [performance](references/dimensions/performance.md) | `perf` | N+1, blocking calls, resource leaks, render-path waste, **DB migration locking and idempotency** | yes |
+| [release-risk](references/dimensions/release-risk.md) | `risk` | ship/no-ship gate: irreversible persisted state (incl. schemaless shape drift), dev-cycle migration residue, in-flight work & config at deploy time, irreversible outbound effects, prompt/tool-description behavior shifts, shared-surface and high-frequency-UI blast radius, PR purity | yes + checks |
+| [security](references/dimensions/security.md) | `sec` | injection, auth bypass, secret/PII leakage, business-slot confidentiality | yes |
+| [compatibility](references/dimensions/compatibility.md) | `compat` | light/dark theme, desktop app / web (desktop, mobile) / RN, released-client API compatibility, client vs server agent runtime (gateway on/off), Vercel vs Docker deploys, paired router configs | yes |
+| [ux](references/dimensions/ux.md) | `ux` | empty/loading/error states, async feedback, confirmation flows, design-value adherence | yes |
+| [observability](references/dimensions/observability.md) | `obs` | debug: unexplained fixes, uncommented hacks, silent catches, missing logs; product: analytics on qualifying new capabilities; perf: monitoring on high-frequency / high-traffic / polling paths | yes |
+| [workflow](references/dimensions/workflow.md) | `flow` | issue tracking state, PR description freshness, undocumented key decisions, CI / preview build status | no (objective state) |
+| [skill-freshness](references/dimensions/skill-freshness.md) | `skill` | agent skills invalidated by this diff, knowledge worth distilling into a new skill | no (advisory) |
+
+`Verified? no` means findings from that dimension are objective state checks or advisories β€” they skip the verify pass and go straight to the report. `yes + checks` means the dimension's findings are verified normally, but it also emits a second, unverified output β€” `release_checks`, pre-deploy confirmation items about production state the repo cannot answer (see its dimension file).
### Pruning table (deep mode)
Before spawning, the main agent prunes dimensions that cannot apply to the diff. List pruned dimensions and the one-line reason in the report header. When in doubt, run the dimension.
-| Dimension | Skip when |
-| ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
-| code-style, logic, business-logic, reuse-architecture | never (skip only for docs/lockfile-only diffs) |
-| performance | no server/db/loop/render-path code touched (e.g. docs, copy, pure type changes) |
-| security | lockfile/generated-only diff β€” docs and copy still run it (text is a leak vector: secrets, internal URLs, commercial details) |
-| compatibility | diff touches no UI theming/routing, no API contract, no deployment config, no runtime-branching code |
-| ux | no user-facing surface changed (components, styles, copy, interaction flows) |
-| observability | no error handling, async flow, or server code touched |
-| workflow | never in deep mode (cheap external-state checks) |
-| skill-freshness | never in deep mode (cheap) |
+| Dimension | Skip when |
+| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| code-style, logic, business-logic, reuse-architecture | never (skip only for docs/lockfile-only diffs) |
+| performance | no server/db/loop/render-path code touched (e.g. docs, copy, pure type changes) |
+| release-risk | no DB schema/migration, no schemaless persisted payload, no queue/cron/config/outbound dependency, no prompt or tool-description text, no shared component or package public API, no high-frequency user surface, and the diff has one obvious purpose |
+| security | lockfile/generated-only diff β€” docs and copy still run it (text is a leak vector: secrets, internal URLs, commercial details) |
+| compatibility | diff touches no UI theming/routing, no API contract, no deployment config, no runtime-branching code |
+| ux | no user-facing surface changed (components, styles, copy, interaction flows) |
+| observability | no error handling, async flow, server code, new user-facing capability, or perf-sensitive path touched |
+| workflow | never in deep mode (cheap external-state checks) |
+| skill-freshness | never in deep mode (cheap) |
**"Docs-only" means human-facing prose only.** Files that are executable instructions for agents β€” `.agents/skills/**`, `AGENTS.md` / `CLAUDE.md`, prompt templates, orchestration manuals β€” count as code for pruning purposes: their "prose" carries control flow, contracts, and rules whose contradictions are exactly what logic / business-logic / reuse-architecture exist to catch. A diff touching them is never docs-only.
@@ -70,15 +72,19 @@ Light mode applies the same table to decide which Quick checklists to read.
A wrapping repository (e.g. a private deployment that vendors this repo as a submodule) can extend the rule set without forking this skill: any sibling skill directory in the active skills root matching `deep-review-*` (for example `.agents/skills/deep-review-cloud/`) is an extension pack.
- Extension packs contain `dimensions/*.md` files in the same format; a file named after a built-in dimension **extends** it (load both), a new name **adds** a dimension.
+- An extension file declaring `extends: <name>` where no such built-in dimension exists (typically because the wrapping repo pins an older submodule commit) falls back to standing on its own. Such a file must therefore carry its own `id_prefix` / `verify` / `skip_when` so it stays usable either way; when the built-in is present, the built-in's frontmatter wins.
- Both modes must check for extension packs at startup and load whatever is present. Absence is normal β€” this skill is self-sufficient.
- Extension packs may carry rules that must not live in this open-source repo; never copy their content into files under this directory.
## Light mode procedure
-1. Determine review scope exactly as deep mode step 0 does (see the environment manual's scope rules β€” local default ref, three-dot diff, submodule diffs included), but skip the background-hunting extras when context already tells you what changed.
+1. Determine review scope exactly as deep mode step 0 does (see the environment manual's scope rules β€” three-dot diff from a base that does not lag the fork point, submodule diffs included), but skip the background-hunting extras when context already tells you what changed.
2. Apply the pruning table; read the `Quick checklist` section of each surviving dimension file, plus extension-pack counterparts.
3. Review inline. Findings must cite a rule source or code evidence; respect the codebase-calibration principle.
-4. Output in your environment's normal review format (light mode does NOT use the deep report template). Mention that deep mode exists if findings suggest the diff deserves a full pass.
+4. Label every finding on the same two axes deep mode uses, and let them drive the recommendation:
+ - **Introduced or pre-existing** β€” if the problem lives in code this diff did not change, do not fix it here. Say who introduced it (`git blame` / `git log -L` on the location) and offer to file a Linear issue for that owner. The only exception is an old bug this diff makes reachable or harmful for the first time, at P0.
+ - **Likelihood** β€” high / medium / low, judged on the real production path. State it next to the severity. A `low`-likelihood, non-blocking finding is a follow-up, not a fix-now item; on a repeat review of the same change, list it in one line and move on instead of re-arguing it.
+5. Output in your environment's normal review format (light mode does NOT use the deep report template). When `release-risk` produced pre-deploy confirmation items, list them as a short checklist separate from the findings β€” they are questions about production state, not defects. Mention that deep mode exists if findings suggest the diff deserves a full pass.
## Deep mode procedure
diff --git a/.agents/skills/deep-review/references/claude-code/main.md b/.agents/skills/deep-review/references/claude-code/main.md
index 0affd815ce5..64d5648cf62 100644
--- a/.agents/skills/deep-review/references/claude-code/main.md
+++ b/.agents/skills/deep-review/references/claude-code/main.md
@@ -33,7 +33,7 @@ Verification is per-dimension and starts the moment that dimension's reviewer re
On each reviewer's return:
1. Extract the ` ```json ` fence, `JSON.parse` it. Parse failure or wrong schema β†’ reject and re-spawn that reviewer with the same prompt (malformed JSON is itself a laziness signal).
-2. Dimension marked `verify: false` (workflow, skill-freshness) β†’ findings go straight to the report pool.
+2. Dimension marked `verify: false` (workflow, skill-freshness) β†’ findings go straight to the report pool. A returned `release_checks` array (release-risk only) likewise bypasses verification entirely β€” never feed it to a verify subagent; it holds questions about production state, not claims to falsify.
3. Zero findings β†’ done with this dimension.
4. Otherwise spawn a verify Task immediately: read [`../verify-prompt.md`](../verify-prompt.md), substitute `{issues}` (this reviewer's findings array), `{scope_summary}`, `{changes}`; `description`: `verify: <dimension>`.
@@ -43,7 +43,7 @@ Anti-shortcut validation on each verify return:
- Mismatch β†’ spawn a fresh verify Task carrying only the missing ids' original findings and the full verify prompt (every Task is a new subagent; re-supply full context). Do not loosen the check.
- > 20 findings from one reviewer β†’ split verification into 2 batches by id order (rare; default is one batch).
-Verdict handling: `confirmed` β†’ report pool (apply `fix_options_override` / `nature_override` / `same_root_as`); `false_positive` β†’ drop; `need_more_context` β†’ "Needs your input" appendix. Never let the main agent "fill in context" and re-verify by itself β€” that pollutes the main context and violates the independence principle; escalate through the appendix instead.
+Verdict handling: `confirmed` β†’ report pool (apply `fix_options_override` / `nature_override` / `exposure_override` / `likelihood_override` / `same_root_as`); `false_positive` β†’ drop; `need_more_context` β†’ "Needs your input" appendix. Never let the main agent "fill in context" and re-verify by itself β€” that pollutes the main context and violates the independence principle; escalate through the appendix instead.
## Step 4 β€” Render the report
@@ -63,10 +63,15 @@ When the batch is non-empty, use `AskUserQuestion` (don't just write "want me to
Confirmed findings with `can_auto_fix: false` plus the `need_more_context` appendix need user decisions. When non-empty, drive them through `AskUserQuestion`:
- ≀ 4 questions per call; order by P0 β†’ P1 β†’ P2, `blocks_release: true` first; tell the user when more remain for the next round.
+- **Only in-scope findings enter this loop.** Everything rendered under `Hand off to owner` is excluded β€” never offer to fix a pre-existing problem here, and never let a fix-option question quietly pull legacy code into the diff. Low-likelihood non-blocking findings go last, and on a repeat review they are skipped entirely unless the user asks.
- One finding = one question: confirmed items offer their `fix_options` as options (single option β†’ `Apply the fix` / `Skip this round`); `need_more_context` items ask for the missing context (`I'll provide it` / `Park it`).
- Apply whatever the user picks (tests included where flagged); park the rest.
-Both lists empty β†’ the report ends the flow; ask nothing.
+Both lists empty β†’ skip this step silently and go to Step 7; the hand-off question stands on its own.
+
+## Step 7 β€” Offer to file the hand-off issues
+
+Runs whether or not Step 6 asked anything β€” only condition is that `Hand off to owner` is non-empty. One `AskUserQuestion`: `N pre-existing problems belong to other owners β€” create Linear issues for them?` with options `Create all` / `Pick some` / `Not now`. Do not create anything before the user answers. On approval, follow the `linear` skill: Chinese content, one issue per finding, description carrying location + culprit commit/author/date + scenario + likelihood + the evidence from verification, assigned to the culprit author when identified. Report the created issue keys.
## Notes
diff --git a/.agents/skills/deep-review/references/codex/main.md b/.agents/skills/deep-review/references/codex/main.md
index 3741b334376..be5d426fe91 100644
--- a/.agents/skills/deep-review/references/codex/main.md
+++ b/.agents/skills/deep-review/references/codex/main.md
@@ -1,12 +1,13 @@
# Deep Review Β· Codex Manual
-Deep mode in Codex, end to end. "Subagent" below means a `spawn_agent` agent: subagents share no context with the main agent, so every prompt must be self-contained.
+Deep mode in Codex, end to end. "Subagent" below means a `spawn_agent` agent. Every prompt is written to be self-contained, which is correct under any Codex version.
-Codex constraints this manual is built around:
+The multi-agent API differs across Codex versions β€” tool names, parameters, and defaults all move. **Everything in this section is a claim to verify against the session you are actually in, not a fact to rely on.** Read the discovered tools' real schemas before step 2 and bind the manual's verbs and parameters to what exists.
-- **Tool discovery first**: multi-agent tool names vary by Codex version and may stay hidden until discovered β€” e.g. surfaced via `tool_search` as `multi_agent_v1.spawn_agent` / `wait_agent` / `close_agent`, or exposed directly as `spawn_agent` / `wait` / `close_agent`. Before step 2, search/list the session's tools and bind the spawn/wait/close verbs used below to the names actually exposed; do not assume this manual's names exist verbatim. If no multi-agent tools can be surfaced, stop and offer light mode.
+- **Tool discovery first**: names vary β€” e.g. surfaced via `tool_search` as `multi_agent_v1.spawn_agent` / `wait_agent` / `close_agent`, or exposed directly as `spawn_agent` / `wait` / `close_agent`. Search/list the session's tools and bind the spawn/wait/close verbs used below to the names actually exposed; do not assume this manual's names exist verbatim. If no multi-agent tools can be surfaced, stop and offer light mode.
+- **Context inheritance is the one default you must not guess.** Independent reviewers are the whole point of deep mode β€” a subagent that inherits the main agent's context has already seen your reasoning and will confirm it rather than review it. That failure is silent: the flow completes, the report looks normal, the independence is gone. So read the spawn tool's schema for whatever controls inheritance (`fork_turns`, `fork_context`, or a version-specific equivalent) and set it explicitly to **no inheritance** β€” never rely on the default being off. If the tool exposes no such control and inheritance cannot be turned off, say so in the report: the verify pass is then not adversarial and its `confirmed` verdicts are weaker than they look.
- **Concurrency budget**: multi\_agent\_v2 caps concurrent threads per session (default 4 including the root β€” 3 usable subagent slots); the legacy `agents.max_threads` default is 6. The flow therefore runs dimensions as **3 composite groups** in a single wave instead of one agent per dimension.
-- **Slots are held until closed**: a finished agent still occupies its slot until `close_agent`. Close every agent as soon as you've consumed its result.
+- **Slot lifecycle decides which step-3 algorithm you run.** Where a close verb exists, a finished agent holds its slot until closed, and closing promptly is what lets review and verify pipeline (step 3, Lane A). Where the session exposes no close verb, slot recycling is not yours to drive: run the two-wave algorithm instead (Lane B). Settle which during tool discovery, before step 2 β€” the two lanes differ throughout, so half of each does not compose.
- **Delegation policy**: Codex spawns subagents only when the user explicitly allows agent delegation. Deep mode is explicitly invoked, which is that permission; if your session policy still forbids spawning, stop and offer light mode β€” never degrade to a single-agent "deep review".
- Model per agent: balanced tier is enough (rules carry the quality); use a faster/mini tier for the `process` group, which is scan-heavy.
@@ -14,15 +15,15 @@ Codex constraints this manual is built around:
Dimension rules stay one-per-file; Codex only changes how they are **packed**:
-| Group | Dimensions (in prompt order) |
-| ------------- | -------------------------------------------------- |
-| `quality` | code-style, reuse-architecture, business-logic, ux |
-| `correctness` | logic, performance, security, compatibility |
-| `process` | workflow, skill-freshness, observability |
+| Group | Dimensions (in prompt order) |
+| ------------- | --------------------------------------------------------- |
+| `quality` | code-style, reuse-architecture, business-logic, ux |
+| `correctness` | logic, performance, security, compatibility, release-risk |
+| `process` | workflow, skill-freshness, observability |
-Pruning removes dimensions from a group; a fully pruned group is not spawned. The table is a starting point β€” recalibrate the packing in this file if group runtimes drift far apart.
+Pruning removes dimensions from a group; a fully pruned group is not spawned. The table is a starting point β€” recalibrate the packing in this file if group runtimes drift far apart. `release-risk` sits with `performance` on purpose: both read the migration files, from opposite angles (cost vs reversibility), so one agent reads them once. Keep the angle separation their dimension files define β€” one shared agent must still emit two distinct findings, never a merged one.
-Extension packs can also **add** dimensions (a `deep-review-*/dimensions/` file whose name matches no built-in). Added dimensions have no row in the table: collect them into a dynamic fourth group, `extras`. `extras` never joins the initial wave β€” it queues until the first `close_agent` frees a slot (a slot is only free in the initial wave when a built-in group was fully pruned). Their verify routing follows each dimension file's own `verify` frontmatter flag (default: verified).
+Extension packs can also **add** dimensions (a `deep-review-*/dimensions/` file whose name matches no built-in). Added dimensions have no row in the table: collect them into a dynamic fourth group, `extras`. It exceeds the slot budget unless a built-in group was fully pruned, so step 3 schedules it β€” first freed slot in Lane A, next batch in Lane B β€” but it is never dropped. Its verify routing follows each dimension file's own `verify` frontmatter flag (default: verified).
## Step 0 β€” Scope & background
@@ -32,30 +33,51 @@ Follow [`../scoping.md`](../scoping.md). Outputs: `{changes}` (diff text or fetc
Same as the pruning + extension-pack procedure in `SKILL.md`: apply the pruning table, detect sibling `deep-review-*` extension packs, collect each surviving dimension's rule-file paths (built-in + extension counterpart). Map surviving dimensions onto the group table; extension-added dimensions go to the `extras` group (see above) so downstream rules never get silently dropped.
-## Step 2 β€” Spawn all groups in one wave
+## Step 2 β€” Build every agent prompt
-Launch the three built-in groups' `spawn_agent` concurrently in a single turn (≀ 3 agents β€” fits the default slot budget). A non-empty `extras` group is NOT part of this wave: queue it β€” step 3's dispatch priority gives it the first freed slot (step 3 closes each review agent as soon as its result is consumed, so the wait is short).
-
-Per group:
+Per group (built-in groups plus a non-empty `extras`):
1. Read [`../review-prompt.md`](../review-prompt.md); instantiate:
- `{dimensions}` β†’ the group's surviving dimension ids (comma-separated)
- `{dimension_files}` β†’ all their rule-file paths
- `{scope_summary}` / `{changes}` β†’ step 0 outputs
-2. Substituted text β†’ `spawn_agent.message`. Prompts are self-contained; `fork_context` stays `false` unless the session holds hard-to-summarize requirement background.
+2. Substituted text β†’ `spawn_agent.message`. Prompts are self-contained, so set the inheritance control discovered in the constraints section to **no inheritance** β€” this is the step where reviewer independence is won or silently lost.
+
+## Step 3 β€” Run review and verify
+
+Which algorithm you run depends on **one** thing settled during tool discovery: does the session expose a verb that closes/releases a finished agent? Pick a lane now and stay in it β€” do not mix.
+
+Both lanes share the same per-result handling, referred to below as **consume(agent)**:
+
+1. Extract the ` ```json ` fence and parse. Parse failure / wrong schema β†’ reject and re-spawn that group with the same prompt. **A retry is a review agent like any other** β€” it joins Lane A's review wait set, and in Lane B it extends the review wave. Neither lane may begin verification while a retry is outstanding: that group's findings and release checks would be absent from the report entirely, which is worse than unverified.
+2. Partition its findings by dimension `verify` flag: `verify: false` dimensions (workflow, skill-freshness) go straight to the report pool; zero verifiable findings β†’ done with this group. A returned `release_checks` array (release-risk only) also bypasses verification β€” never include it in `{issues}`; it holds questions about production state, not claims to falsify.
+3. The remainder becomes that group's verify payload: [`../verify-prompt.md`](../verify-prompt.md) with `{issues}` = this group's verifiable findings, plus `{scope_summary}` / `{changes}`.
+
+And the same verify-return handling: validate `verifications.length` against the input count with ids one-to-one (Set difference). Mismatch β†’ spawn a fresh verify agent with the missing ids' findings and the full prompt; do not loosen. Verdicts: `confirmed` β†’ report pool (apply overrides / `same_root_as`); `false_positive` β†’ drop; `need_more_context` β†’ "Needs your input" appendix. The main agent never re-verifies findings itself.
+
+### Lane A β€” a close verb exists (pipelined)
-## Step 3 β€” Collect, close, verify (pipelined)
+Slots are held until closed, so closing promptly is what buys the pipelining.
-Loop `wait` until all review agents have returned β€” the initial wave plus a late-spawned `extras` (wait is wait-any β€” call it repeatedly). For **each** returned review agent, immediately:
+Keep **two explicit queues** for the whole lane: `pendingSpawn` (a queued `extras` group, if any) and `pendingVerify` (verify payloads waiting for a slot). Once the wave is running, nothing is spawned except by taking from a queue β€” "spawn it in the next available slot" is not a step you can leave implicit, because the work item has to survive in writing until a slot actually exists.
-1. `close_agent` it β€” frees a slot. **Dispatch priority for the freed slot**: a still-queued `extras` group spawns first and joins the review wait set; only then does the slot go to a verifier.
-2. Extract the ` ```json ` fence and parse. Parse failure / wrong schema β†’ reject, re-spawn that group with the same prompt.
-3. Partition its findings by dimension `verify` flag: `verify: false` dimensions (workflow, skill-freshness) go straight to the report pool; zero verifiable findings β†’ done with this group.
-4. Otherwise spawn that group's verify agent in the next slot the dispatch priority allows (do not wait for other groups): [`../verify-prompt.md`](../verify-prompt.md) with `{issues}` = this group's verifiable findings, plus `{scope_summary}` / `{changes}`.
+1. Spawn the three built-in groups concurrently in one turn (≀ 3 agents β€” fits the default budget). A non-empty `extras` goes into `pendingSpawn`, not into this wave.
+2. Loop `wait` (wait-any β€” call it repeatedly). On each returned **review** agent: close it β†’ `consume(agent)` β†’ append its verify payload, if any, to `pendingVerify` β†’ then **service the freed slot** (below).
+3. On each returned **verify** agent: close it β†’ apply the shared verify-return handling β†’ then service the freed slot.
+4. **Service the freed slot** β€” one item, in this priority: `pendingSpawn` first (an `extras` review joins the review wait set), otherwise the oldest entry in `pendingVerify`. Empty queues β†’ leave the slot idle.
+5. The loop ends only when all three of these hold: every review agent has returned, both queues are empty, and every spawned verifier has returned. **A group whose payload is still in `pendingVerify` has not been verified** β€” its findings stay out of the report pool until its verifier returns. Reaching step 4 of the report with a non-empty queue means findings shipped unverified, which is the one failure this flow exists to prevent.
-On each verify return: `close_agent` first, then validate β€” `verifications.length` equals input count, ids one-to-one (Set difference). Mismatch β†’ spawn a fresh verify agent with the missing ids' findings and the full prompt; do not loosen. Verdicts: `confirmed` β†’ report pool (apply overrides / `same_root_as`); `false_positive` β†’ drop; `need_more_context` β†’ "Needs your input" appendix. The main agent never re-verifies findings itself.
+Slot arithmetic: up to 3 review agents spawn together; every later spawn fills a slot freed by a close, so the flow never exceeds 3 concurrent agents and never deadlocks. When `extras` takes priority over `pendingVerify`, it delays a verifier rather than dropping it β€” that is exactly what the queue is for.
-Slot arithmetic: up to 3 review agents spawn together; every later spawn (queued `extras`, verifiers) fills a slot freed by `close_agent`, so the flow never exceeds 3 concurrent agents and never deadlocks on the default budget. When `extras` claims the first freed slot it delays that one verifier by a single turn β€” acceptable, review coverage is the contract.
+### Lane B β€” no close verb (two plain waves)
+
+Nothing frees a slot on demand, so pipelining is not available. Do not emit close calls; do not reason about freed slots.
+
+1. **Review wave**: spawn review groups up to the concurrency budget and `wait` for all of them. More groups than slots (built-ins + `extras` > 3) β†’ run them as consecutive batches, each batch fully awaited before the next spawns. `extras` is just another group here β€” it takes its turn in batch order rather than racing for a freed slot.
+2. `consume(agent)` for every returned review agent, collecting all verify payloads before spawning any verifier. A re-spawn from step 1 of `consume` **stays inside the review wave**: it becomes an extra batch, awaited and consumed like the rest, and the wave is over only when every group has produced a parsed result. Moving to step 3 with a retry still in flight silently drops that whole group β€” its dimensions vanish from the report with no unverified-dimension section to mark the hole.
+3. **Verify wave**: spawn one verifier per group with a non-empty payload, again batched to the budget, and `wait` for all of them. Then apply the shared verify-return handling.
+
+This costs one barrier's worth of wall-clock versus Lane A and changes nothing about coverage or independence β€” which is the contract. Never drop verification to buy back the time.
## Step 4 β€” Render the report
@@ -67,7 +89,13 @@ Non-empty batch β†’ one `request_user_input` (allowed regardless of delegation p
## Step 6 β€” Walk the remaining decisions
-`can_auto_fix: false` confirmed findings + the `need_more_context` appendix, when non-empty, go through `request_user_input` one finding at a time β€” P0 β†’ P1 β†’ P2, `blocks_release: true` first; offer the finding's `fix_options` as the choices. Apply what the user picks; park the rest. Both lists empty β†’ the report ends the flow.
+`can_auto_fix: false` confirmed findings + the `need_more_context` appendix, when non-empty, go through `request_user_input` one finding at a time β€” P0 β†’ P1 β†’ P2, `blocks_release: true` first; offer the finding's `fix_options` as the choices. Apply what the user picks; park the rest. Both lists empty β†’ skip silently and go to Step 7.
+
+**Only in-scope findings enter this loop.** Everything under `Hand off to owner` is excluded β€” never offer to fix a pre-existing problem here. Low-likelihood non-blocking findings go last, and are skipped entirely on a repeat review unless the user asks.
+
+## Step 7 β€” Offer to file the hand-off issues
+
+Runs whether or not Step 6 asked anything β€” only condition is that `Hand off to owner` is non-empty. One `request_user_input`: `N pre-existing problems belong to other owners β€” create Linear issues for them?` with options `Create all` / `Pick some` / `Not now`. Create nothing before the user answers. On approval, follow the `linear` skill: Chinese content, one issue per finding, description carrying location + culprit commit/author/date + scenario + likelihood + verification evidence, assigned to the culprit author when identified. Report the created issue keys.
## Notes
diff --git a/.agents/skills/deep-review/references/dimensions/observability.md b/.agents/skills/deep-review/references/dimensions/observability.md
index 86f2c1b0e37..3ee589af8cc 100644
--- a/.agents/skills/deep-review/references/dimensions/observability.md
+++ b/.agents/skills/deep-review/references/dimensions/observability.md
@@ -1,15 +1,23 @@
---
id_prefix: obs
verify: true
-skip_when: no error handling, async flow, or server code touched
+skip_when: no error handling, async flow, server code, new user-facing capability, or perf-sensitive path touched
---
# Observability
-When this code misbehaves in production six months from now, can the person debugging it (possibly an agent) see what happened and why the code is the way it is?
+Three questions, one dimension β€” all about what we can see after this ships:
+
+1. **Debug**: when this misbehaves six months from now, can the person debugging it (possibly an agent) see what happened and why the code is the way it is?
+2. **Product**: will we know whether this feature is used, and will the data tell us what to build next?
+3. **Performance**: if this gets slower or more expensive under real traffic, does anything notice?
+
+The bar for 2 and 3 is deliberately narrow β€” most changes need neither. See the qualifying criteria in each section; a generic "should add tracking" suggestion is noise, not a finding.
## Quick checklist
+### Debug
+
- Bug fix without a comment explaining **why** the fix is needed, especially non-obvious workarounds β€” future readers will "simplify" it back into the bug; link the issue/PR when one exists
- Hacky or surprising code without a comment stating the constraint that forces it (and a reference link when the workaround comes from an upstream issue/SO answer)
- `catch` blocks that swallow errors: no log, no rethrow, no user feedback β€” silent failure is the most expensive kind
@@ -17,24 +25,61 @@ When this code misbehaves in production six months from now, can the person debu
- New logging uses the `debug` package with a proper `lobe-*` namespace, not stray `console.*`
- Log lines that would be useless when read cold: no identifiers (which user? which entity?), or dumping whole objects instead of the discriminating fields
+### Product analytics
+
+The test is **not** "did we record that the user did something". It is: **is there a decision waiting on this data?** Instrument where the data closes a loop back into the product; skip where it would only produce a number nobody acts on.
+
+Qualifying shapes β€” flag a missing `analytics?.track()` when the new capability is one of these:
+
+- **User-supplied queries**: search, filters, command palette, any free-text input. The **misses are worth more than the hits** β€” a search that returns nothing is the strongest signal of what the product lacks. Capture the shape of the query, never its text: result count (0 is the event that matters), which filters/scope were active, input length, latency. A proposal that logs the raw query is out of bounds β€” see the PII bullet under "Not violations"; the miss rate answers the question without it
+- **A new entry point or capability**: without adoption data there is no way to tell later whether to invest in it or delete it, and that question always comes up
+- **A multi-step flow**: signup, checkout, onboarding, any wizard. Per-step events are what turn "conversion is bad" into "step 3 is bad"
+- **A decision that was contested or reversible**: when the PR/issue records a disagreement or an explicit "let's try it and see", the event is what settles it later
+- **A fallback or degraded path**: how often the fallback fires decides whether the primary path is worth fixing. An unmeasured fallback becomes permanent silently
+
+Event quality, when one is added: a stable event name, and properties that make it sliceable (which surface, which variant, outcome). An event with no properties is a counter, and counters rarely answer the next question.
+
+### Performance monitoring
+
+Qualifying shapes β€” new or changed code on one of these paths should ship with a way to see its cost:
+
+- **High-frequency interaction**: command palette, search-as-you-type, anything firing per keystroke or per render of a list
+- **High-traffic entry**: home, landing, the first screen after auth. The denominator is enormous, so a small regression multiplies into a large one, and it is the least likely place for anyone to notice by hand
+- **Polling or intervals**: total requests = users Γ— frequency Γ— session length, so this is a cost problem before it is a latency problem β€” and cost is invisible unless request volume is measured somewhere. (Whether the loop itself backs off, stops, and is tunable is `performance`'s call, not yours)
+- **A new network call added to a synchronous or blocking path**, especially a model/LLM call or a third-party API whose latency we do not control
+- **Rendering over unbounded data**: a list or computation whose size grows with real usage
+
+What "a way to see its cost" means concretely: latency at a **percentile, not an average** (averages hide the tail that users actually feel), an error/timeout rate, and for polling, request volume. Backend paths go through the OTEL instrumentation in `packages/observability-otel`; front-end page-level cost is covered by Vercel Speed Insights, so a bespoke timer for a page load is usually redundant β€” say so rather than proposing one.
+
## Rule sources (deep mode: read before reviewing)
- `.agents/skills/debug-package/SKILL.md` β€” namespace conventions, format specifiers
- Repo `CLAUDE.md` / `AGENTS.md` comment rules β€” mandatory comment scenarios (complex logic, trade-offs, reference links)
+- `src/components/Analytics/` β€” the `analytics?.track()` provider and existing event shapes; match the conventions already in use before inventing a new event name
+- `packages/observability-otel/` β€” backend tracing/metrics instrumentation
## How to check
1. `rg "catch" <changed files>` β€” read every catch body added/modified by this diff; classify as logged / rethrown / surfaced / swallowed.
2. For each fix in the diff, look for the explanatory comment in the same hunk; check it explains _why_, not _what_.
3. Walk the main execution path of new server-side flows and count observable checkpoints.
+4. For any new user-facing capability, match it against the qualifying analytics shapes. If one matches, `rg 'analytics\?\.track'` around the feature to see whether it was instrumented; when proposing an event, name the event and the properties, and state the decision the data would inform β€” if you cannot name that decision, do not report it.
+5. For any change on a qualifying performance path, find the interval/frequency/call site and state the arithmetic (per keystroke? per user per minute? Γ— how many users?), then check whether that volume and its latency land anywhere someone could read after ship.
## Violations
- A swallowed error, uncommented hack, or unexplained fix introduced by this diff.
- A new multi-step flow whose failure would be undiagnosable from logs alone.
+- A qualifying new capability shipped with no analytics event, where a named decision depends on that data β€” most sharply, a search/query surface that does not record misses.
+- A new call on a high-traffic or high-frequency path β€” polling included β€” with no way to see its latency or volume after ship.
## Not violations
- Missing logs on trivial pure functions or UI-only handlers with visible outcomes.
- Comment/log density matching equivalent existing flows (calibration principle) β€” except silent catches, which are always findings.
- Intentionally ignored errors that say so (`// ignore: <reason>`).
+- Missing analytics on anything that does not match a qualifying shape: visual/style changes, internal tooling, scripts, agent skills, refactors with no behavior change. "More tracking would be nice" is not a finding.
+- Events that would duplicate what server logs or the database already record β€” the data exists, it just needs querying.
+- Analytics proposals that would capture user content, identifiers beyond the existing convention, or anything PII-shaped. Do not propose those at all; if the diff already does it, that is a `security` finding, not this dimension.
+- A bespoke timer for something Speed Insights or existing OTEL spans already cover.
+- Perf instrumentation demanded for cold paths, admin screens, or one-off scripts.
diff --git a/.agents/skills/deep-review/references/dimensions/performance.md b/.agents/skills/deep-review/references/dimensions/performance.md
index 88339851c01..cca5d703ccf 100644
--- a/.agents/skills/deep-review/references/dimensions/performance.md
+++ b/.agents/skills/deep-review/references/dimensions/performance.md
@@ -8,11 +8,14 @@ skip_when: no server/db/loop/render-path code touched (docs, copy, pure type cha
Will this change be slow, leak, or block β€” at production data volume, not dev-fixture volume? Database migrations are checked here too (both locking behavior and idempotency: the review target is the migration file, so the rules live together).
+Scope boundary: migration **cost** (lock level, duration, re-runnability) is yours; migration **reversibility** (destructive DDL, data loss, rollback and deploy ordering) belongs to `release-risk`. Review the same file from your angle only and do not restate theirs. Likewise for polling: whether the loop is _well-behaved_ (backoff, stop condition, tunable interval) is yours; whether its cost is _visible after ship_ belongs to `observability`.
+
## Quick checklist
- N+1: per-item queries/fetches inside a loop that a join/batch endpoint would collapse
- Blocking calls on hot paths: synchronous fs/crypto in request handlers, un-batched sequential awaits that could be `Promise.all`, blocking work added to startup/entry paths
- Resource leaks: listeners/intervals/subscriptions/AbortControllers created without cleanup (React effects, service singletons)
+- **Polling mechanics**: an added or widened poll/interval needs three things β€” backoff on failure (otherwise an outage turns into a retry storm), a stop condition when the tab is hidden or the data can no longer change, and a frequency that lives in config rather than as a hardcoded literal nobody can raise without a deploy. Total requests = users Γ— frequency Γ— session length; state that arithmetic rather than calling it "frequent"
- Long-lived objects or callbacks built from closures that capture a large enclosing scope β€” the closure retains the whole scope for the object's lifetime; copy the needed fields instead
- Render-path waste: heavy computation in render without memoization, unstable identities re-rendering large lists, missing virtualization for unbounded lists
- Unbounded growth: caches/maps/arrays that only ever grow
@@ -31,11 +34,13 @@ Will this change be slow, leak, or block β€” at production data volume, not dev-
2. For each new query, check whether it runs per-render, per-item, or per-request, and whether an existing batched path exists.
3. For migrations: read the generated SQL (not just the schema diff); classify each DDL statement by lock level and duration on a large table; check every statement for idempotency guards.
4. For React: check dependency arrays and identity stability of props passed into memoized children/lists.
+5. For each poll/interval in the diff, read the hook for a failure branch (does it back off?), a visibility/terminal-state guard (does it ever stop?), and where the frequency is defined.
## Violations
- A concrete path where latency, memory, or lock time grows with data volume introduced or worsened by this diff.
- Migration SQL that blocks reads/writes on a production-sized table or fails on re-run.
+- Polling or an interval with no backoff, no stop condition when hidden or terminal, or a hardcoded frequency.
## Not violations
diff --git a/.agents/skills/deep-review/references/dimensions/release-risk.md b/.agents/skills/deep-review/references/dimensions/release-risk.md
new file mode 100644
index 00000000000..127cce3560c
--- /dev/null
+++ b/.agents/skills/deep-review/references/dimensions/release-risk.md
@@ -0,0 +1,201 @@
+---
+id_prefix: risk
+verify: true
+skip_when: diff touches no DB schema/migration, no schemaless persisted payload, no queue/workflow payload or cron schedule, no config or env dependency, no outbound sender, no prompt/tool-description text, no shared component or package public API, no high-frequency user surface, and carries a single obvious purpose
+---
+
+# Release Risk
+
+The last gate before shipping. Every other dimension asks "is this code correct?" β€” this one asks **"if we merge and deploy this today and it turns out wrong, how bad is the recovery?"** A change can be flawless and still be a bad thing to ship in one piece.
+
+Seven risk classes, each with its own irreversibility profile:
+
+1. **Persisted state** β€” wrong code can be reverted in minutes; wrong data cannot
+2. **Dev-cycle drift** β€” a requirement that was reworked several times leaves residue in the migration history and in the dev database, and production will not replay that history
+3. **Deploy-moment state** β€” work already in flight, and configuration that must exist before the code runs
+4. **Prompt surface** β€” prompts are production behavior with no type system and no test that fails; a wording change reaches every conversation on the next request
+5. **Rollback granularity** β€” whether undoing this means reverting a whole PR or flipping one switch
+6. **Shared surface and high-frequency UI** β€” a base component, an exported API, or a screen every user touches daily multiplies any defect by its reach
+7. **PR purity** β€” a PR carrying several unrelated sub-requirements can only be reviewed, approved, and rolled back as a single unit, at the risk level of its most dangerous part
+
+Findings here are release decisions, not just defects: alongside `fix_options`, propose the de-risking move (split the PR, ship behind a flag, land the migration in a separate earlier PR, backfill in a separate job, stage the rollout).
+
+## Two output shapes
+
+Much of this dimension's subject matter is **not visible in the diff** β€” the shape of rows already in production, whether an env var is set in each deploy target, what is sitting in the queue right now. Do not force those into findings; asserting facts you cannot read is exactly the hallucination the verify pass exists to catch.
+
+- **Finding** (the normal `issues` entry): you can point at the diff and argue the consequence. Use this whenever the evidence is in the code.
+- **Release check** (the `release_checks` array): an objective pre-deploy confirmation item β€” "this change depends on X; confirm X before deploying". No severity, no verification, straight to the report as a checklist for the human. Use when the answer lives in production state or in a system outside the repo.
+
+A release check is not a downgraded finding. If the code itself is wrong, it is a finding. If the code is fine but shipping it safely depends on something you cannot see, it is a check.
+
+## Quick checklist
+
+**Persisted state**
+
+- New migration SQL, or a schema change that will generate one, is the part of the diff `git revert` cannot undo β€” so it always gets **read**, in full. But reading it is not reporting it: an additive, reversible migration (nullable column, new table, concurrent index) with no ordering hazard produces **no output at all** β€” not a finding, and not a release check either, because there is nothing for a human to confirm. It earns a finding through one of the specific hazards below, or a release check when shipping it safely depends on production state you cannot read (row counts, existing data shape, whether a backfill already ran)
+- Destructive DDL: `DROP COLUMN` / `DROP TABLE` / `RENAME`, narrowing `ALTER COLUMN TYPE`, removing an enum value β€” old data is gone or unreadable once applied
+- Data-mutating statements in a migration (`UPDATE` / `DELETE` over existing rows) with no dry-run count, no backup path, and no way to reconstruct the old values
+- Constraints added to populated tables (`NOT NULL`, `UNIQUE`, `CHECK`, new FK) β€” these fail at deploy time on dirty production data that dev fixtures never contained
+- `ON DELETE CASCADE` on a new FK: a single row deletion now silently removes rows in other tables
+- **Schemaless persisted state changing shape** β€” the highest-miss-rate item here, because there is no DDL and no migration file, so it passes review invisibly. Old records keep the old shape forever and every reader must handle both. Carriers to check:
+ - `jsonb` columns: keys added/renamed inside the column, or a value's type changed
+ - Cache values: a Redis key whose stored payload is a structured object, not a scalar β€” nothing migrates it, and the old shape stays until the TTL expires (or forever, if there is none)
+ - Client-side persistence: `localStorage`, IndexedDB, persisted store state. Worst case of all β€” the data lives on the user's machine, you cannot migrate it, and on desktop you cannot even force the client to update
+ - Blobs in object storage: manifests and config JSON written by an older version
+ Flag any writer-side shape change whose reader does not defend against the legacy shape, and say which carrier it is β€” the recovery options differ per carrier.
+- Rollback asymmetry: after deploy, is reverting the code alone safe while the schema stays migrated? If the new schema breaks the previous code version, say so β€” that is a one-way door
+- Deploy ordering: does the new code require the migration to have run first (or vice versa)? Name the required order
+
+**Dev-cycle drift**
+
+This class only exists because features get reworked. When a requirement went through several design iterations before landing, the branch accumulates two kinds of residue β€” one in the committed migrations, one in the developer's local database β€” and only the first is visible in the diff. Both are worth checking precisely on the PRs that feel most finished.
+
+- **Dev-phase compatibility carried into production migrations.** Production has never seen the intermediate states of an unshipped feature, so a migration that adds a column, a later one that renames it, and a third that drops it are three statements where one belongs. Look for a migration series inside this PR that mutates objects the same PR created: `ADD COLUMN` then `DROP COLUMN`, a table created then renamed, a backfill for rows that only exist on someone's laptop, a `DROP ... IF EXISTS` guarding an object that never shipped. Recommend squashing into the final shape β€” the churn is not free: every extra statement is another lock, another failure point, and a false record of the schema's history
+- **Migrations written to accommodate a dev database, not production.** Defensive clauses whose only purpose is to survive a local database in an unknown state (`IF EXISTS` on an object the migration itself just created, a delete-then-recreate to avoid a local conflict, a data fix-up for a shape only local iterations produced) should not ship. They are dead weight in production and they hide the real precondition
+- **Local-only schema residue.** The counterpart risk: the developer's database still carries tables, columns, or enum values from an earlier version of the plan, so the code runs locally against objects that no committed migration creates. Production starts from the committed migrations only. Two checks β€” does the diff reference any table/column not present in the schema files, and would a clean database reach the same state by replaying the migration folder? What you cannot settle from the repo (what is actually sitting in someone's dev DB, whether the migration was regenerated after the last schema edit) goes to `release_checks` as "verify against a freshly migrated database"
+- **Sequence and ordering damage from rebases.** A long-lived branch that was rebased repeatedly can end up with migration files whose ordering no longer matches the trunk's. The failure appears only when the trunk's migrations run first β€” which is to say, only in production
+
+**Deploy-moment state**
+
+- **In-flight async work**: queued messages and mid-execution workflows were produced by the _old_ code. A changed job/message payload shape, or added/removed/reordered workflow steps, meets messages already in the queue and workflows resuming from a step index that no longer means the same thing. `git revert` cannot recall a message already in flight β€” check that the consumer accepts the old payload for at least one deploy cycle, or that the change is drain-and-deploy
+- **Scheduled jobs**: a cron whose schedule, idempotency assumptions, or scope changed β€” the next tick fires with production-scale data, not fixtures
+- **New configuration dependency**: an env var, secret, feature flag, or third-party setting the new code reads. It is invisible in the diff by definition, and an unset value in one deploy target means a 5xx on boot. Check every target this repo deploys to, not just the one you're thinking of, and check the failure mode: does it crash loudly at startup, or fail silently at the first request?
+- **Irreversible outbound side effects**: emails, push notifications, payment calls, third-party webhooks. Once sent, nothing recalls them. The dangerous shape is not the obvious "send email" endpoint β€” it is a backfill, migration, or bulk operation that _incidentally_ triggers a notification path for every touched row. Trace whether the new write path fans out to any outbound sender
+
+**Prompt surface**
+
+A prompt edit is a one-line diff that changes the product's behavior for every user, and it is the change class with the **weakest safety net in the entire repo**: no type checks it, no unit test fails on it, and code review reads it as prose rather than as the control logic it actually is. Treat any diff touching a system role, tool description, parameter description, or context-assembly template as a behavior change of the same weight as editing a core function β€” a reviewer nodding at "the wording reads better" is not review.
+
+Where they live: `packages/prompts/src/prompts/**` (systemRole, tools, planning, memory, and the rest), each builtin tool's `manifest.ts` + `systemRole.ts` under `packages/builtin-tool-*/`, and the assembly/injection order in `packages/context-engine/`.
+
+- **Tool and parameter descriptions are the model's only API documentation.** They decide _whether_ the model calls a tool, _when_, and \*with what arguments. Rewording a description to be clearer to a human can make a tool fire more or less often β€” the effect is statistical, invisible in the diff, and surfaces as "the agent got worse" days later with nobody linking it to this PR. Say which tool's selection rate the change can move, and in which direction
+- **Removing or narrowing an instruction is riskier than adding one.** A sentence in a system prompt is usually there because something went wrong once. Deleting it as "redundant" re-opens whatever it was patching, and the commit that added it is the only record of why. Check `git log -S` on the removed sentence before accepting a deletion as harmless
+- **Constraints and safety wording** (what the model must refuse, must not fabricate, must not expose) are enforcement, not tone. A weakened constraint is a `security` finding; the release angle is that it reaches production instantly with no gate
+- **Assembly-order and injection-point changes** (where a fragment lands relative to tools, history, and user input) change behavior even when no word changes. A moved block is a real change, not a refactor
+- **Persisted copies of prompts.** A default system role that was copied into user-owned records at creation time does not update when the default changes β€” existing agents keep the old text forever. Decide which is intended and say so; if the change is meant to reach existing records, that is a backfill, i.e. the Persisted-state class
+- **Cost and cache.** Prompt text is paid on every request by every user, and prefix changes invalidate prompt caching. A longer system prompt is a spend change with no code path to point at β€” the arithmetic belongs to `observability`, but flag here that it ships with no gradual rollout
+- **Validation.** A prompt change cannot be verified by reading it. What would show a regression β€” an eval run, a before/after transcript on a real case, a staged rollout? If the PR has none of the three, that is the finding. This is also the change class where a flag is most useful and most often skipped, because it looks like a text edit
+
+**Rollback granularity (feature flags)**
+
+The question is not "is a flag nice to have" β€” it is **what does undoing this cost, and can that cost be lowered**. Reverting a PR means a revert commit, a rebuild, a redeploy, and it takes everything else in that PR with it. Turning a flag off is seconds and surgical, and this repo can flip flags at runtime through edge config without a deploy at all (`packages/app-config/src/featureFlags/`, `packages/edge-config/`).
+
+Recommend gating when **all** of these hold:
+
+- The change alters a user-visible main path, and its bad outcome is "works, but wrong" rather than "crashes" β€” crashes get caught by monitoring, silent wrongness does not
+- It cannot be fully validated before shipping: it depends on production data volume, real traffic patterns, or a third-party system
+- Undoing it by revert is disproportionately expensive β€” the PR carries other work, or the revert would have to drag a migration with it
+
+Also recommend one when the rollout should be staged (small cohort first, watch a metric, then widen) β€” that is a capability a revert cannot give you at all.
+
+Do **not** recommend a flag when:
+
+- It is a plain bug fix. Gating a fix keeps the buggy path alive and doubles the states to reason about
+- The change is internal-only: scripts, dev tooling, agent skills, anything with no user-facing surface
+- A migration is the risky part. **A flag does not gate a schema change** β€” the DDL either ran or it did not. Gating the _reader_ while the schema already changed is a false sense of safety; say so instead of proposing a flag
+- An equivalent switch already exists β€” check before adding a second one for the same surface
+- The flag plumbing would be more complex or longer-lived than the change it guards. Every flag is a branch someone must delete later; a flag with no removal condition is technical debt with a straight face
+
+When you do recommend one, state the removal condition in the same breath: what observation makes it safe to delete the flag and the old path.
+
+**Shared surface and high-frequency UI**
+
+Two different multipliers, same class. A base component's reach is its call-site count; a high-frequency screen's reach is the number of users who hit it every day. The second one has no import graph to measure it, which is why it gets skipped.
+
+High-frequency surfaces β€” the entry screen after auth, the main chat/work surface, the global navigation and sidebar, the command palette, the composer/input, anything on the path a user walks within seconds of opening the product:
+
+- A defect here has no soak period. It is not "some users eventually"; it is everyone, within minutes of deploy, on the flow they use most
+- Interaction changes on these surfaces cost more than their code suggests. Moved or removed controls, changed keyboard/shortcut behavior, a new confirmation step, an altered default, a changed submit/Enter semantic β€” users have muscle memory here, and "it still works, it just moved" is a support and trust cost that no revert undoes for people who already hit it
+- The failure mode is usually _not_ a crash: layout that breaks at one viewport, a state that no longer restores, an action that silently does nothing. Monitoring does not catch these; users do
+- This is the strongest case in the whole dimension for staged rollout or a flag, because it is the change whose bad outcome arrives fastest and reaches furthest
+- Judge the _reach and reversibility_, not the design. Whether the new interaction is better belongs to `ux`; whether shipping it all at once is wise belongs here
+
+Shared surfaces β€” measured by call sites:
+
+- Files under `src/components/`, anything exported from a `packages/*` public entry, shared hooks/utils/contexts, and design-system wrappers β€” treat these as base surfaces regardless of how small the diff is
+- Behavior change to an existing prop: new default value, changed fallback, altered event timing. Every existing call site silently inherits it without appearing in the diff
+- Signature change: new required prop, renamed prop, narrowed type β€” breaks call sites; check whether all of them were updated, including `.desktop`/`.mobile` variants and other packages
+- Cost added inside a base component (a new hook, effect, context subscription, observer, or per-render computation) β€” it is paid once per call site per render, so a "small" addition multiplies
+- Extensibility regression: a variant hardcoded with an `if`/switch on a specific caller, or logic that belongs to one consumer pushed down into the shared component β€” the next variant can only be another branch
+- Visual/interaction regression radius: a style or layout change in a base component reaches surfaces nobody listed in the PR description
+
+**PR purity**
+
+- Count the independent sub-requirements in the diff (group by domain/feature, not by file count). Two or more that could each stand alone is the signal to look closer
+- Recommend a split when: a sub-requirement is large or high-risk on its own, **and** it has no compile-time or runtime dependency on the rest of the diff
+- Mixed risk levels in one PR: a DB migration or base-component change riding along with copy tweaks or unrelated refactors. The whole PR now inherits the highest risk level for review, approval, and rollback
+- Drive-by refactors, formatting sweeps, or dependency bumps that bury the actual change β€” reviewers cannot separate intent from noise, and a rollback takes the unrelated work with it
+- A PR whose description lists one goal but whose diff implements several
+
+## Rule sources (deep mode: read before reviewing)
+
+- `.agents/skills/db-migrations/SKILL.md` β€” rollout strategy, online index creation, backfills, what makes a migration safe
+- `.agents/skills/drizzle/SKILL.md` β€” schema conventions, what generates a migration
+- `.agents/skills/upstash-workflow/SKILL.md` β€” workflow/queue semantics, what a step change means for runs already in progress
+- `.agents/skills/pr/SKILL.md` β€” stacked-PR workflow and layer ordering; the concrete mechanics for any split you recommend
+- `.agents/skills/react/SKILL.md` β€” component layering, which surfaces count as shared
+- `.agents/skills/builtin-tool/SKILL.md` β€” manifest/description conventions, how a tool's text reaches the model
+- `.agents/skills/agent-tracing/SKILL.md` β€” pulling real transcripts, the only way to show a prompt change's before/after
+
+## How to check
+
+1. **Persisted state**: list every migration file and schema change in the diff. For each statement, ask three questions β€” does it destroy or rewrite existing data; does it fail on production data that fixtures lack; can the previous code version still run against the new schema? Then find the schemaless writes: grep the diff for `jsonb` column writes, cache `set` calls with object payloads, and client-persistence writes, and compare each written shape against what its reader accepts.
+2. **Dev-cycle drift**: read the PR's migration files **in order as a series**, not one at a time, and ask what a clean database ends up with β€” any object created and then altered/renamed/dropped within the same PR is churn to squash. Then cross-check the schema files against the code: every table/column the diff reads or writes must be created by a committed migration, not assumed to exist. If the PR history shows several rounds of rework, add a `release_checks` item to replay the migrations on a fresh database before deploying.
+3. **Deploy-moment state**: grep the diff for changed job/message payload types and workflow step definitions; for each, ask what happens to an item enqueued five minutes before deploy. Then collect every config value the new code reads (`process.env`, env schema files, flag lookups) and check whether the diff also adds it to the example/schema files β€” an env var read but never declared is a release check at minimum. Finally, trace new bulk write paths for outbound senders (mail, notification, payment, webhook).
+4. **Prompt surface**: read every changed prompt string as a **behavior diff**, not as copy β€” for each edit, say what the model did before and what it will do now. Removed or weakened sentences get `git log -S '<removed phrase>'` to recover why they were added. For a tool/parameter description, name the tool and the direction of the selection-rate change. Then check the PR for any evidence of validation (eval, transcript, staged rollout); none of the three on a user-facing prompt is itself the finding.
+5. **Rollback granularity**: for the riskiest change in the diff, write the actual undo procedure in one sentence. If that sentence is "revert the PR and redeploy" and the change is user-visible and unvalidatable, ask whether a flag is warranted against the criteria above β€” and check whether one already exists for that surface before proposing a new one.
+6. **Shared surface**: for each touched file that qualifies as a base surface, count its call sites (`rg -l "from '.*<Component>'"` or the package's import graph) and state the number in the finding β€” blast radius is the evidence. Then diff the props/behavior contract, not just the implementation.
+7. **High-frequency UI**: for each changed user-facing surface, place it on the user's path β€” how soon after opening the product is it reached, and can the flow be completed without it? For anything on the first-minute path, state what a user with existing habits experiences on the first load after deploy, and whether that experience is recoverable without a redeploy.
+8. **PR purity**: cluster the changed files by domain and name each cluster's sub-requirement in one phrase. For any cluster you propose splitting out, prove independence by checking that nothing outside it imports what it adds β€” an unprovable split is not a finding.
+9. For every finding, state the recovery cost explicitly: what it takes to undo this after it reaches production.
+10. Whatever you could not settle from the repo alone β€” production data shape, whether a config value is set per target, current queue depth β€” goes to `release_checks`, phrased as something a human can confirm in one action. Never guess it into a finding.
+
+## Severity and likelihood calibration
+
+This dimension is the easiest one to turn into a rubber stamp that blocks every PR touching the database. Hold the line:
+
+- **p0** β€” genuinely unrecoverable: destructive DDL with no backup or reconstruction path, a migration that will fail against real production data, or a schema change that breaks the currently deployed code with no compatibility window. "Cannot be undone after deploy" is the bar, not "involves SQL".
+- **p1** β€” recoverable but expensive: a reader that will throw on legacy-shaped records, a consumer that rejects payloads already in the queue, a base-surface contract change with call sites left unupdated, an independently shippable large sub-requirement bundled in, a first-minute-path interaction change shipped all-at-once with no gate, a prompt edit that removes an existing constraint or moves a tool's selection behavior with nothing validating it.
+- **p2** β€” advisory: split suggestions for smaller sub-requirements, mixed risk levels, missing rollback notes on an otherwise safe change, migration churn to squash.
+
+Purity findings cap at p1 and are normally `blocks_release: false` β€” a split is a process improvement, not a shipping blocker, unless the bundled part is itself a p0 risk.
+
+Prompt findings sit at p1 by default. p0 only when the edit removes a safety/refusal constraint or breaks a contract another system parses (a tool schema, a structured-output format) β€” "the model may behave differently" is p1 at most, because it is recoverable by a redeploy even though the outputs it already produced are not.
+
+`likelihood` here means **how likely the risk materializes**, not how often the code runs. A migration executes exactly once with certainty, but whether it damages anything depends on the production data: `high` when the hazard depends on data that certainly exists (any populated table), `medium` when it depends on data shapes we plausibly have, `low` when it needs a state the product has probably never produced.
+
+## Violations
+
+- An irreversible or hard-to-reverse data change shipped without a stated rollback/backfill plan or deploy ordering.
+- A schemaless shape change (jsonb, cache payload, client persistence, stored blob) whose readers do not handle records written before it.
+- A payload or workflow-step change that breaks items already enqueued or mid-run at deploy time.
+- A bulk write path that fans out to an outbound sender with no guard on volume or recipient set.
+- A migration series inside this PR that ships the development iteration itself β€” an object created then renamed or dropped by a later migration in the same PR, or a defensive clause that exists only to survive a local database.
+- Code that reads or writes a table/column no committed migration creates.
+- A prompt edit that deletes or weakens an existing instruction without recovering why it was added, or that changes a tool/parameter description in a way that moves when the model calls it β€” shipped with no eval, no before/after transcript, and no staged rollout.
+- A prompt or assembly-order change presented as a wording cleanup or refactor when it changes what the model does.
+- A default prompt change that is meant to reach existing user-owned records but has no backfill, or that silently does reach them when it should not.
+- A base-surface change whose blast radius (named call-site count) exceeds what the PR description and tests account for.
+- A change to a first-minute user path (entry screen, main work surface, navigation, composer, command palette) that alters an established interaction and ships ungated, where the failure mode is silent rather than a crash.
+- A PR bundling an independently shippable, large-or-risky sub-requirement that has no dependency on the rest.
+- An unvalidatable, user-visible main-path change shipped with revert as its only undo, where a flag would have made the undo surgical.
+
+## Not violations
+
+- Additive, reversible schema changes that ship with the code that uses them: a nullable column, a new table, a new index created concurrently. Adding a column is not a finding merely because it touches the database.
+- Lock duration, migration idempotency, and query cost β€” those belong to the `performance` dimension. Report the data-safety and reversibility angle here and do not restate the locking analysis.
+- A new env var that the diff also declares in the env schema and example files, with a sane default or a loud startup failure β€” that is a release check at most, not a finding.
+- Cache payload changes on a key with a short TTL where the reader tolerates a miss: the old shape drains on its own. Say so instead of reporting it.
+- A missing feature flag on a change that is small, verifiable before shipping, or cheap to revert. "Could be flagged" is not a finding β€” only "revert is the only undo and revert is expensive" is.
+- Genuinely non-behavioral prompt edits: a typo, a broken template variable, formatting, or a translation of text the model never reads differently. Not every string in a prompt file is a prompt.
+- Prompt changes that are themselves the requirement, where the PR states the intended behavior change. Review the rollout (validation, reach, what already-produced outputs look like), not whether the new instruction is the right one β€” that is a product decision.
+- Whether the new wording is well written, better structured, or more token-efficient β€” that is `code-style` and `observability`. This dimension asks only what happens to users on the next request and how it is taken back.
+- Multiple migrations in one PR that each do a distinct, forward-only thing β€” a series is only churn when a later statement undoes or reworks what an earlier one in the _same PR_ created.
+- Idempotency guards (`IF NOT EXISTS` / `IF EXISTS`) on objects the migration did not create β€” those are the repo's convention and belong to `performance`'s idempotency rule, not here. Only guards protecting against a state that exists solely on a developer's machine are a finding.
+- Whether a UI change is a good design, whether the new copy reads well, whether the interaction is discoverable β€” that is `ux`. This dimension judges only how far and how fast a bad outcome would spread, and what it costs to pull back.
+- A high-frequency surface touched in a purely additive or internal way: a new optional element, a refactor with no interaction change, a style fix. Reach alone is not a finding; a changed established behavior on that reach is.
+- Whether a shared abstraction is the _right_ one, or duplicates an existing implementation β€” that is `reuse-architecture`. This dimension only judges the blast radius of changing it.
+- PR description drift and issue/CI state β€” that is `workflow`. Purity is about the diff's internal composition, not its paperwork.
+- A large diff that is large because one requirement genuinely spans many files. Size alone is never a purity finding; independence is the test.
+- Splits that would create a broken intermediate state β€” a stacked PR whose lower layer does not build or deploy on its own is worse than one honest PR.
diff --git a/.agents/skills/deep-review/references/report-template.md b/.agents/skills/deep-review/references/report-template.md
index 4448b5e33b1..b1f8201f3bf 100644
--- a/.agents/skills/deep-review/references/report-template.md
+++ b/.agents/skills/deep-review/references/report-template.md
@@ -7,15 +7,21 @@ Only `verdict: confirmed` findings are rendered (plus unverified dimensions β€”
## Rendering rules
- **Structure is mandatory**: title, header metadata, TL;DR, Findings, Statistics always render β€” even with zero confirmed findings (then Findings states "no confirmed findings" and Statistics still shows the counts).
-- **Nature line**: `nature: "introduced"` β†’ omit the line (default). `nature: "exposed_legacy"` β†’ render `**Nature**: legacy surfaced by this change`.
+- **Two questions decide a finding's fate, and both render**: _did this change introduce it_ (`nature` / `exposure`) and _how likely is it to fire_ (`likelihood`). Severity alone never decides whether something blocks the merge β€” see the scope and de-escalation rules below.
+- **Nature line**: `nature: "introduced"` β†’ omit the line (default). `nature: "exposed_legacy"` β†’ render `**Nature**: legacy surfaced by this change (triggered by this diff)` or `... (bystander find)` per `exposure`.
+- **Likelihood line** renders on every confirmed finding: `**Likelihood**: high | medium | low`. Never omit β€” together with severity it is what tells the user whether a finding is worth another fix round. For `low`, append the precondition chain from `scenario` in parentheses.
+- **Scope rule β€” legacy findings do not get fixed in this PR.** `nature: "exposed_legacy"` findings never render `Fix options` and never appear in `Safe to fix now`; they render under `Hand off to owner` with a Linear issue draft instead (see below). The only exception: `exposure: "triggered"` P0 β€” this diff is what makes the old bug fire, so it renders as a normal finding in the severity buckets **and** blocks merge. Everything else legacy is somebody else's task, and pulling it into this PR is exactly the scope creep this rule exists to prevent.
+- **Low-likelihood de-escalation**: a confirmed finding with `likelihood: "low"` and `blocks_release: false` renders at its verified severity but never enters `Merge verdict` prerequisites β€” it goes to `Follow-ups`. If the user says this is a repeat review of the same PR (second round or later), render `low` + non-blocking findings as one line each under `More P2` regardless of their severity, prefixed `[low likelihood]`. Rationale: after a couple of fix rounds the marginal value of chasing rare edges is below the churn and regression risk it creates; say so in the TL;DR rather than silently dropping them.
- **Issue type** renders the finding's `issue_type` verbatim β€” never the dimension name.
- **Blocks release** renders verify's `blocks_release` (`yes`/`no`) on every confirmed finding β€” this is the user's ship/no-ship signal; never omit. Same-root merged entries take the value belonging to the highest merged severity.
- **Existing implementations** line only for `reuse-architecture` dedup findings, listing all entries.
- **Rule source** line renders the finding's `rule_source` when present.
-- Apply `fix_options_override` / `nature_override` before rendering.
+- Apply `fix_options_override` / `nature_override` / `exposure_override` / `likelihood_override` before rendering.
- **Same-root merge**: findings with `same_root_as: X` fold into X's entry β€” no separate number; add `**Same root**: id (location, issue_type), ...` at the entry's end; entry severity upgrades to the highest among merged; statistics count merged entries once.
-- **P2 cap (noise control)**: if confirmed P2 count > 6, render the top 6 fully and collapse the rest into one line each under `More P2`: `**#n** [issue_type] summary (file:line)`.
+- **P2 cap (noise control)**: if confirmed P2 count > 6, render the top 6 fully and collapse the rest into one line each under `More P2`: `**#n** [issue_type] summary (file:line)`. Rank `low` likelihood last when choosing which 6 to render fully.
+- **Hand off to owner**: every `exposed_legacy` finding except triggered-P0 renders here. Do NOT create the Linear issues β€” render the draft and let the user decide; a deep review can surface several legacy items and auto-filing them is noisy and duplicates existing issues. The culprit comes from verify's `culprit` field (the verifier already had the file open) β€” render it verbatim; `culprit: null` renders "attribution unclear" and no suggested assignee. Do not re-run `git blame` in the render phase.
- Empty severity buckets omit their heading entirely.
+- **Release checks**: the `release_checks` array (release-risk only) renders under `Pre-deploy checklist`, outside the severity buckets and excluded from all finding statistics. These are unverified by design β€” they are questions about production state, not claims about the code. Never merge them into findings, and never let one become a merge-verdict prerequisite; `blocks_deploy: true` items render first and are called out in the verdict's `Basis` line as a deploy-time condition, not a code blocker.
- **Unverified dimensions**: `workflow` findings render under `Process`, `skill-freshness` under `Skill updates` β€” outside the severity buckets, excluded from P0/P1/P2 statistics. These findings use the same JSON schema as everything else; render one line each mapped from those fields: fact = `summary`, evidence = `location` (plus `scenario` when present), suggested action = the first `fix_options` entry. Their `severity` is advisory and never rendered.
- **Missing sources**: if any reviewer returned `missing_sources`, append a note recommending the listed rule files be fixed/restored.
- **Workflow feedback**: merge equivalent suggestions across subagents, accumulate sources (`sources: code-style, verify`), render at the end; omit the section when empty.
@@ -25,16 +31,20 @@ Only `verdict: confirmed` findings are rendered (plus unverified dimensions β€”
First match wins:
-| Condition | Verdict |
-| --------------------------------- | ---------------- |
-| `isDraft: true` | do not merge yet |
-| `mergeable: "CONFLICTING"` | do not merge yet |
-| any check `conclusion: "FAILURE"` | do not merge yet |
-| P0 confirmed > 0 | fix before merge |
-| P1 confirmed > 0 | fix before merge |
-| otherwise (P2 only / clean) | good to merge |
+| Condition | Verdict |
+| ------------------------------------------ | ---------------- |
+| `isDraft: true` | do not merge yet |
+| `mergeable: "CONFLICTING"` | do not merge yet |
+| any check `conclusion: "FAILURE"` | do not merge yet |
+| in-scope P0 confirmed > 0 | fix before merge |
+| in-scope P1 confirmed > 0 | fix before merge |
+| otherwise (P2 only / out-of-scope / clean) | good to merge |
-Severity only β€” nature does not matter (a confirmed exposed-legacy P0 still blocks). Fallbacks: `mergeable: "UNKNOWN"` β†’ treat as mergeable; all checks in progress/queued β†’ CI pending, not blocking; no checks configured β†’ CI pass. "fix before merge" lists all P0/P1 numbers + one-line summaries as prerequisites; "good to merge" lists P2s as follow-ups.
+**In-scope** = `nature: "introduced"`, **or** `nature: "exposed_legacy"` with `exposure: "triggered"` and severity P0. Everything else β€” bystander legacy at any severity, and triggered legacy below P0 β€” is **out of scope for this PR**: it never becomes a prerequisite, it goes to `Hand off to owner`. Rationale: our diff should be judged on what it changed. An old bug we merely walked past does not become our obligation because we happened to review nearby code, and treating it as one is how a focused PR turns into a week of unrelated fixes.
+
+Additional de-escalation: an in-scope finding with `likelihood: "low"` and `blocks_release: false` does not count toward the P0/P1 prerequisite counts either β€” list it under `Follow-ups`.
+
+Fallbacks: `mergeable: "UNKNOWN"` β†’ treat as mergeable; all checks in progress/queued β†’ CI pending, not blocking; no checks configured β†’ CI pass. "fix before merge" lists the in-scope P0/P1 numbers + one-line summaries as prerequisites; "good to merge" lists P2s and de-escalated findings as follow-ups. When the verdict is "good to merge" but `Hand off to owner` is non-empty, say so in one clause β€” it is good to merge _and_ it left N items for other owners.
## Pre-send self-check
@@ -42,7 +52,10 @@ Before sending, confirm every item; fix and re-render if any is missing:
- Title + header metadata (scope / background / execution mode with pruned dimensions)
- TL;DR present; Findings present (or explicit "no confirmed findings"); Statistics present
-- Every confirmed finding has: issue type, location, blocks release, core problem, evidence, fix cost, fix options, needs test
+- Every confirmed finding **rendered in a severity bucket** has: issue type, location, blocks release, **likelihood**, core problem, evidence, fix cost, fix options, needs test. Findings under `Hand off to owner` are checked by the next item instead β€” the scope rule forbids their fix options, so requiring them here would make the two rules unsatisfiable together
+- Every `exposed_legacy` finding is either a triggered P0 in the severity buckets, or an entry under `Hand off to owner` β€” never both, never fixed inline, never in `Safe to fix now`
+- `release_checks` rendered as a checklist under `Pre-deploy checklist`, never counted as findings, never a merge prerequisite
+- No out-of-scope or low-likelihood-non-blocking finding appears in `Merge verdict` prerequisites
- Merge verdict only in PR mode
---
@@ -56,18 +69,18 @@ Before sending, confirm every item; fix and re-render if any is missing:
## TL;DR
-{1-2 sentences: X confirmed (P0 a / P1 b / P2 c, K legacy-surfaced), the single biggest risk, one suggested next action.}
+{1-2 sentences: X confirmed (P0 a / P1 b / P2 c), of which Y must be fixed in this PR and Z handed to other owners; the single biggest risk; one suggested next action. On a repeat review, state how many low-likelihood findings were de-escalated rather than re-litigated.}
-> Only findings related to this change are kept. Findings marked "legacy surfaced by this change" live in old code that this diff triggers or depends on; everything else is newly introduced.
+> Only findings related to this change are kept. Two labels drive the triage: **Nature** says whether this change introduced the problem or merely walked past old code, and **Likelihood** says how often the scenario actually fires. Pre-existing problems are listed under "Hand off to owner" instead of being fixed here β€” that is deliberate scope control, not an oversight.
πŸ“£ {N} workflow feedback item(s) at the end of this report ← only when workflow_feedback is non-empty
## Merge verdict ← PR mode only
**Verdict**: {good to merge | fix before merge | do not merge yet}
-**Basis**: P0 {x} / P1 {y} / P2 {z} confirmed | CI {pass|fail|pending} | draft {yes|no} | mergeable {ok|conflicting}
-**Prerequisites**: #{n} {summary} ← "fix before merge" only
-**Follow-ups**: #{n} {summary} ← "good to merge" with P2s only
+**Basis**: in-scope P0 {x} / P1 {y} / P2 {z} confirmed | CI {pass|fail|pending} | draft {yes|no} | mergeable {ok|conflicting} | out-of-scope handed off {h} | pre-deploy checks {c} ({d} blocking deploy)
+**Prerequisites**: #{n} {summary} ← "fix before merge" only; in-scope, non-de-escalated findings only
+**Follow-ups**: #{n} {summary} ← P2s + low-likelihood de-escalations
---
@@ -80,7 +93,8 @@ Before sending, confirm every item; fix and re-render if any is missing:
- **Issue type**: {issue_type}
- **Location**: `src/api/user.ts:87`
- **Blocks release**: yes
-- **Nature**: legacy surfaced by this change ← exposed_legacy only
+- **Likelihood**: {high | medium | low}{ β€” precondition chain, for low only}
+- **Nature**: legacy surfaced by this change (triggered by this diff) ← exposed_legacy only
- **Existing implementations**: `src/foo.ts:62-138`, ... ← reuse dedup only
- **Rule source**: {rule_source} ← when present
- **Core problem**: {core_problem}
@@ -101,9 +115,32 @@ Before sending, confirm every item; fix and re-render if any is missing:
...
-**More P2** ← only when P2 > 6
+**More P2** ← only when P2 > 6, or on a repeat review for de-escalated low-likelihood findings
- **#{n}** [{issue_type}] {summary} ({file:line})
+- **#{n}** `[low likelihood]` [{issue_type}] {summary} ({file:line}) ← repeat-review de-escalation
+
+---
+
+## 🀝 Hand off to owner ({n}) ← exposed_legacy findings not fixed in this PR, omit when empty
+
+> Pre-existing problems, not introduced by this change. Not fixed here on purpose β€” fixing them would expand this PR's scope. Confirm and I'll file the issues.
+
+- **#{n}** `[{severity}]` `[{likelihood}]` {summary}
+ - **Location**: `file:line`
+ - **Culprit**: `{commit}` (@{author}, {date}) ← verify's `culprit`; "attribution unclear" when null
+ - **Nature**: {triggered by this diff, but below P0 | bystander find}
+ - **Issue draft**: {title} β€” {one-line description + impact}
+ - **Suggested assignee**: @{author} ← omit when attribution is unclear
+
+---
+
+## βœ… Pre-deploy checklist ({n}) ← release_checks, omit when empty
+
+> Not defects β€” things this change depends on that cannot be confirmed from the code. Check them before deploying.
+
+- [ ] **{item}** ← `blocks_deploy: true` items first, marked ⚠️
+ {why}
---
@@ -118,12 +155,13 @@ Before sending, confirm every item; fix and re-render if any is missing:
## Statistics
- Confirmed: {n} ({k} legacy-surfaced) | False positives: {fp} (incl. {os} over-scrutiny) | Need more context: {nc}
-- Must-fix this round: {p0+p1} | Blocks release: {n}
+- Must-fix this round: {in-scope p0+p1} | Blocks release: {n} | Handed off: {h} | Deferred as low-likelihood: {l}
+- Likelihood: high {a} / medium {b} / low {c}
- By dimension: {dimension: count, ...}
## πŸš€ Safe to fix now ({n}) ← omit when empty
-> Single obvious fix, low risk, no product decisions. Can be applied in one batch.
+> Single obvious fix, low risk, no product decisions. Can be applied in one batch. Introduced-by-this-change findings only β€” legacy code is never auto-fixed here.
- **#{n}** `[{issue_type}]` {summary} (`file:line`)
diff --git a/.agents/skills/deep-review/references/review-prompt.md b/.agents/skills/deep-review/references/review-prompt.md
index 174770beea7..34c5d2df66e 100644
--- a/.agents/skills/deep-review/references/review-prompt.md
+++ b/.agents/skills/deep-review/references/review-prompt.md
@@ -46,10 +46,12 @@ Focus over completeness: findings must serve THIS change and its requirement. Do
## Review scope (hard rules)
- Finding locations must land on `+` lines of the diff by default.
-- Legacy code gets two treatments (the `nature` field marks which):
- - **Old problems you merely stumbled on** (unrelated to this change) β†’ do not investigate, do not return; report only if it is an obvious p0-level production bug, marked `nature: "exposed_legacy"` with the scenario noting it is a bystander find.
- - **Legacy problems this diff triggers, exposes, or depends on** β†’ report normally, location pointing at the implicated old code, `nature: "exposed_legacy"`, scenario explaining how this change surfaces it.
- - Everything else (locations on `+` lines) β†’ `nature: "introduced"`.
+- Legacy code gets two treatments (`nature: "exposed_legacy"` for both; the `exposure` field marks which):
+ - **Legacy problems this diff triggers, exposes, or depends on** β†’ report normally, location pointing at the implicated old code, `exposure: "triggered"`, scenario explaining how this change surfaces it. Test: without this diff the problem was unreachable, inert, or harmless; with it, it can now fire.
+ - **Old problems you merely stumbled on** (unrelated to this change) β†’ do not investigate, do not return; report only if it is an obvious p0-level production bug, `exposure: "bystander"`, with the scenario noting it is a bystander find.
+ - Everything else (locations on `+` lines) β†’ `nature: "introduced"`, omit `exposure`.
+
+This distinction is not cosmetic: it decides whether the finding blocks this PR or gets handed to the code's owner as a separate task. Do not label a bystander find `triggered` to make it sound more urgent β€” an inflated `exposure` drags an unrelated fix into this PR and blows up its scope.
## Effort budget
@@ -71,11 +73,13 @@ Output exactly ONE JSON object inside a ```` ```json ```` fence (the main agent
"dimension": "logic", // required; one of your assigned dimension ids
"issue_type": "edge case", // required; a precise short phrase (2-5 words), NOT the dimension name β€” e.g. "missing auth scope", "N+1 query", "stale comment"
"nature": "introduced", // required; introduced | exposed_legacy
+ "exposure": "triggered", // required when nature=exposed_legacy; triggered | bystander. Omit for introduced
"severity": "p1", // required; p0 | p1 | p2 (definitions below)
+ "likelihood": "medium", // required; high | medium | low (definitions below) β€” how often the scenario actually fires in production
"location": "src/api/user.ts:87", // required; exact file:line
"summary": "1-2 technical sentences for a reviewer who reads code", // required
"core_problem": "≀ 2 plain-language sentences: impact + cause, understandable without reading code", // required
- "scenario": "concrete trigger scenario", // optional; required when nature=exposed_legacy
+ "scenario": "concrete trigger scenario", // optional; required when nature=exposed_legacy or likelihood=low
"existing_implementations": ["src/foo.ts:62-138"], // required (β‰₯ 1 entry) only for dimension=reuse-architecture dedup findings; omit otherwise
"rule_source": "dimensions/code-style.md β†’ antd import rule", // required for style/convention findings: which rule this violates; omit for logic bugs proven by evidence
"fix_cost": "low", // required; low | medium | high
@@ -83,16 +87,42 @@ Output exactly ONE JSON object inside a ```` ```json ```` fence (the main agent
"need_test": true // required; does the fix need an accompanying test
}
],
+ "release_checks": [ // optional; ONLY the release-risk dimension emits these; omit entirely when empty
+ {
+ "item": "confirm S3_ENDPOINT is set in every deploy target", // one action a human can take before deploying
+ "why": "src/server/upload.ts:14 reads it and throws on boot when unset; the diff does not add it to the env example",
+ "blocks_deploy": true // true when deploying without confirming risks a production failure
+ }
+ ],
"workflow_feedback": [ // optional; omit entirely when empty
{ "suggestion": "concrete, actionable improvement to a named skill file/section", "why": "what happened this run" }
]
}
+### release_checks
+
+A pre-deploy confirmation item, not a defect. Use it when the code is fine but shipping it safely depends on something you cannot read from the repo β€” production data shape, whether a config value is set per environment, what is currently in a queue. These skip verification and go straight to the report as a checklist.
+
+Do not use it as a place to park weak findings. If the problem is in the code, it is an `issues` entry with evidence. If you would have to guess at production state to call it a bug, it is a check. Only the `release-risk` dimension emits these; other dimensions omit the field.
+
### severity definitions
-- p0: likely production incident (data corruption / financial loss / auth bypass / outage) or directly violates the stated requirement and acceptance criteria
+
+Severity is **impact only** β€” how bad it is when it fires. How often it fires is `likelihood`, scored separately below; never let a rare trigger pull the severity down.
+
+- p0: when it fires it is a production incident (data corruption / financial loss / auth bypass / outage), or it directly violates the stated requirement and acceptance criteria
- p1: a real bug that should be fixed in this change
- p2: real but deferrable; bookkeeping level
+### likelihood definitions
+
+Severity answers "how bad if it happens"; `likelihood` answers "how often does it happen". They are independent β€” a data-corruption bug reachable only through a manually crafted request is `p0` + `low`. Judge the real production path, not the theoretical one: who can reach this code, do they need special state or timing, and does anything upstream normally prevent it.
+
+- `high`: fires on a normal user path or a routine call β€” no special setup, most users or requests hit it
+- `medium`: needs a specific but realistic combination (a less-common option, a particular data shape, a retry, a concurrent request that actually happens in this system)
+- `low`: needs a rare edge β€” a hand-crafted input, a state the product can't currently produce, a race that requires improbable timing, an environment we don't ship, or a failure of something already guaranteed upstream
+
+When you say `low`, the `scenario` field must spell out the exact chain of preconditions. If you cannot write that chain concretely, you are guessing at the trigger β€” either downgrade the finding or say so in the scenario. Never inflate `likelihood` to protect a finding from being deprioritized; an honest `low` on a real bug is a good outcome.
+
### core_problem style
One breath: "Because γ€ˆwhat the code/design lacks〉, when γ€ˆuser or caller does X〉, γ€ˆconsequence〉." Split into two sentences (impact + cause) only when gluing them reads unnaturally. Plain over precise; keep API names and error strings in `summary`.
@@ -112,6 +142,7 @@ Return `{"issues": []}`. No silence, no pleasantries.
"issue_type": "edge case",
"nature": "introduced",
"severity": "p1",
+ "likelihood": "high",
"location": "src/api/user.ts:87",
"summary": "Batch delete endpoint doesn't validate userIds length; an empty array builds `DELETE FROM users WHERE id IN ()` which is a SQL syntax error.",
"core_problem": "Because input validation misses the empty-array branch, a UI that submits an empty selection gets a 500 and looks like a server outage.",
diff --git a/.agents/skills/deep-review/references/scoping.md b/.agents/skills/deep-review/references/scoping.md
index 13f51ff3f41..c5c20141160 100644
--- a/.agents/skills/deep-review/references/scoping.md
+++ b/.agents/skills/deep-review/references/scoping.md
@@ -5,22 +5,30 @@ Determine what to review, produce the scope summary, and decide whether to inlin
## 1. Probe size with stat-level commands first
- PR: `gh pr view <num> --json title,body,files,baseRefName,headRefName`
-- Branch: `git diff <local-default-branch>...HEAD --stat`
+- Branch: `git diff <base>...HEAD --stat`
- Uncommitted: `git diff HEAD --stat` + `git status --short`
### Range hard rules (do not review other people's commits)
-`<local-default-branch>` is always the **local** ref (`main` / `canary` / ...), never `origin/<default>`. When local default lags the remote, `origin/main..HEAD` injects other people's freshly merged commits into the diff as reverse changes. Local ref + **three-dot** diff (`<local-default>...HEAD`) diffs from the merge-base, yielding exactly what this branch introduced.
+**`git diff` is always three-dot** (`<base>...HEAD`), never two-dot. Two-dot `diff` against a base that has moved (`origin/main..HEAD`) injects other people's freshly merged commits as reverse changes. Three-dot diffs from the merge-base, yielding what this branch introduced. (`git log` is the opposite β€” see the sanity check below.)
-No local default ref (detached HEAD, fresh clone)? `git fetch && git switch <default> && git switch -` to materialize one, or ask the user which base to use. Never fall back to `origin/<default>`.
+Three-dot alone is not enough β€” the **base ref must not lag the branch's real fork point**. If the branch was rebased onto a newer remote default while the local default still points at an older commit, that local ref is now an ancestor of HEAD, so `<local-default>...HEAD` has its merge-base at the stale commit and hands you every upstream commit the rebase pulled in. Pick the base in this order:
+
+1. **PR mode** β†’ the PR's `baseRefName` at its merge-base; `gh pr diff <num>` already scopes correctly, prefer it over any hand-built range.
+2. **`git fetch` first, then `origin/<default>...HEAD`** β€” the fetched remote ref is the one that cannot lag, and three-dot makes it safe in both cases (rebased branch β†’ merge-base is the rebase base; never-rebased branch β†’ merge-base is the original fork point).
+3. **Local `<default>...HEAD`** only after confirming local is not behind (`git rev-list --count <local-default>..origin/<default>` is 0, or there is no remote).
+
+Sanity-check whichever you pick before reviewing: `git log --oneline <base>..HEAD` β€” **two** dots β€” must list only this branch's commits. Someone else's commit in that list means the base is wrong; fix the base, do not review around it.
+
+Note the asymmetry, it is the easiest mistake here: `log` wants **two** dots where `diff` wants **three**. `git log <base>..HEAD` and `git diff <base>...HEAD` describe the same set of commits (merge-base β†’ HEAD). `git log <base>...HEAD` is a symmetric difference and additionally lists everything the base gained after the fork β€” run that one and a perfectly correct base looks broken.
## 2. Pick the full-diff command by review target
1. **User named a PR by URL** β†’ `gh pr diff <num>`. Also fetch `gh pr view <num> --json mergeable,isDraft,reviewDecision,statusCheckRollup` and append those fields to the scope summary (feeds the merge-verdict table). URL only β€” bare `#123` does not trigger PR mode.
2. **User named a specific commit or range** (a SHA, `abc123..def456`) β†’ review exactly that object: `git show <sha> --stat` then `git show <sha>` for a single commit, `git diff <a>..<b>` for a range. The named object IS the scope β€” ignore branch/worktree state and do not fall through to the rules below.
-3. **Non-default branch AND uncommitted changes both exist** β†’ ask the user which to review: uncommitted only (`git diff HEAD` + untracked files read separately), committed branch work (`git diff <local-default>...HEAD`), or both (`git diff $(git merge-base <local-default> HEAD)` β€” worktree against the merge-base; the plain one-commit form `git diff <local-default>` would re-import default-branch advances as reverse diffs). Gitlink-only entries (`M <submodule>` where `git status` shows `(new commits)` and nothing else changed) do NOT count as uncommitted changes β€” a superproject tracking an in-flight submodule branch shows this permanently; route them through Β§4 instead of triggering this question.
+3. **Non-default branch AND uncommitted changes both exist** β†’ ask the user which to review: uncommitted only (`git diff HEAD` + untracked files read separately), committed branch work (`git diff <base>...HEAD`), or both (`git diff $(git merge-base <base> HEAD)` β€” worktree against the merge-base; the plain one-commit form `git diff <base>` would re-import default-branch advances as reverse diffs). Gitlink-only entries (`M <submodule>` where `git status` shows `(new commits)` and nothing else changed) do NOT count as uncommitted changes β€” a superproject tracking an in-flight submodule branch shows this permanently; route them through Β§4 instead of triggering this question.
4. **Uncommitted changes on the default branch** β†’ `git diff HEAD`; list untracked via `git ls-files --others --exclude-standard` (Β§3 defines how their contents join `{changes}` β€” `git diff HEAD` alone misses them entirely).
-5. **Clean tree on a non-default branch** β†’ `git diff <local-default>...HEAD`
+5. **Clean tree on a non-default branch** β†’ `git diff <base>...HEAD`
6. None of the above β†’ ask; don't guess.
## 3. Exclude bulk files before judging size
@@ -28,7 +36,7 @@ No local default ref (detached HEAD, fresh clone)? `git fetch && git switch <def
Filter lockfiles (`pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`, `bun.lockb`, ...), snapshots (`*.snap`), generated files (`*.generated.*`, `*.gen.ts`), and build output (`dist/`, `build/`, `.next/`) from both stat and full-diff commands:
```bash
-git diff main...HEAD --stat -- . \
+git diff "$BASE"...HEAD --stat -- . \
':(exclude)pnpm-lock.yaml' ':(exclude)*.snap' ':(exclude)dist/**'
```
@@ -46,7 +54,7 @@ Excluded files are out of scope; reviewing a lockfile on request is a separate t
One change often spans the main repo and submodules β€” review them together by default.
-1. Detect from the same command Β§2 selected β€” append `--submodule=log` to it (`git diff <local-default>...HEAD --submodule=log`, `git show <sha> --submodule=log`, `git diff <a>..<b> --submodule=log`, ...). `git status` showing `modified: <path> (new commits)` is an extra signal only when the scope includes the worktree (Β§2 rules 3–4); for a named commit/range the gitlink pair comes from that object, never from current branch/worktree state.
+1. Detect from the same command Β§2 selected β€” append `--submodule=log` to it (`git diff <base>...HEAD --submodule=log`, `git show <sha> --submodule=log`, `git diff <a>..<b> --submodule=log`, ...). `git status` showing `modified: <path> (new commits)` is an extra signal only when the scope includes the worktree (Β§2 rules 3–4); for a named commit/range the gitlink pair comes from that object, never from current branch/worktree state.
2. Changed submodules join the review: the old/new gitlink pair from that output yields the submodule diff command (`git -C <path> diff <old>..<new>`), which merges into `{changes}` alongside the main-repo command; sizes add up for the small/large judgment.
3. Prefix finding locations with the submodule path (`lobehub/src/x.ts:42`).
4. Note "main repo + submodule: <names>" in the scope summary. Skip a submodule only when the user explicitly says so.
@@ -56,7 +64,7 @@ One change often spans the main repo and submodules β€” review them together by
1. **Conversation context** β€” deep mode usually runs right after implementation; the requirement is already here.
2. An issue the user referenced (issue tracker MCP / `gh issue view`).
3. The branch's PR: `gh pr list --head $(git branch --show-current)` β†’ `gh pr view <num> --json title,body`.
-4. Fallback: `git log <local-default>..HEAD --oneline` (commit messages are thin; last resort).
+4. Fallback: `git log <base>..HEAD --oneline` (commit messages are thin; last resort).
## 6. Produce the scope summary
diff --git a/.agents/skills/deep-review/references/verify-prompt.md b/.agents/skills/deep-review/references/verify-prompt.md
index b4b55f7a4e2..9209093e650 100644
--- a/.agents/skills/deep-review/references/verify-prompt.md
+++ b/.agents/skills/deep-review/references/verify-prompt.md
@@ -31,9 +31,19 @@ Diff text or fetch command(s) β€” check the head, run commands yourself if neede
1. Open the finding's `location` file and read β‰₯ 30 lines of context on each side.
2. Chase the relevant call chain, type definitions, and existing tests.
3. Check whether the described scenario actually triggers.
-4. Validate the `nature` field against the actual location: `+` line β†’ should be `introduced`; context/old line β†’ should be `exposed_legacy` AND genuinely triggered/exposed/depended on by this diff (if merely a bystander find, keep only obvious p0s, otherwise `false_positive`). Fix mislabels with `nature_override`.
-5. **Over-scrutiny filter** (skip for findings from dimension files marked `calibration_exempt: true`): if the finding holds the diff to a standard the surrounding codebase itself does not meet β€” the flagged pattern is widespread in equivalent existing code and this diff does not make it worse β€” verdict `false_positive` with reason starting `over-scrutiny:`. Same verdict for lifespan mismatch: the finding demands configurability, extensibility, or expiry automation from code the scope summary / PR / comments declare temporary (time-boxed campaign, experiment, one-off script) β€” reason starting `over-scrutiny: lifespan`; the only temporary-code findings that survive are those whose damage persists beyond the window (billing/credit/data writes). This filter exists because reviewers were instructed to over-report; you are the noise gate.
-6. **Extra steps for `dimension: reuse-architecture` dedup findings**: open EVERY file in `existing_implementations` (β‰₯ 30 lines context each) and compare behavioral equivalence β€” same input β†’ same output/side effects. At least one true equivalent β†’ `confirmed`; all merely syntactically similar β†’ `false_positive` naming the semantic difference; unable to tell without missing context β†’ `need_more_context`.
+4. Validate the `nature` field against the actual location: `+` line β†’ should be `introduced`; context/old line β†’ should be `exposed_legacy`. Fix mislabels with `nature_override`.
+5. **Validate `exposure` on every `exposed_legacy` finding** β€” this decides whether the finding blocks this PR or is handed to the code's owner, so treat an inflated label as seriously as a false positive. `triggered` requires a concrete before/after argument: name what this diff changed (new caller, new input shape, new config, widened path) that makes the old problem reachable or harmful when it previously was not. Cannot produce that argument β†’ it is a `bystander`; set `exposure_override: "bystander"`. Bystander finds survive only as obvious p0 production bugs; anything less β†’ `false_positive` with reason starting `out-of-scope legacy:`.
+ Then, for every `exposed_legacy` finding you `confirm`, **attribute the culprit while you already have the file open**: `git log -L <start>,<end>:<file>` or `git blame -L <start>,<end> <file>` on the finding's location; return commit + author + date in `culprit`. Attribution that fails or is ambiguous (bulk move, formatting commit, vendored code) returns `culprit: null` β€” never guess an author. The main agent renders what you return; it will not re-run blame.
+6. **Validate `likelihood`** against the real production path, not the theoretical one: who can reach this code, what state/timing/permission is required, what upstream validation already blocks it. `low` means a hand-crafted input, a state the product cannot currently produce, an improbable race, an environment we don't ship, or a guarantee that already holds upstream. Reviewers were told to over-report and tend to inflate this β€” downgrade with `likelihood_override` whenever the preconditions you actually read are narrower than the finding claims. Consistency: `likelihood: "low"` and `blocks_release: true` can coexist only when the impact is catastrophic and irreversible (data corruption, financial loss, auth bypass); otherwise a `low` finding is `blocks_release: false`.
+7. **Over-scrutiny filter** (skip for findings from dimension files marked `calibration_exempt: true`): if the finding holds the diff to a standard the surrounding codebase itself does not meet β€” the flagged pattern is widespread in equivalent existing code and this diff does not make it worse β€” verdict `false_positive` with reason starting `over-scrutiny:`. Same verdict for lifespan mismatch: the finding demands configurability, extensibility, or expiry automation from code the scope summary / PR / comments declare temporary (time-boxed campaign, experiment, one-off script) β€” reason starting `over-scrutiny: lifespan`; the only temporary-code findings that survive are those whose damage persists beyond the window (billing/credit/data writes). This filter exists because reviewers were instructed to over-report; you are the noise gate.
+8. **Extra steps for `dimension: release-risk` findings**, which claim a release consequence rather than a code defect β€” verify the consequence, not the code:
+ - *Data-layer*: read the actual migration/schema statement and confirm the claimed irreversibility. Additive and reversible (nullable column, new table, concurrent index) β†’ `false_positive` unless a stated rollback/ordering hazard survives. For a `jsonb` shape claim, open the reader and confirm it really does not defend against the legacy shape.
+ - *Dev-cycle churn*: read the PR's migrations as a series and confirm the same PR both creates and later reworks the object. An object the PR only alters (it existed on trunk before) is a normal forward migration β†’ `false_positive`. Same for a "code reads an uncreated table" claim: grep the schema files yourself before confirming.
+ - *Prompt surface*: the finding must name a **behavioral** delta, not a stylistic one β€” which instruction was removed/weakened, or which tool's selection behavior moves and in which direction. A finding that only says the prompt changed, or that argues the new wording is worse writing, is `false_positive`. For a "removed instruction" claim, check the text really is gone rather than moved elsewhere in the assembled prompt. Confirmed prompt findings are never `can_auto_fix: true` β€” rewording a prompt back is a behavior decision, not a batch edit.
+ - *High-frequency UI*: confirm two things independently β€” that the surface really is on the first-minute path (name it), and that an **established** behavior changed rather than something being added. Additive-only, or a surface reached through several deliberate steps β†’ `false_positive`. A finding that merely restates that the change is user-visible, or that argues the new design is worse, is `false_positive` with reason starting `out-of-scope: ux`.
+ - *Shared surface*: the finding must carry a call-site count β€” reproduce it (grep the imports). No measurable blast radius, or the contract is unchanged for existing callers β†’ `false_positive`.
+ - *PR purity*: confirm independence yourself β€” check that nothing outside the proposed split imports what it adds, and that the split-out part would build and deploy alone. Cannot prove independence, or the "sub-requirements" share a dependency β†’ `false_positive`. Splitting is expensive; only a provable, worthwhile split survives.
+9. **Extra steps for `dimension: reuse-architecture` dedup findings**: open EVERY file in `existing_implementations` (β‰₯ 30 lines context each) and compare behavioral equivalence β€” same input β†’ same output/side effects. At least one true equivalent β†’ `confirmed`; all merely syntactically similar β†’ `false_positive` naming the semantic difference; unable to tell without missing context β†’ `need_more_context`.
## Anti-shortcut red lines
@@ -60,11 +70,15 @@ The main agent lists `can_auto_fix: true` findings in the "safe to fix now" batc
Any miss β†’ `can_auto_fix: false` with `auto_fix_reason` naming the failed criterion. `reuse-architecture` findings default to `false` (caller migration violates #4); the rare exception (constant swap, single import switch, no signature change) needs its justification in `auto_fix_reason`.
+`release-risk` findings are always `can_auto_fix: false` β€” a PR split, a migration rollout plan, or a base-component contract change is a release decision for the human, never a batch edit.
+
+`nature: "exposed_legacy"` is always `can_auto_fix: false` (`auto_fix_reason: "legacy code β€” not this PR's scope"`), regardless of how trivial the fix looks. Patching someone else's old code from an unrelated PR is a scope decision for the human, never an auto-applied batch edit.
+
## blocks_release (confirmed only)
Would shipping without this fix be unacceptable? `true`: production incident / data corruption / security hole / auth bypass, or breaks acceptance criteria or a main user path. `false`: real but shippable β€” rare edges, degraded-but-working flows, internal/bookkeeping, code quality.
-Consistency: p0 β†’ must be `true`; p2 β†’ must be `false`; p1 β†’ your call.
+Consistency: p0 β†’ must be `true`; p2 β†’ must be `false`; p1 β†’ your call. A `likelihood: "low"` finding is `false` unless the impact is catastrophic and irreversible.
## same_root_as (dedup, confirmed only)
@@ -84,6 +98,9 @@ One JSON object in a ```` ```json ```` fence. Valid JSON only.
"auto_fix_reason": null, // only when can_auto_fix=false: which criterion failed
"blocks_release": true, // confirmed only
"nature_override": null, // only when the original nature is mislabeled
+ "exposure_override": null, // only when the original exposure is mislabeled; triggered | bystander
+ "likelihood_override": null, // only when the original likelihood is inflated or understated; high | medium | low
+ "culprit": null, // confirmed exposed_legacy only: "<short sha> <author> <YYYY-MM-DD>", or null when attribution is ambiguous
"same_root_as": null, // optional; first-occurrence id of the shared root
"fix_options_override": null, // optional; string array, only when clearly better
"note": null, // optional caveat/risk remark