@mrciphersmith/keryx 0.4.60 → 0.4.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -38567,7 +38567,7 @@ var package_default;
38567
38567
  var init_package = __esm(() => {
38568
38568
  package_default = {
38569
38569
  name: "@mrciphersmith/keryx",
38570
- version: "0.4.60",
38570
+ version: "0.4.61",
38571
38571
  description: "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
38572
38572
  private: false,
38573
38573
  publishConfig: {
@@ -56968,6 +56968,10 @@ function mergePremises(findings, parsedInput) {
56968
56968
  reject("challenged-without-evidence", "`challenged` needs at least one intent signal (a cited ref) or practice source (a named guideline). A challenge with neither is the reviewer's argument turned around.");
56969
56969
  continue;
56970
56970
  }
56971
+ if (verdict === "owner-decision" && (signals.value?.length ?? 0) + (sources.value?.length ?? 0) === 0) {
56972
+ reject("owner-decision-without-evidence", "`owner-decision` needs at least one intent signal (a cited ref: the PR body, a code line, a commit) or practice source (a named rule) showing the choice is the owner's. Without one the finding goes on as reported: use `upheld`.");
56973
+ continue;
56974
+ }
56971
56975
  if (!present3(claim.question)) {
56972
56976
  reject("held-without-question", `\`${verdict}\` holds the finding for the operator, who needs a question to answer.`);
56973
56977
  continue;
@@ -78254,6 +78258,33 @@ var init_active_review = __esm(() => {
78254
78258
  ACTIVE_REVIEW_DIR = path171.join(".metaproject", "data", "review-active");
78255
78259
  });
78256
78260
 
78261
+ // src/review/machine-fences.ts
78262
+ function stripMachineFences(text) {
78263
+ let rest = text;
78264
+ let out = "";
78265
+ for (;; ) {
78266
+ const open = OPENING.exec(rest);
78267
+ if (open === null)
78268
+ break;
78269
+ const marker = open[1] ?? "```";
78270
+ const char = marker.startsWith("~") ? "~" : "`";
78271
+ const afterOpen = open.index + open[0].length;
78272
+ const tail = rest.slice(afterOpen);
78273
+ const closing = new RegExp(`^ {0,3}\\${char}{${marker.length},}[ \\t]*$`, "m").exec(tail.replace(/^\r?\n/, ""));
78274
+ const skipped = tail.length - tail.replace(/^\r?\n/, "").length;
78275
+ const end = closing === null ? rest.length : afterOpen + skipped + closing.index + closing[0].length;
78276
+ out += rest.slice(0, open.index);
78277
+ rest = rest.slice(end);
78278
+ }
78279
+ return (out + rest).replace(/\n{3,}/g, `
78280
+
78281
+ `);
78282
+ }
78283
+ var OPENING;
78284
+ var init_machine_fences = __esm(() => {
78285
+ OPENING = /^ {0,3}(`{3,}|~{3,})[^\n`]*\bkeryx:[\w-]+\b[^\n]*$/m;
78286
+ });
78287
+
78257
78288
  // src/review/report-overlay.ts
78258
78289
  import { lstat as lstat14, readdir as readdir29, readFile as readFile88, realpath as realpath22 } from "fs/promises";
78259
78290
  import { createHash as createHash60 } from "crypto";
@@ -78436,12 +78467,13 @@ ${end}`;
78436
78467
  ` + metadata;
78437
78468
  }
78438
78469
  function publicProjectReport(report) {
78439
- return report.replace(slotsFence, "").replace(savedSlotMarker, "").trim();
78470
+ return stripMachineFences(report.replace(slotsFence, "").replace(savedSlotMarker, "")).trim();
78440
78471
  }
78441
78472
  var text4 = (value) => typeof value === "string" ? value.trim() : "", object3 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : undefined, overlayPath = ".metaproject/review-publish-template.md", placeholder = "{{review}}", projectSkills = ".metaproject/project-skills/orchestration", baseTemplate = ".metaproject/skills/gdskills/review/review-orchestrator/templates/review-report.md", slotNames, DESK_TEMPLATE_SELECTION = "publication-template.json", VANTAGE_CHECKS, slotsFence, savedSlotMarker;
78442
78473
  var init_report_overlay = __esm(() => {
78443
78474
  init_fs();
78444
78475
  init_git_worktrees();
78476
+ init_machine_fences();
78445
78477
  slotNames = ["pre-verdict", "after-verdict", "verified-clean", "how-run"];
78446
78478
  VANTAGE_CHECKS = [
78447
78479
  "Owner intent",
@@ -80486,6 +80518,8 @@ function withSpendSection(report, research) {
80486
80518
  const section = `${SPEND_HEADING}
80487
80519
 
80488
80520
  ${usageTotalsLine(totals)}
80521
+
80522
+ ${SPEND_SCOPE_NOTE}
80489
80523
  `;
80490
80524
  const lines = report.split(`
80491
80525
  `);
@@ -80503,7 +80537,7 @@ ${section}${next === -1 ? "" : `
80503
80537
  ${lines.slice(next).join(`
80504
80538
  `)}`}`;
80505
80539
  }
80506
- var USAGE_MARKER = "KERYX_USAGE", OTHER_USAGE_MARKER = "KERYX_USAGE_OTHER", NO_TEXT_PLACEHOLDER = "(subagent produced no text)", SPEND_HEADING = "## Token spend", HOST_MARK = "host", MAX_DISPATCH_TOKENS = 1e8, USAGE_LINE, MAX_USAGE_LINE_CHARS = 4096, toTokenCount = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= MAX_DISPATCH_TOKENS ? Math.round(value) : undefined, isObject2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
80540
+ var USAGE_MARKER = "KERYX_USAGE", OTHER_USAGE_MARKER = "KERYX_USAGE_OTHER", NO_TEXT_PLACEHOLDER = "(subagent produced no text)", SPEND_HEADING = "## Token spend", SPEND_SCOPE_NOTE = "_Reviewer dispatches only: the orchestrating session's own tokens are not counted._", HOST_MARK = "host", MAX_DISPATCH_TOKENS = 1e8, USAGE_LINE, MAX_USAGE_LINE_CHARS = 4096, toTokenCount = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= MAX_DISPATCH_TOKENS ? Math.round(value) : undefined, isObject2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
80507
80541
  var init_dispatch_usage = __esm(() => {
80508
80542
  USAGE_LINE = /^[ \t]*KERYX_USAGE(_OTHER)?[ \t]+(.*?)\r?$/;
80509
80543
  });
@@ -81221,7 +81255,7 @@ function parseReviewResult(reply) {
81221
81255
  const raw = splitUsage(reply).body;
81222
81256
  const labelled = labelledFence(raw);
81223
81257
  if (labelled !== undefined)
81224
- return labelled.result ?? lenientReviewResult(raw.slice(labelled.at));
81258
+ return labelled.result ?? lenientReviewResult(raw.slice(labelled.at)) ?? statusLineResult(raw);
81225
81259
  const marked = afterMarker(raw)?.result;
81226
81260
  if (marked !== undefined)
81227
81261
  return marked;
@@ -81233,7 +81267,43 @@ function parseReviewResult(reply) {
81233
81267
  const strict = scannedResult(raw);
81234
81268
  if (strict !== undefined)
81235
81269
  return strict;
81236
- return lenientReviewResult(raw);
81270
+ return lenientReviewResult(raw) ?? statusLineResult(raw);
81271
+ }
81272
+ function lacksOnlyStatus(value) {
81273
+ if (value === null || typeof value !== "object" || Array.isArray(value))
81274
+ return false;
81275
+ const object = value;
81276
+ return object.status === undefined && (typeof object.reviewer === "string" || Array.isArray(object.findings));
81277
+ }
81278
+ function statusLineResult(raw) {
81279
+ const inFence = fenceTester(raw);
81280
+ const statuses = new Set([...raw.matchAll(STATUS_LINE)].filter((line) => !inFence(line.index)).map((line) => line[1]));
81281
+ if (statuses.size !== 1)
81282
+ return;
81283
+ const status = [...statuses][0];
81284
+ const withStatus = (value) => ({ ...value, status });
81285
+ const labelled = [...raw.matchAll(/```REVIEW_RESULT[ \t]*\r?\n([\s\S]*?)```/gi)];
81286
+ if (labelled.length > 0) {
81287
+ const parsed = tryParse2(labelled[labelled.length - 1][1]);
81288
+ return lacksOnlyStatus(parsed) ? withStatus(parsed) : undefined;
81289
+ }
81290
+ const markers = [...raw.matchAll(MARKER)].filter((marker) => !inFence(marker.index)).slice(-MAX_MARKERS);
81291
+ for (let at = markers.length - 1;at >= 0; at -= 1) {
81292
+ const start = markers[at].index + markers[at][0].length;
81293
+ const { end } = objectEnd(raw, start);
81294
+ if (end === undefined)
81295
+ continue;
81296
+ const parsed = tryParse2(raw.slice(start, end + 1));
81297
+ if (lacksOnlyStatus(parsed))
81298
+ return withStatus(parsed);
81299
+ }
81300
+ const { found, truncated } = topLevelObjects(raw);
81301
+ if (truncated)
81302
+ return;
81303
+ const shaped = found.filter(({ value }) => lacksOnlyStatus(value));
81304
+ const fenced = shaped.filter(({ start }) => inFence(start));
81305
+ const chosen = (fenced.length > 0 ? fenced : shaped).at(-1)?.value;
81306
+ return lacksOnlyStatus(chosen) ? withStatus(chosen) : undefined;
81237
81307
  }
81238
81308
  function explainUnparsedResult(raw) {
81239
81309
  return describeUnusableResult(raw);
@@ -81621,7 +81691,7 @@ async function ledgerBlockers(ledger, canonical, options) {
81621
81691
  const coverage = await packageCoverageErrors(options.packageDir, ledger.dispatch);
81622
81692
  return [...researchErrors(ledger, canonical), ...coverage, ...await coverageGateErrors(options.packageDir, ledger)];
81623
81693
  }
81624
- var FINISHED, CLOSED, CLAIM_QUOTE_CHARS = 120, sha = (value) => createHash64("sha256").update(value).digest("hex").slice(0, 12), text5 = (v) => typeof v === "string" && v.trim().length > 0, namesObligation = (key, oid) => key === oid || typeof key === "string" && key.endsWith(`#${oid}`), holdsKey = (finding, key) => finding.id === key || finding.global_id === key, mergedFromHas = (finding, id) => Array.isArray(finding.merged_from) && finding.merged_from.some((entry) => namesObligation(entry, id)), OBJECT_START, RESULT_KEYS, KEY_COLON, MAX_UNCLOSED = 64, FENCE_OPEN, FENCE_CLOSE, LINE_CLOSE, MAX_MARKERS = 64, MARKER, PARENT_FOLLOW_UP, sliceIdsOf = (value) => readSliceIds(value).ids, AUDIT_ROLES, DISPOSITION_WRAPPER_KEYS, DISPOSITION_SCHEMA = `{"id":"<raw stem>:<Fn>","status":"finding|refuted|out-of-scope|narrowed","evidence":\u2026,"reason":\u2026,"finding":\u2026 (status finding; optional: defaults to the canonical finding whose id is the row's id, or the one the raw finding resolves to),"remains":\u2026 (status narrowed)}`;
81694
+ var FINISHED, CLOSED, CLAIM_QUOTE_CHARS = 120, sha = (value) => createHash64("sha256").update(value).digest("hex").slice(0, 12), text5 = (v) => typeof v === "string" && v.trim().length > 0, namesObligation = (key, oid) => key === oid || typeof key === "string" && key.endsWith(`#${oid}`), holdsKey = (finding, key) => finding.id === key || finding.global_id === key, mergedFromHas = (finding, id) => Array.isArray(finding.merged_from) && finding.merged_from.some((entry) => namesObligation(entry, id)), OBJECT_START, RESULT_KEYS, KEY_COLON, MAX_UNCLOSED = 64, FENCE_OPEN, FENCE_CLOSE, LINE_CLOSE, MAX_MARKERS = 64, MARKER, RESULT_STATUSES, STATUS_LINE, PARENT_FOLLOW_UP, sliceIdsOf = (value) => readSliceIds(value).ids, AUDIT_ROLES, DISPOSITION_WRAPPER_KEYS, DISPOSITION_SCHEMA = `{"id":"<raw stem>:<Fn>","status":"finding|refuted|out-of-scope|narrowed","evidence":\u2026,"reason":\u2026,"finding":\u2026 (status finding; optional: defaults to the canonical finding whose id is the row's id, or the one the raw finding resolves to),"remains":\u2026 (status narrowed)}`;
81625
81695
  var init_ledger = __esm(() => {
81626
81696
  init_coverage();
81627
81697
  init_coverage_complete();
@@ -81643,6 +81713,8 @@ var init_ledger = __esm(() => {
81643
81713
  FENCE_CLOSE = /^ {0,3}(`{3,})[ \t]*$/;
81644
81714
  LINE_CLOSE = /^ {0,3}```[ \t]*\r?$/gm;
81645
81715
  MARKER = /(?<![^\n])[ \t>*#-]*REVIEW_RESULT(?:[ \t]*[:=])?\s*(?=\{)/g;
81716
+ RESULT_STATUSES = ["DONE_WITH_CONCERNS", "DONE", "NEEDS_CONTEXT", "BLOCKED"];
81717
+ STATUS_LINE = new RegExp(`(?<![^\\n])[ \\t>*_#-]*STATUS[*_]*:[*_ \\t]*(${RESULT_STATUSES.join("|")})\\b`, "g");
81646
81718
  PARENT_FOLLOW_UP = /^[ \t>*_-]*Parent follow-up[ \t]*\**:\**[ \t]*(.*\S)[ \t]*$/i;
81647
81719
  AUDIT_ROLES = new Set(DEEP_ROLES.filter((role) => role !== ALWAYS_ROLE));
81648
81720
  DISPOSITION_WRAPPER_KEYS = ["dispositions", "items", "results", "data", "entries", "obligations"];
@@ -88759,6 +88831,9 @@ function reviewPackagePaths(text) {
88759
88831
  floor = end;
88760
88832
  }
88761
88833
  }
88834
+ function continuesReview(invocation) {
88835
+ return !LOOKUP_SUBCOMMANDS.has(invocation.subcommand) && !invocation.args.some((arg) => arg === "--help" || arg === "-h");
88836
+ }
88762
88837
  function endWord(state) {
88763
88838
  if (state.inWord) {
88764
88839
  if (state.dropNext)
@@ -89045,7 +89120,8 @@ class SessionReviewTracker {
89045
89120
  continue;
89046
89121
  const cwd = path198.resolve(this.cwd);
89047
89122
  for (const invocation of keryxReviewInvocations(command, cwd)) {
89048
- this.runSeen = true;
89123
+ if (continuesReview(invocation))
89124
+ this.runSeen = true;
89049
89125
  if (invocation.cwd !== cwd && inside2(cwd, invocation.cwd))
89050
89126
  remember(this.roots, invocation.cwd, MAX_SESSION_REVIEW_ROOTS);
89051
89127
  for (const arg of invocation.args)
@@ -89258,7 +89334,7 @@ ${describeBlockers(open, card)}
89258
89334
  ` + "Do the next missing step now. Step 1 (Build Review Context Pack) has no CLI command; it is a prose step, so mark it done and move on. " + "A command that is refused is not a blocker: run `keryx review --help` for the accepted usage and retry with the right flags. " + "A routing refusal is the exception: when `keryx review tier` reports `dispatchable: false`, the operator's routing configuration refuses the reviewer model and no retry changes that, so report it as the one real blocker with the `routing:` lines it printed. " + "A plan item you marked blocked for such a reason is not blocked: mark it in_progress. " + "A tool loop guard or an empty child result is not a reason to ask the operator to resend the request or to continue: change the arguments, retry the failed pass on a smaller slice, and keep going. " + `Stop only after ${card ? "the `review_complete` card has" : "`keryx review complete` has"} closed the package, or report the one real blocker with its evidence.`
89259
89335
  };
89260
89336
  }
89261
- var MAX_REVIEW_GATE_CONTINUES = 20, MAX_REVIEW_GATE_STALLS = 3, MAX_HASHED_FILES = 4096, SIGNATURE_WALKS_PER_STOP = 2, MAX_SIGNATURE_FILES, RACY_WINDOW_MS = 2000, fileHashes, fileReads = 0, MAX_CONTENT_HASH_BYTES, ReviewGateAbortedError, TRUNCATION_MARKER = "\u2026truncated", byName = (a, b) => a < b ? -1 : a > b ? 1 : 0, METAPROJECT = ".metaproject", REVIEWS = "reviews", PREFIX_DELIMITERS, MAX_PREFIX_CHARS = 1024, MAX_NAME_CHARS = 255, MAX_SESSION_REVIEW_ROOTS = 8, MAX_SESSION_REVIEW_DIRS = 32, MAX_SESSION_REVIEW_IDS = 32, MAX_PENDING_CALLS = 64, SAFE_REVIEW_ID, isPathDelimiter = (ch) => PREFIX_DELIMITERS.has(ch) || /\s/.test(ch), isSeparator = (ch) => ch === "/" || ch === "\\", OPENING_SUBCOMMANDS, PACKAGE_ARG_SUBCOMMANDS, VALUELESS_FLAGS, OWN_OUTPUT_LINE, KERYX_PACKAGE, PIPE_FILTERS, NO_VALUE_OPTIONS, HEAD_TAIL_VALUE_OPTIONS, GREP_VALUE_OPTIONS, READER_VALUE_OPTIONS, GREP_PATTERN_OPTIONS, GREP_TREE_OPTION, KERYX_PACKAGE_NAMES, nextIs = (line, at, chars) => at + 1 < line.length && chars.includes(line[at + 1]), baseName2 = (word) => path198.posix.basename(word.replace(/\\/g, "/")), trackers, SCAN_CONCURRENCY = 16, NO_PACKAGE_BLOCKER = "no review package this session opened or named: `keryx review start` has not opened one, and no `keryx review` command in this session names an open package by its path or review id", MAX_NUDGE_BLOCKERS = 20, MAX_NUDGE_BLOCKER_CHARS = 300;
89337
+ var MAX_REVIEW_GATE_CONTINUES = 20, MAX_REVIEW_GATE_STALLS = 3, MAX_HASHED_FILES = 4096, SIGNATURE_WALKS_PER_STOP = 2, MAX_SIGNATURE_FILES, RACY_WINDOW_MS = 2000, fileHashes, fileReads = 0, MAX_CONTENT_HASH_BYTES, ReviewGateAbortedError, TRUNCATION_MARKER = "\u2026truncated", byName = (a, b) => a < b ? -1 : a > b ? 1 : 0, METAPROJECT = ".metaproject", REVIEWS = "reviews", PREFIX_DELIMITERS, MAX_PREFIX_CHARS = 1024, MAX_NAME_CHARS = 255, MAX_SESSION_REVIEW_ROOTS = 8, MAX_SESSION_REVIEW_DIRS = 32, MAX_SESSION_REVIEW_IDS = 32, MAX_PENDING_CALLS = 64, SAFE_REVIEW_ID, isPathDelimiter = (ch) => PREFIX_DELIMITERS.has(ch) || /\s/.test(ch), isSeparator = (ch) => ch === "/" || ch === "\\", LOOKUP_SUBCOMMANDS, OPENING_SUBCOMMANDS, PACKAGE_ARG_SUBCOMMANDS, VALUELESS_FLAGS, OWN_OUTPUT_LINE, KERYX_PACKAGE, PIPE_FILTERS, NO_VALUE_OPTIONS, HEAD_TAIL_VALUE_OPTIONS, GREP_VALUE_OPTIONS, READER_VALUE_OPTIONS, GREP_PATTERN_OPTIONS, GREP_TREE_OPTION, KERYX_PACKAGE_NAMES, nextIs = (line, at, chars) => at + 1 < line.length && chars.includes(line[at + 1]), baseName2 = (word) => path198.posix.basename(word.replace(/\\/g, "/")), trackers, SCAN_CONCURRENCY = 16, NO_PACKAGE_BLOCKER = "no review package this session opened or named: `keryx review start` has not opened one, and no `keryx review` command in this session names an open package by its path or review id", MAX_NUDGE_BLOCKERS = 20, MAX_NUDGE_BLOCKER_CHARS = 300;
89262
89338
  var init_completion_gate = __esm(() => {
89263
89339
  init_active_review();
89264
89340
  init_managed();
@@ -89276,6 +89352,7 @@ var init_completion_gate = __esm(() => {
89276
89352
  };
89277
89353
  PREFIX_DELIMITERS = new Set([..."\"'`<>|;&()="]);
89278
89354
  SAFE_REVIEW_ID = /^[A-Za-z0-9._:-]{1,120}$/;
89355
+ LOOKUP_SUBCOMMANDS = new Set(["", "pr-context", "board", "reviews", "accounts", "help", "--help", "-h"]);
89279
89356
  OPENING_SUBCOMMANDS = new Set(["start", "attach", "ingest"]);
89280
89357
  PACKAGE_ARG_SUBCOMMANDS = new Set(["status", "readiness", "complete", "attach", "publish", "verdict", "show"]);
89281
89358
  VALUELESS_FLAGS = new Set([
@@ -103039,7 +103116,7 @@ function auditorBody(pack) {
103039
103116
  "",
103040
103117
  "Findings section, ordered by severity: file path and line, which audit-focus pattern it matches, and a specific remediation. Note anything checked and found clean.",
103041
103118
  "",
103042
- `${STATUS_LINE} Use \`DONE_WITH_CONCERNS\` when findings exist; \`BLOCKED\` only when the scope could not be read.`,
103119
+ `${STATUS_LINE2} Use \`DONE_WITH_CONCERNS\` when findings exist; \`BLOCKED\` only when the scope could not be read.`,
103043
103120
  ""
103044
103121
  ].join(`
103045
103122
  `);
@@ -103071,7 +103148,7 @@ function fixerBody(pack) {
103071
103148
  "",
103072
103149
  "Findings section: which command(s) were failing, the root cause, the fix applied, and the final re-run result for each command from step 1.",
103073
103150
  "",
103074
- `${STATUS_LINE} Use \`DONE_WITH_CONCERNS\` when a fix landed but a related risk remains; \`BLOCKED\` when the failure could not be reproduced at all.`,
103151
+ `${STATUS_LINE2} Use \`DONE_WITH_CONCERNS\` when a fix landed but a related risk remains; \`BLOCKED\` when the failure could not be reproduced at all.`,
103075
103152
  ""
103076
103153
  ].join(`
103077
103154
  `);
@@ -103125,7 +103202,7 @@ ${fixerBody(pack)}`
103125
103202
  };
103126
103203
  return { auditor, fixer };
103127
103204
  }
103128
- var AUDITOR_TOOLS, FIXER_TOOLS, IDENTIFIER_PATTERN, CONTROL_CHAR_PATTERN, InvalidStackPackFieldError, STATUS_LINE = "The reply's first line is `STATUS: DONE|DONE_WITH_CONCERNS|NEEDS_CONTEXT|BLOCKED` per the subagent-result contract.";
103205
+ var AUDITOR_TOOLS, FIXER_TOOLS, IDENTIFIER_PATTERN, CONTROL_CHAR_PATTERN, InvalidStackPackFieldError, STATUS_LINE2 = "The reply's first line is `STATUS: DONE|DONE_WITH_CONCERNS|NEEDS_CONTEXT|BLOCKED` per the subagent-result contract.";
103129
103206
  var init_generate = __esm(() => {
103130
103207
  AUDITOR_TOOLS = ["read_file", "list_dir", "get_cwd", "search_code", "graph_affected", "memory_search"];
103131
103208
  FIXER_TOOLS = ["read_file", "list_dir", "get_cwd", "search_code", "graph_affected", "apply_patch", "shell_exec"];
@@ -154958,6 +155035,47 @@ function mentionsFindingId(report, id) {
154958
155035
  const escaped = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
154959
155036
  return new RegExp(`(?<!${ID_CHAR})${escaped}(?!${ID_CHAR})`).test(report);
154960
155037
  }
155038
+ function withoutHeldSections(report) {
155039
+ const lines = report.split(`
155040
+ `);
155041
+ const kept = [];
155042
+ let skipping = 0;
155043
+ for (const line of lines) {
155044
+ const heading = /^(#{1,6})[ \t]/.exec(line);
155045
+ if (skipping > 0 && heading !== null && heading[1].length <= skipping)
155046
+ skipping = 0;
155047
+ const held = HELD_HEADING.exec(line);
155048
+ if (held !== null) {
155049
+ skipping = held[1].length;
155050
+ continue;
155051
+ }
155052
+ if (skipping === 0)
155053
+ kept.push(line);
155054
+ }
155055
+ return kept.join(`
155056
+ `).replace(/\n{3,}/g, `
155057
+
155058
+ `);
155059
+ }
155060
+ function heldSection(held, decisions) {
155061
+ const latest = new Map;
155062
+ for (const decision of decisions)
155063
+ latest.set(decision.finding, decision);
155064
+ const parts = [];
155065
+ if (held.length > 0) {
155066
+ parts.push("### Held for a decision", "", ...held.map((finding) => `- **${finding.id}** (${finding.severity}): ${finding.problem}`), "");
155067
+ }
155068
+ if (latest.size > 0) {
155069
+ const shortId = (finding) => finding.slice(finding.lastIndexOf("#") + 1);
155070
+ parts.push("### Decided by the operator", "", ...[...latest.values()].map((decision) => `- **${shortId(decision.finding)}**: ${decision.answer === "dismiss" ? "dismissed" : "upheld"}${decision.reason.trim() ? ` (${oneLine8(decision.reason)})` : ""}`), "");
155071
+ }
155072
+ return parts.length === 0 ? "" : `
155073
+ ${parts.join(`
155074
+ `)}`;
155075
+ }
155076
+ function oneLine8(text) {
155077
+ return text.replace(/\s+/g, " ").trim();
155078
+ }
154961
155079
  function minorsLeftOut(count) {
154962
155080
  return `- \u2026 ${count} more minor finding(s) \u2014 see verdict-interim.md / \`keryx review verdict\``;
154963
155081
  }
@@ -155059,18 +155177,21 @@ async function publishReview(packageDir, options) {
155059
155177
  if (partial && event === "APPROVE") {
155060
155178
  throw new Error(`A partial review cannot approve: ${failing.length} readiness item(s) are failing (${failing.map((item) => item.id).join(", ")}). Use --event COMMENT or REQUEST_CHANGES, or repair the items.`);
155061
155179
  }
155062
- const report = publicProjectReport(await readFile160(path357.join(packageDir, "report.md"), "utf8").catch(() => ""));
155180
+ const stored = await readFile160(path357.join(packageDir, "report.md"), "utf8").catch(() => "");
155181
+ const research = await readJsonFileOr(path357.join(packageDir, "research.json"), undefined);
155182
+ const report = withoutHeldSections(publicProjectReport(withSpendSection(stored, research)));
155063
155183
  if (report === "")
155064
155184
  throw new Error(`Review ${manifest.reviewId} has no report.md body to publish.`);
155065
155185
  const movedLine = moved === undefined || firstLineSaysMoved(report, reviewedHead) ? "" : `${headMovedLine({ reviewedHead, currentHead: moved })}
155066
155186
 
155067
155187
  `;
155188
+ const [verdict, { decisions }] = await Promise.all([computeVerdict(packageDir), premiseRecords(packageDir)]);
155068
155189
  const head = `${movedLine}${partial ? `${partialPublishHeader(readiness).join(`
155069
155190
  `)}
155070
155191
  ` : ""}${runModeHeader(packageDir)}${report}
155071
- `;
155192
+ ${heldSection(verdict.held, decisions)}`;
155072
155193
  const foot = runModeFooter(packageDir);
155073
- const minors = minorSection((await computeVerdict(packageDir)).minors, report, PUBLISHED_BODY_LIMIT - head.length - foot.length - ROUND_BLOCK_LIMIT);
155194
+ const minors = minorSection(verdict.minors, report, PUBLISHED_BODY_LIMIT - head.length - foot.length - ROUND_BLOCK_LIMIT);
155074
155195
  const visible = `${head}${minors}${foot}`;
155075
155196
  const findings = await readJsonFileOr(path357.join(packageDir, "findings.json"), []);
155076
155197
  const roundBlock = buildRoundBlock({ body: visible, round: readRoundNumber(packageDir) ?? 1, reviewId: manifest.reviewId, reviewedHead, findings: Array.isArray(findings) ? findings : [] });
@@ -155134,7 +155255,7 @@ ${marker}
155134
155255
  const registered = recordFinishedRound(packageDir, "publish");
155135
155256
  return { readiness, body, event, partial, posted: true, ...url === "" ? {} : { url }, ...registered.error === undefined ? {} : { registryWarning: `round not recorded in the local round registry: ${registered.error}` } };
155136
155257
  }
155137
- var REVIEW_EVENTS, FULL_SHA, sameCommit3 = (a, b) => a.toLowerCase() === b.toLowerCase(), PUBLISHED_BODY_LIMIT = 60000, ID_CHAR = "[A-Za-z0-9_-]", ROUND_BLOCK_LIMIT = 4000;
155258
+ var REVIEW_EVENTS, FULL_SHA, sameCommit3 = (a, b) => a.toLowerCase() === b.toLowerCase(), PUBLISHED_BODY_LIMIT = 60000, ID_CHAR = "[A-Za-z0-9_-]", HELD_HEADING, ROUND_BLOCK_LIMIT = 4000;
155138
155259
  var init_publish = __esm(() => {
155139
155260
  init_fs();
155140
155261
  init_json();
@@ -155146,10 +155267,12 @@ var init_publish = __esm(() => {
155146
155267
  init_round_record();
155147
155268
  init_round_registry();
155148
155269
  init_verdict();
155270
+ init_dispatch_usage();
155149
155271
  init_readiness();
155150
155272
  init_types();
155151
155273
  REVIEW_EVENTS = ["COMMENT", "REQUEST_CHANGES", "APPROVE"];
155152
155274
  FULL_SHA = /^[0-9a-f]{40}$/i;
155275
+ HELD_HEADING = /^(#{2,4})[ \t]+Held for\b/i;
155153
155276
  });
155154
155277
 
155155
155278
  // src/review/desk-publication.ts
@@ -156310,7 +156433,7 @@ async function projectGithubEnvironment(cwd, env = process.env) {
156310
156433
  }
156311
156434
  async function applyProjectGithubAccount(args, cwd = process.cwd(), env = process.env) {
156312
156435
  const [command, sub] = args;
156313
- if (!command || !GITHUB_COMMANDS.has(command) || command === "review" && sub === "accounts")
156436
+ if (!command || !GITHUB_COMMANDS.has(command) || command === "review" && (sub === "accounts" || sub === "state"))
156314
156437
  return;
156315
156438
  if (env.GH_TOKEN || env.GITHUB_TOKEN)
156316
156439
  return;
@@ -165191,231 +165314,6 @@ var init_review_entity = __esm(() => {
165191
165314
  FINISHED2 = new Set(["completed", "partial", "budget"]);
165192
165315
  });
165193
165316
 
165194
- // src/commands/review-reviews.ts
165195
- import { parseArgs as parseArgs11 } from "util";
165196
- async function readReviews({ repo, repositories, query, compare, root = deskRunRoot(), compareBudgetMs = REVIEW_COMPARE_BUDGET_MS, includeClosed = false }) {
165197
- const [owner, name] = repo.split("/");
165198
- const identity = await query(identityQuery, { owner, name });
165199
- const viewer = identity.viewer?.login;
165200
- const repositoryId = identity.repository?.id;
165201
- if (!viewer || !repositoryId)
165202
- throw new Error("access: GitHub repository or account is unavailable.");
165203
- const snapshot = { version: 1, repo, repositories, repositoryId, viewer, fetchedAt: new Date().toISOString(), reviews: [], warnings: [] };
165204
- const rows = readReviewRows(repositoryId, viewer, root).map((row) => ({ row, at: latestActivity(row) })).sort((a, b) => b.at.localeCompare(a.at) || b.row.number - a.row.number).map(({ row }) => row);
165205
- if (!rows.length)
165206
- return snapshot;
165207
- const cards = await readCards(snapshot, includeClosed ? rows : rows.filter((row) => row.closedAt === null), query);
165208
- const behind = rows.flatMap((row) => {
165209
- const pair = headComparison(row, cards.get(row.number) ?? null);
165210
- return pair && OBJECT_ID.test(pair.reviewed) && OBJECT_ID.test(pair.head) ? [{ id: row.id, ...pair }] : [];
165211
- });
165212
- if (behind.length > MAX_REVIEW_COMPARES)
165213
- snapshot.warnings.push(`Commit counts are shown for ${MAX_REVIEW_COMPARES} Reviews behind their pull request. Refresh to read more.`);
165214
- const comparisons = await compareHeads(behind.slice(0, MAX_REVIEW_COMPARES), compare, compareBudgetMs, snapshot.warnings);
165215
- snapshot.reviews = rows.map((row) => summarizeReview(row, cards.get(row.number) ?? null, comparisons.get(row.id)));
165216
- return snapshot;
165217
- }
165218
- async function readCards(snapshot, rows, query) {
165219
- const numbers = [...new Set(rows.map((row) => row.number))];
165220
- const batches = Array.from({ length: Math.ceil(numbers.length / CARD_BATCH) }, (_, i) => numbers.slice(i * CARD_BATCH, (i + 1) * CARD_BATCH));
165221
- let unreadable = false;
165222
- const read = await mapPool(batches, CARD_PARALLEL, async (batch) => {
165223
- try {
165224
- return await listActiveReviewCards(snapshot, batch, query);
165225
- } catch (error) {
165226
- if (cannotRetainData2(error))
165227
- throw error;
165228
- unreadable = true;
165229
- return [];
165230
- }
165231
- }, { stopOnError: true });
165232
- if (unreadable)
165233
- snapshot.warnings.push("Some pull requests could not be loaded. Refresh to retry.");
165234
- return new Map(read.flat().map((card) => [card.number, card]));
165235
- }
165236
- async function compareHeads(pairs, compare, budgetMs, warnings) {
165237
- const deadline = Date.now() + budgetMs;
165238
- let failed = false;
165239
- let late = false;
165240
- const compared = await mapPool(pairs, COMPARE_PARALLEL, async ({ id, reviewed, head }) => {
165241
- const left = deadline - Date.now();
165242
- if (left <= 0) {
165243
- late = true;
165244
- return null;
165245
- }
165246
- let timer;
165247
- const expired = new Promise((resolve) => {
165248
- timer = setTimeout(() => resolve("late"), left);
165249
- });
165250
- try {
165251
- const result = await Promise.race([compare(reviewed, head), expired]);
165252
- if (result === "late") {
165253
- late = true;
165254
- return null;
165255
- }
165256
- return [id, result];
165257
- } catch {
165258
- failed = true;
165259
- return null;
165260
- } finally {
165261
- clearTimeout(timer);
165262
- }
165263
- });
165264
- if (failed)
165265
- warnings.push("Some commit counts could not be read. Refresh to retry.");
165266
- if (late)
165267
- warnings.push("Some commit counts took too long to read. Refresh to retry.");
165268
- return new Map(compared.flatMap((entry) => entry ? [entry] : []));
165269
- }
165270
- function parseCompare(raw) {
165271
- const value = JSON.parse(raw);
165272
- if (typeof value?.status !== "string" || !compareStates.has(value.status) || !Number.isSafeInteger(value.ahead_by) || value.ahead_by < 0) {
165273
- throw new Error("unavailable: GitHub returned an unreadable comparison.");
165274
- }
165275
- return { status: value.status, aheadBy: value.ahead_by };
165276
- }
165277
- async function runReviewReviews(args, cwd = process.cwd()) {
165278
- if (args.length === 1 && (args[0] === "--help" || args[0] === "-h")) {
165279
- console.log(REVIEWS_USAGE);
165280
- return;
165281
- }
165282
- const { values } = parseArgs11({ args, strict: true, allowPositionals: false, options: { json: { type: "boolean" }, repo: { type: "string" }, "include-closed": { type: "boolean" } } });
165283
- if (!values.json)
165284
- throw new Error(REVIEWS_USAGE);
165285
- const repositories = await reviewRepositories(cwd);
165286
- const repo = selectRepository(repositories, values.repo);
165287
- const auth = await projectGithubConnection(cwd);
165288
- const result = await readReviews({
165289
- repo,
165290
- repositories,
165291
- includeClosed: values["include-closed"] === true,
165292
- query: (text, params) => boardGraphql(cwd, text, params, auth),
165293
- compare: async (base, head) => parseCompare(await boardGh(cwd, ["api", "--hostname", "github.com", `repos/${repo}/compare/${base}...${head}?per_page=1`, "--jq", "{status, ahead_by}"], auth))
165294
- });
165295
- await writeBoundJson(result, auth);
165296
- }
165297
- var REVIEWS_USAGE = "keryx review reviews --json [--repo owner/name] [--include-closed]", MAX_REVIEW_COMPARES = 25, REVIEW_COMPARE_BUDGET_MS = 60000, COMPARE_PARALLEL = 4, CARD_BATCH = 20, CARD_PARALLEL = 3, OBJECT_ID, identityQuery = `query ReviewIdentity($owner:String!, $name:String!) { viewer { login } repository(owner:$owner,name:$name) { id } }`, cannotRetainData2 = (error) => error instanceof Error && /^(access|configuration):/.test(error.message), latestActivity = (row) => row.attempts.reduce((max, a) => a.createdAt > max ? a.createdAt : max, ""), compareStates;
165298
- var init_review_reviews = __esm(() => {
165299
- init_board();
165300
- init_board_github();
165301
- init_desk_run_store();
165302
- init_review_entity();
165303
- OBJECT_ID = /^[0-9a-f]{40}$/;
165304
- compareStates = new Set(["ahead", "behind", "diverged", "identical"]);
165305
- });
165306
-
165307
- // src/review/review-advance.ts
165308
- function updateRoundOptions(options) {
165309
- if (options === undefined)
165310
- return;
165311
- const { autoPublish: _automatic, ...rest } = options;
165312
- return rest;
165313
- }
165314
- function reviewedAttempt(runs, id) {
165315
- const candidates = runs.filter((run) => run.source !== "existing" && !withdrawn2(run));
165316
- if (id !== undefined) {
165317
- const named = candidates.find((run) => run.id === id);
165318
- if (!named)
165319
- throw new Error("stale: This attempt was archived, deleted or imported, so it cannot be updated. Update the review from its latest round.");
165320
- return named;
165321
- }
165322
- const latest = [...candidates].sort((a, b) => (b.round ?? 0) - (a.round ?? 0) || b.createdAt.localeCompare(a.createdAt))[0];
165323
- if (!latest)
165324
- throw new Error("configuration: This pull request has no review to update. Start a review first.");
165325
- return latest;
165326
- }
165327
- function advanceRequest({ reviewed, runs, current, prState }) {
165328
- if (prState !== "OPEN")
165329
- throw new Error("stale: This pull request is no longer open.");
165330
- if (newerRoundOf(runs, reviewed) !== undefined) {
165331
- throw new Error("stale: A later round of this Review already exists. Refresh the Review and update from its latest round.");
165332
- }
165333
- if (reviewed.baseSha === current.baseSha && reviewed.headSha === current.headSha) {
165334
- throw new Error("configuration: This round already reviews the pull request's current head; there is nothing to update.");
165335
- }
165336
- const options = updateRoundOptions(reviewed.options);
165337
- return { revision: current, ...options && { options } };
165338
- }
165339
- async function advanceReview(args, deps) {
165340
- const { key, pr } = await deps.resolve(args.repo, args.number);
165341
- if (args.repositoryId !== undefined && args.repositoryId !== key.repositoryId || args.viewer !== undefined && args.viewer.toLowerCase() !== key.viewer.toLowerCase()) {
165342
- throw new Error("access: GitHub account or repository changed. Refresh the board.");
165343
- }
165344
- const current = { baseSha: pr.baseRefOid, headSha: pr.headRefOid };
165345
- if (args.revision !== undefined && (args.revision.baseSha !== current.baseSha || args.revision.headSha !== current.headSha)) {
165346
- throw new Error("stale: The pull request revision has changed. Refresh the board to review its current range.");
165347
- }
165348
- const runs = deps.history(key);
165349
- const reviewed = reviewedAttempt(runs, args.id);
165350
- const { revision, options } = advanceRequest({ reviewed, runs, current, prState: pr.state });
165351
- return deps.start(key, revision, options);
165352
- }
165353
- var withdrawn2 = (run) => run.decision?.action === "delete" || run.decision?.action === "archive";
165354
- var init_review_advance = __esm(() => {
165355
- init_update_round();
165356
- });
165357
-
165358
- // src/commands/review-advance.ts
165359
- import { parseArgs as parseArgs12 } from "util";
165360
- async function runReviewAdvance(args, cwd = process.cwd()) {
165361
- if (args.length === 1 && (args[0] === "--help" || args[0] === "-h")) {
165362
- console.log(ADVANCE_USAGE);
165363
- return;
165364
- }
165365
- const { values: v } = parseArgs12({
165366
- args,
165367
- strict: true,
165368
- allowPositionals: false,
165369
- options: {
165370
- json: { type: "boolean" },
165371
- repo: { type: "string" },
165372
- number: { type: "string" },
165373
- id: { type: "string" },
165374
- "repository-id": { type: "string" },
165375
- viewer: { type: "string" },
165376
- base: { type: "string" },
165377
- head: { type: "string" }
165378
- }
165379
- });
165380
- const number = Number(v.number);
165381
- if (!v.json || !v.repo || !/^[\w.-]+\/[\w.-]+$/.test(v.repo) || !v.number || !/^[1-9]\d*$/.test(v.number) || !Number.isSafeInteger(number) || v.id !== undefined && !uuid4.test(v.id) || v.base === undefined !== (v.head === undefined) || v.base !== undefined && (!sha6.test(v.base) || !sha6.test(v.head))) {
165382
- throw new Error(ADVANCE_USAGE);
165383
- }
165384
- const snapshot = await advanceReview({
165385
- repo: v.repo,
165386
- number,
165387
- id: v.id,
165388
- repositoryId: v["repository-id"],
165389
- viewer: v.viewer,
165390
- ...v.base !== undefined && { revision: { baseSha: v.base, headSha: v.head } }
165391
- }, {
165392
- resolve: async (repo, pr) => resolveDeskSubject(cwd, repo, pr, await projectGithubConnection(cwd)),
165393
- history: (key) => {
165394
- const store = new DeskRunStore;
165395
- try {
165396
- return store.history(key).runs;
165397
- } finally {
165398
- store.close();
165399
- }
165400
- },
165401
- start: async (key, revision, options) => {
165402
- await Promise.resolve().then(() => init_review_desk_provider());
165403
- return requestDeskRun(cwd, key, { action: "start", revision, ...options && { options } }, resolveDeskReviewOptions);
165404
- }
165405
- });
165406
- await new Promise((resolve, reject) => process.stdout.write(JSON.stringify(snapshot) + `
165407
- `, (error) => error ? reject(error) : resolve()));
165408
- }
165409
- var ADVANCE_USAGE = "keryx review advance --json --repo owner/name --number N [--id UUID] [--repository-id ID --viewer LOGIN] [--base SHA --head SHA]", sha6, uuid4;
165410
- var init_review_advance2 = __esm(() => {
165411
- init_board_github();
165412
- init_desk_run_store();
165413
- init_desk_run_service();
165414
- init_review_advance();
165415
- sha6 = /^[0-9a-f]{40}$/;
165416
- uuid4 = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/i;
165417
- });
165418
-
165419
165317
  // src/review/review-state-id.ts
165420
165318
  function slug4(text) {
165421
165319
  return text.toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
@@ -165500,7 +165398,7 @@ async function requireReview(projectRoot, id) {
165500
165398
  throw new ReviewStateError("not-found", `no review ${id} (${reviewStateRelativeDir(id)}/${REVIEW_STATE_FILE})`);
165501
165399
  return review;
165502
165400
  }
165503
- function oneLine8(text) {
165401
+ function oneLine9(text) {
165504
165402
  return text.replace(/\s+/g, " ").trim();
165505
165403
  }
165506
165404
  async function writeReview(projectRoot, id, verb, options, change) {
@@ -165514,7 +165412,7 @@ async function writeReview(projectRoot, id, verb, options, change) {
165514
165412
  await writeFileAtomic(path365.join(dir, REVIEW_STATE_FILE), `${JSON.stringify(next, null, 2)}
165515
165413
  `);
165516
165414
  }
165517
- await appendFile15(path365.join(dir, REVIEW_STATE_JOURNAL), `- ${at} ${verb} ${oneLine8(summary)}
165415
+ await appendFile15(path365.join(dir, REVIEW_STATE_JOURNAL), `- ${at} ${verb} ${oneLine9(summary)}
165518
165416
  `, "utf8");
165519
165417
  return result;
165520
165418
  });
@@ -165579,7 +165477,7 @@ async function openReviewRound(projectRoot, input, options) {
165579
165477
  review.onHeadMove = input.onHeadMove;
165580
165478
  const reopened = current?.state === "closed";
165581
165479
  const last = currentRound(review);
165582
- if (last && last.baseSha === baseSha && last.headSha === headSha && settingsMatch(last.settingsKey, settingsKey)) {
165480
+ if (last && last.baseSha === baseSha && last.headSha === headSha && settingsMatch(last.settingsKey, settingsKey) && !isPublished(review, last)) {
165583
165481
  if (last.settingsKey === null && settingsKey !== null)
165584
165482
  last.settingsKey = settingsKey;
165585
165483
  const restarted = sessionId !== null && sessionId !== last.sessionId;
@@ -165743,7 +165641,7 @@ async function markReview(projectRoot, id, mark, options) {
165743
165641
  });
165744
165642
  }
165745
165643
  async function appendNote(projectRoot, id, text, options) {
165746
- const line = oneLine8(text);
165644
+ const line = oneLine9(text);
165747
165645
  if (!line)
165748
165646
  throw new ReviewStateError("invalid", "a note needs text");
165749
165647
  return writeReview(projectRoot, id, "note", options, (current) => {
@@ -165801,6 +165699,323 @@ var init_review_state = __esm(() => {
165801
165699
  REVIEW_MARKS = ["stale", "closed", "ready"];
165802
165700
  });
165803
165701
 
165702
+ // src/review/review-state-rows.ts
165703
+ function recordMatches(record, repo, repositoryId, viewer) {
165704
+ const sameRepository = record.pr.repositoryId ? record.pr.repositoryId === repositoryId : record.pr.repo.toLowerCase() === repo.toLowerCase();
165705
+ return sameRepository && (record.viewer === null || record.viewer === viewer);
165706
+ }
165707
+ function roundAttempts(record, stored) {
165708
+ let highest = stored.reduce((max, attempt) => Math.max(max, attempt.round), 0);
165709
+ const assigned = [];
165710
+ return [...record.rounds].sort((a, b) => a.number - b.number).map((round) => {
165711
+ const known = stored.find((attempt) => sameRange2(attempt, round)) ?? assigned.find((entry) => sameRange2(entry, round));
165712
+ const number = known ? known.round : ++highest;
165713
+ if (!known)
165714
+ assigned.push({ baseSha: round.baseSha, headSha: round.headSha, round: number });
165715
+ return roundAttempt(record, round, number);
165716
+ });
165717
+ }
165718
+ function roundAttempt(record, round, number) {
165719
+ const state = ROUND_ATTEMPT_STATE[round.state];
165720
+ const finished = state === "completed";
165721
+ const published = record.publications.some((publication) => publication.round === round.number);
165722
+ return {
165723
+ ...round.sessionId ? { sessionId: round.sessionId } : {},
165724
+ id: `${record.id}#${round.number}`,
165725
+ round: number,
165726
+ previousRunId: null,
165727
+ state,
165728
+ source: "session",
165729
+ baseSha: round.baseSha,
165730
+ headSha: round.headSha,
165731
+ reviewed: finished ? { baseSha: round.baseSha, headSha: round.headSha } : null,
165732
+ coverage: null,
165733
+ findings: round.findings ? { blocker: round.findings.blocker, major: round.findings.major, minor: round.findings.minor, info: round.findings.info } : null,
165734
+ verdict: round.verdict,
165735
+ publication: published ? "published" : finished ? "pending" : null,
165736
+ decision: null,
165737
+ flowId: null,
165738
+ tokens: round.usage.tokens > 0 ? round.usage.tokens : null,
165739
+ awaitingAnswer: false,
165740
+ archived: false,
165741
+ createdAt: round.openedAt,
165742
+ finishedAt: finished || state === "cancelled" ? round.updatedAt : null
165743
+ };
165744
+ }
165745
+ function mergeReviewStateRows(rows, records, repositoryId, viewer) {
165746
+ const byNumber = new Map(rows.map((row) => [row.number, { ...row, attempts: [...row.attempts] }]));
165747
+ for (const record of records) {
165748
+ if (!record.rounds.length)
165749
+ continue;
165750
+ const existing = byNumber.get(record.pr.number);
165751
+ const row = existing ?? {
165752
+ id: record.id,
165753
+ repositoryId,
165754
+ number: record.pr.number,
165755
+ viewer,
165756
+ closedAt: null,
165757
+ onHeadMove: record.onHeadMove,
165758
+ attempts: []
165759
+ };
165760
+ row.attempts.push(...roundAttempts(record, row.attempts));
165761
+ row.attempts.sort((a, b) => a.createdAt.localeCompare(b.createdAt));
165762
+ if (record.state === "closed" && row.closedAt === null)
165763
+ row.closedAt = record.updatedAt;
165764
+ byNumber.set(record.pr.number, row);
165765
+ }
165766
+ return [...byNumber.values()];
165767
+ }
165768
+ var ROUND_ATTEMPT_STATE, sameRange2 = (a, b) => a.baseSha === b.baseSha && a.headSha === b.headSha;
165769
+ var init_review_state_rows = __esm(() => {
165770
+ ROUND_ATTEMPT_STATE = {
165771
+ planning: "running",
165772
+ dispatching: "running",
165773
+ reconciling: "running",
165774
+ paused: "cancelled",
165775
+ ready: "completed"
165776
+ };
165777
+ });
165778
+
165779
+ // src/commands/review-reviews.ts
165780
+ import { parseArgs as parseArgs11 } from "util";
165781
+ async function readReviews({ repo, repositories, query, compare, root = deskRunRoot(), compareBudgetMs = REVIEW_COMPARE_BUDGET_MS, includeClosed = false, projectRoot }) {
165782
+ const [owner, name] = repo.split("/");
165783
+ const identity = await query(identityQuery, { owner, name });
165784
+ const viewer = identity.viewer?.login;
165785
+ const repositoryId = identity.repository?.id;
165786
+ if (!viewer || !repositoryId)
165787
+ throw new Error("access: GitHub repository or account is unavailable.");
165788
+ const snapshot = { version: 1, repo, repositories, repositoryId, viewer, fetchedAt: new Date().toISOString(), reviews: [], warnings: [] };
165789
+ const records = projectRoot ? await sessionReviewRecords(projectRoot, repo, repositoryId, viewer, snapshot.warnings) : [];
165790
+ const rows = mergeReviewStateRows(readReviewRows(repositoryId, viewer, root), records, repositoryId, viewer).map((row) => ({ row, at: latestActivity(row) })).sort((a, b) => b.at.localeCompare(a.at) || b.row.number - a.row.number).map(({ row }) => row);
165791
+ if (!rows.length)
165792
+ return snapshot;
165793
+ const cards = await readCards(snapshot, includeClosed ? rows : rows.filter((row) => row.closedAt === null), query);
165794
+ const behind = rows.flatMap((row) => {
165795
+ const pair = headComparison(row, cards.get(row.number) ?? null);
165796
+ return pair && OBJECT_ID.test(pair.reviewed) && OBJECT_ID.test(pair.head) ? [{ id: row.id, ...pair }] : [];
165797
+ });
165798
+ if (behind.length > MAX_REVIEW_COMPARES)
165799
+ snapshot.warnings.push(`Commit counts are shown for ${MAX_REVIEW_COMPARES} Reviews behind their pull request. Refresh to read more.`);
165800
+ const comparisons = await compareHeads(behind.slice(0, MAX_REVIEW_COMPARES), compare, compareBudgetMs, snapshot.warnings);
165801
+ snapshot.reviews = rows.map((row) => summarizeReview(row, cards.get(row.number) ?? null, comparisons.get(row.id)));
165802
+ return snapshot;
165803
+ }
165804
+ async function sessionReviewRecords(projectRoot, repo, repositoryId, viewer, warnings) {
165805
+ try {
165806
+ const listing = await listReviewStates(projectRoot);
165807
+ if (listing.unreadable.length)
165808
+ warnings.push(`${listing.unreadable.length} session review record(s) could not be read.`);
165809
+ return listing.reviews.filter((record) => recordMatches(record, repo, repositoryId, viewer));
165810
+ } catch {
165811
+ warnings.push("Session reviews could not be read.");
165812
+ return [];
165813
+ }
165814
+ }
165815
+ async function readCards(snapshot, rows, query) {
165816
+ const numbers = [...new Set(rows.map((row) => row.number))];
165817
+ const batches = Array.from({ length: Math.ceil(numbers.length / CARD_BATCH) }, (_, i) => numbers.slice(i * CARD_BATCH, (i + 1) * CARD_BATCH));
165818
+ let unreadable = false;
165819
+ const read = await mapPool(batches, CARD_PARALLEL, async (batch) => {
165820
+ try {
165821
+ return await listActiveReviewCards(snapshot, batch, query);
165822
+ } catch (error) {
165823
+ if (cannotRetainData2(error))
165824
+ throw error;
165825
+ unreadable = true;
165826
+ return [];
165827
+ }
165828
+ }, { stopOnError: true });
165829
+ if (unreadable)
165830
+ snapshot.warnings.push("Some pull requests could not be loaded. Refresh to retry.");
165831
+ return new Map(read.flat().map((card) => [card.number, card]));
165832
+ }
165833
+ async function compareHeads(pairs, compare, budgetMs, warnings) {
165834
+ const deadline = Date.now() + budgetMs;
165835
+ let failed = false;
165836
+ let late = false;
165837
+ const compared = await mapPool(pairs, COMPARE_PARALLEL, async ({ id, reviewed, head }) => {
165838
+ const left = deadline - Date.now();
165839
+ if (left <= 0) {
165840
+ late = true;
165841
+ return null;
165842
+ }
165843
+ let timer;
165844
+ const expired = new Promise((resolve) => {
165845
+ timer = setTimeout(() => resolve("late"), left);
165846
+ });
165847
+ try {
165848
+ const result = await Promise.race([compare(reviewed, head), expired]);
165849
+ if (result === "late") {
165850
+ late = true;
165851
+ return null;
165852
+ }
165853
+ return [id, result];
165854
+ } catch {
165855
+ failed = true;
165856
+ return null;
165857
+ } finally {
165858
+ clearTimeout(timer);
165859
+ }
165860
+ });
165861
+ if (failed)
165862
+ warnings.push("Some commit counts could not be read. Refresh to retry.");
165863
+ if (late)
165864
+ warnings.push("Some commit counts took too long to read. Refresh to retry.");
165865
+ return new Map(compared.flatMap((entry) => entry ? [entry] : []));
165866
+ }
165867
+ function parseCompare(raw) {
165868
+ const value = JSON.parse(raw);
165869
+ if (typeof value?.status !== "string" || !compareStates.has(value.status) || !Number.isSafeInteger(value.ahead_by) || value.ahead_by < 0) {
165870
+ throw new Error("unavailable: GitHub returned an unreadable comparison.");
165871
+ }
165872
+ return { status: value.status, aheadBy: value.ahead_by };
165873
+ }
165874
+ async function runReviewReviews(args, cwd = process.cwd()) {
165875
+ if (args.length === 1 && (args[0] === "--help" || args[0] === "-h")) {
165876
+ console.log(REVIEWS_USAGE);
165877
+ return;
165878
+ }
165879
+ const { values } = parseArgs11({ args, strict: true, allowPositionals: false, options: { json: { type: "boolean" }, repo: { type: "string" }, "include-closed": { type: "boolean" } } });
165880
+ if (!values.json)
165881
+ throw new Error(REVIEWS_USAGE);
165882
+ const repositories = await reviewRepositories(cwd);
165883
+ const repo = selectRepository(repositories, values.repo);
165884
+ const auth = await projectGithubConnection(cwd);
165885
+ const result = await readReviews({
165886
+ repo,
165887
+ repositories,
165888
+ includeClosed: values["include-closed"] === true,
165889
+ projectRoot: cwd,
165890
+ query: (text, params) => boardGraphql(cwd, text, params, auth),
165891
+ compare: async (base, head) => parseCompare(await boardGh(cwd, ["api", "--hostname", "github.com", `repos/${repo}/compare/${base}...${head}?per_page=1`, "--jq", "{status, ahead_by}"], auth))
165892
+ });
165893
+ await writeBoundJson(result, auth);
165894
+ }
165895
+ var REVIEWS_USAGE = "keryx review reviews --json [--repo owner/name] [--include-closed]", MAX_REVIEW_COMPARES = 25, REVIEW_COMPARE_BUDGET_MS = 60000, COMPARE_PARALLEL = 4, CARD_BATCH = 20, CARD_PARALLEL = 3, OBJECT_ID, identityQuery = `query ReviewIdentity($owner:String!, $name:String!) { viewer { login } repository(owner:$owner,name:$name) { id } }`, cannotRetainData2 = (error) => error instanceof Error && /^(access|configuration):/.test(error.message), latestActivity = (row) => row.attempts.reduce((max, a) => a.createdAt > max ? a.createdAt : max, ""), compareStates;
165896
+ var init_review_reviews = __esm(() => {
165897
+ init_board();
165898
+ init_board_github();
165899
+ init_desk_run_store();
165900
+ init_review_entity();
165901
+ init_review_state();
165902
+ init_review_state_rows();
165903
+ OBJECT_ID = /^[0-9a-f]{40}$/;
165904
+ compareStates = new Set(["ahead", "behind", "diverged", "identical"]);
165905
+ });
165906
+
165907
+ // src/review/review-advance.ts
165908
+ function updateRoundOptions(options) {
165909
+ if (options === undefined)
165910
+ return;
165911
+ const { autoPublish: _automatic, ...rest } = options;
165912
+ return rest;
165913
+ }
165914
+ function reviewedAttempt(runs, id) {
165915
+ const candidates = runs.filter((run) => run.source !== "existing" && !withdrawn2(run));
165916
+ if (id !== undefined) {
165917
+ const named = candidates.find((run) => run.id === id);
165918
+ if (!named)
165919
+ throw new Error("stale: This attempt was archived, deleted or imported, so it cannot be updated. Update the review from its latest round.");
165920
+ return named;
165921
+ }
165922
+ const latest = [...candidates].sort((a, b) => (b.round ?? 0) - (a.round ?? 0) || b.createdAt.localeCompare(a.createdAt))[0];
165923
+ if (!latest)
165924
+ throw new Error("configuration: This pull request has no review to update. Start a review first.");
165925
+ return latest;
165926
+ }
165927
+ function advanceRequest({ reviewed, runs, current, prState }) {
165928
+ if (prState !== "OPEN")
165929
+ throw new Error("stale: This pull request is no longer open.");
165930
+ if (newerRoundOf(runs, reviewed) !== undefined) {
165931
+ throw new Error("stale: A later round of this Review already exists. Refresh the Review and update from its latest round.");
165932
+ }
165933
+ if (reviewed.baseSha === current.baseSha && reviewed.headSha === current.headSha) {
165934
+ throw new Error("configuration: This round already reviews the pull request's current head; there is nothing to update.");
165935
+ }
165936
+ const options = updateRoundOptions(reviewed.options);
165937
+ return { revision: current, ...options && { options } };
165938
+ }
165939
+ async function advanceReview(args, deps) {
165940
+ const { key, pr } = await deps.resolve(args.repo, args.number);
165941
+ if (args.repositoryId !== undefined && args.repositoryId !== key.repositoryId || args.viewer !== undefined && args.viewer.toLowerCase() !== key.viewer.toLowerCase()) {
165942
+ throw new Error("access: GitHub account or repository changed. Refresh the board.");
165943
+ }
165944
+ const current = { baseSha: pr.baseRefOid, headSha: pr.headRefOid };
165945
+ if (args.revision !== undefined && (args.revision.baseSha !== current.baseSha || args.revision.headSha !== current.headSha)) {
165946
+ throw new Error("stale: The pull request revision has changed. Refresh the board to review its current range.");
165947
+ }
165948
+ const runs = deps.history(key);
165949
+ const reviewed = reviewedAttempt(runs, args.id);
165950
+ const { revision, options } = advanceRequest({ reviewed, runs, current, prState: pr.state });
165951
+ return deps.start(key, revision, options);
165952
+ }
165953
+ var withdrawn2 = (run) => run.decision?.action === "delete" || run.decision?.action === "archive";
165954
+ var init_review_advance = __esm(() => {
165955
+ init_update_round();
165956
+ });
165957
+
165958
+ // src/commands/review-advance.ts
165959
+ import { parseArgs as parseArgs12 } from "util";
165960
+ async function runReviewAdvance(args, cwd = process.cwd()) {
165961
+ if (args.length === 1 && (args[0] === "--help" || args[0] === "-h")) {
165962
+ console.log(ADVANCE_USAGE);
165963
+ return;
165964
+ }
165965
+ const { values: v } = parseArgs12({
165966
+ args,
165967
+ strict: true,
165968
+ allowPositionals: false,
165969
+ options: {
165970
+ json: { type: "boolean" },
165971
+ repo: { type: "string" },
165972
+ number: { type: "string" },
165973
+ id: { type: "string" },
165974
+ "repository-id": { type: "string" },
165975
+ viewer: { type: "string" },
165976
+ base: { type: "string" },
165977
+ head: { type: "string" }
165978
+ }
165979
+ });
165980
+ const number = Number(v.number);
165981
+ if (!v.json || !v.repo || !/^[\w.-]+\/[\w.-]+$/.test(v.repo) || !v.number || !/^[1-9]\d*$/.test(v.number) || !Number.isSafeInteger(number) || v.id !== undefined && !uuid4.test(v.id) || v.base === undefined !== (v.head === undefined) || v.base !== undefined && (!sha6.test(v.base) || !sha6.test(v.head))) {
165982
+ throw new Error(ADVANCE_USAGE);
165983
+ }
165984
+ const snapshot = await advanceReview({
165985
+ repo: v.repo,
165986
+ number,
165987
+ id: v.id,
165988
+ repositoryId: v["repository-id"],
165989
+ viewer: v.viewer,
165990
+ ...v.base !== undefined && { revision: { baseSha: v.base, headSha: v.head } }
165991
+ }, {
165992
+ resolve: async (repo, pr) => resolveDeskSubject(cwd, repo, pr, await projectGithubConnection(cwd)),
165993
+ history: (key) => {
165994
+ const store = new DeskRunStore;
165995
+ try {
165996
+ return store.history(key).runs;
165997
+ } finally {
165998
+ store.close();
165999
+ }
166000
+ },
166001
+ start: async (key, revision, options) => {
166002
+ await Promise.resolve().then(() => init_review_desk_provider());
166003
+ return requestDeskRun(cwd, key, { action: "start", revision, ...options && { options } }, resolveDeskReviewOptions);
166004
+ }
166005
+ });
166006
+ await new Promise((resolve, reject) => process.stdout.write(JSON.stringify(snapshot) + `
166007
+ `, (error) => error ? reject(error) : resolve()));
166008
+ }
166009
+ var ADVANCE_USAGE = "keryx review advance --json --repo owner/name --number N [--id UUID] [--repository-id ID --viewer LOGIN] [--base SHA --head SHA]", sha6, uuid4;
166010
+ var init_review_advance2 = __esm(() => {
166011
+ init_board_github();
166012
+ init_desk_run_store();
166013
+ init_desk_run_service();
166014
+ init_review_advance();
166015
+ sha6 = /^[0-9a-f]{40}$/;
166016
+ uuid4 = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/i;
166017
+ });
166018
+
165804
166019
  // src/commands/review-state.ts
165805
166020
  import { parseArgs as parseArgs13 } from "util";
165806
166021
  function usageError(message) {
@@ -246616,11 +246831,11 @@ var init_background_job_inspector = __esm(() => {
246616
246831
  });
246617
246832
 
246618
246833
  // src/tui/sidebar-work.ts
246619
- function oneLine9(text) {
246834
+ function oneLine10(text) {
246620
246835
  return text.replace(/\s+/g, " ").trim();
246621
246836
  }
246622
246837
  function shortLabel(text, max = DETAIL_LABEL_CHARS) {
246623
- const line = oneLine9(text);
246838
+ const line = oneLine10(text);
246624
246839
  return line.length <= max ? line : `${line.slice(0, Math.max(1, max - 1))}\u2026`;
246625
246840
  }
246626
246841
  function jobMeta(job) {
@@ -25207,6 +25207,10 @@ function mergePremises(findings, parsedInput) {
25207
25207
  reject("challenged-without-evidence", "`challenged` needs at least one intent signal (a cited ref) or practice source (a named guideline). A challenge with neither is the reviewer's argument turned around.");
25208
25208
  continue;
25209
25209
  }
25210
+ if (verdict === "owner-decision" && (signals.value?.length ?? 0) + (sources.value?.length ?? 0) === 0) {
25211
+ reject("owner-decision-without-evidence", "`owner-decision` needs at least one intent signal (a cited ref: the PR body, a code line, a commit) or practice source (a named rule) showing the choice is the owner's. Without one the finding goes on as reported: use `upheld`.");
25212
+ continue;
25213
+ }
25210
25214
  if (!present(claim.question)) {
25211
25215
  reject("held-without-question", `\`${verdict}\` holds the finding for the operator, who needs a question to answer.`);
25212
25216
  continue;
@@ -25702,7 +25706,7 @@ function parseReviewResult(reply) {
25702
25706
  const raw = splitUsage(reply).body;
25703
25707
  const labelled = labelledFence(raw);
25704
25708
  if (labelled !== undefined)
25705
- return labelled.result ?? lenientReviewResult(raw.slice(labelled.at));
25709
+ return labelled.result ?? lenientReviewResult(raw.slice(labelled.at)) ?? statusLineResult(raw);
25706
25710
  const marked = afterMarker(raw)?.result;
25707
25711
  if (marked !== undefined)
25708
25712
  return marked;
@@ -25714,12 +25718,48 @@ function parseReviewResult(reply) {
25714
25718
  const strict = scannedResult(raw);
25715
25719
  if (strict !== undefined)
25716
25720
  return strict;
25717
- return lenientReviewResult(raw);
25721
+ return lenientReviewResult(raw) ?? statusLineResult(raw);
25722
+ }
25723
+ function lacksOnlyStatus(value) {
25724
+ if (value === null || typeof value !== "object" || Array.isArray(value))
25725
+ return false;
25726
+ const object = value;
25727
+ return object.status === undefined && (typeof object.reviewer === "string" || Array.isArray(object.findings));
25728
+ }
25729
+ function statusLineResult(raw) {
25730
+ const inFence = fenceTester(raw);
25731
+ const statuses = new Set([...raw.matchAll(STATUS_LINE)].filter((line) => !inFence(line.index)).map((line) => line[1]));
25732
+ if (statuses.size !== 1)
25733
+ return;
25734
+ const status = [...statuses][0];
25735
+ const withStatus = (value) => ({ ...value, status });
25736
+ const labelled = [...raw.matchAll(/```REVIEW_RESULT[ \t]*\r?\n([\s\S]*?)```/gi)];
25737
+ if (labelled.length > 0) {
25738
+ const parsed = tryParse2(labelled[labelled.length - 1][1]);
25739
+ return lacksOnlyStatus(parsed) ? withStatus(parsed) : undefined;
25740
+ }
25741
+ const markers = [...raw.matchAll(MARKER)].filter((marker) => !inFence(marker.index)).slice(-MAX_MARKERS);
25742
+ for (let at = markers.length - 1;at >= 0; at -= 1) {
25743
+ const start = markers[at].index + markers[at][0].length;
25744
+ const { end } = objectEnd(raw, start);
25745
+ if (end === undefined)
25746
+ continue;
25747
+ const parsed = tryParse2(raw.slice(start, end + 1));
25748
+ if (lacksOnlyStatus(parsed))
25749
+ return withStatus(parsed);
25750
+ }
25751
+ const { found, truncated } = topLevelObjects(raw);
25752
+ if (truncated)
25753
+ return;
25754
+ const shaped = found.filter(({ value }) => lacksOnlyStatus(value));
25755
+ const fenced = shaped.filter(({ start }) => inFence(start));
25756
+ const chosen = (fenced.length > 0 ? fenced : shaped).at(-1)?.value;
25757
+ return lacksOnlyStatus(chosen) ? withStatus(chosen) : undefined;
25718
25758
  }
25719
25759
  function isEmptyOutput(reply) {
25720
25760
  return isEmptyRecord(reply);
25721
25761
  }
25722
- var FINISHED, CLOSED, OBJECT_START, RESULT_KEYS, KEY_COLON, MAX_UNCLOSED = 64, FENCE_OPEN, FENCE_CLOSE, LINE_CLOSE, MAX_MARKERS = 64, MARKER, AUDIT_ROLES;
25762
+ var FINISHED, CLOSED, OBJECT_START, RESULT_KEYS, KEY_COLON, MAX_UNCLOSED = 64, FENCE_OPEN, FENCE_CLOSE, LINE_CLOSE, MAX_MARKERS = 64, MARKER, RESULT_STATUSES, STATUS_LINE, AUDIT_ROLES;
25723
25763
  var init_ledger = __esm(() => {
25724
25764
  init_coverage();
25725
25765
  init_coverage_complete();
@@ -25741,6 +25781,8 @@ var init_ledger = __esm(() => {
25741
25781
  FENCE_CLOSE = /^ {0,3}(`{3,})[ \t]*$/;
25742
25782
  LINE_CLOSE = /^ {0,3}```[ \t]*\r?$/gm;
25743
25783
  MARKER = /(?<![^\n])[ \t>*#-]*REVIEW_RESULT(?:[ \t]*[:=])?\s*(?=\{)/g;
25784
+ RESULT_STATUSES = ["DONE_WITH_CONCERNS", "DONE", "NEEDS_CONTEXT", "BLOCKED"];
25785
+ STATUS_LINE = new RegExp(`(?<![^\\n])[ \\t>*_#-]*STATUS[*_]*:[*_ \\t]*(${RESULT_STATUSES.join("|")})\\b`, "g");
25744
25786
  AUDIT_ROLES = new Set(DEEP_ROLES.filter((role) => role !== ALWAYS_ROLE));
25745
25787
  });
25746
25788
 
@@ -29370,6 +29412,10 @@ function reviewPackagePaths(text) {
29370
29412
  floor = end;
29371
29413
  }
29372
29414
  }
29415
+ var LOOKUP_SUBCOMMANDS = new Set(["", "pr-context", "board", "reviews", "accounts", "help", "--help", "-h"]);
29416
+ function continuesReview(invocation) {
29417
+ return !LOOKUP_SUBCOMMANDS.has(invocation.subcommand) && !invocation.args.some((arg) => arg === "--help" || arg === "-h");
29418
+ }
29373
29419
  var OPENING_SUBCOMMANDS = new Set(["start", "attach", "ingest"]);
29374
29420
  var PACKAGE_ARG_SUBCOMMANDS = new Set(["status", "readiness", "complete", "attach", "publish", "verdict", "show"]);
29375
29421
  var VALUELESS_FLAGS = new Set([
@@ -29708,7 +29754,8 @@ class SessionReviewTracker {
29708
29754
  continue;
29709
29755
  const cwd = path68.resolve(this.cwd);
29710
29756
  for (const invocation of keryxReviewInvocations(command, cwd)) {
29711
- this.runSeen = true;
29757
+ if (continuesReview(invocation))
29758
+ this.runSeen = true;
29712
29759
  if (invocation.cwd !== cwd && inside2(cwd, invocation.cwd))
29713
29760
  remember(this.roots, invocation.cwd, MAX_SESSION_REVIEW_ROOTS);
29714
29761
  for (const arg of invocation.args)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/keryx",
3
- "version": "0.4.60",
3
+ "version": "0.4.61",
4
4
  "description": "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -169,7 +169,7 @@ Mutation outside an action, async resolution without `runInAction`, and inter-st
169
169
 
170
170
  ## Orchestrated Review Contract
171
171
 
172
- When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
172
+ When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object (it carries its own `status`, the same value as your `STATUS:` line) compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
173
173
 
174
174
  ---
175
175
 
@@ -160,7 +160,7 @@ is, and a condition that cannot name one is not a `blocker`.
160
160
 
161
161
  ## Orchestrated Review Contract
162
162
 
163
- When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
163
+ When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object (it carries its own `status`, the same value as your `STATUS:` line) compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
164
164
 
165
165
  ---
166
166
 
@@ -114,7 +114,7 @@ Where an issue or PR is cited, check it is the right one and still says what the
114
114
 
115
115
  ## Orchestrated Review Contract
116
116
 
117
- When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
117
+ When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object (it carries its own `status`, the same value as your `STATUS:` line) compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
118
118
 
119
119
  ## Finding Format
120
120
 
@@ -64,7 +64,7 @@ Read the review activity rule before the code: `.metaproject/rules/project/activ
64
64
 
65
65
  ## Orchestrated Review Contract
66
66
 
67
- When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
67
+ When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object (it carries its own `status`, the same value as your `STATUS:` line) compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
68
68
 
69
69
  ---
70
70
 
@@ -89,7 +89,7 @@ Read the review activity rule before the code: `.metaproject/rules/project/activ
89
89
 
90
90
  ## Orchestrated Review Contract
91
91
 
92
- When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
92
+ When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object (it carries its own `status`, the same value as your `STATUS:` line) compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
93
93
 
94
94
  ---
95
95
 
@@ -291,7 +291,7 @@ When dispatched by `review-orchestrator` or `job-orchestrator`, the prompt MAY c
291
291
 
292
292
  ## Orchestrated Review Contract
293
293
 
294
- When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
294
+ When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object (it carries its own `status`, the same value as your `STATUS:` line) compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
295
295
 
296
296
  ---
297
297
 
@@ -99,7 +99,7 @@ Read the review activity rule before the code: `.metaproject/rules/project/activ
99
99
 
100
100
  ## Orchestrated Review Contract
101
101
 
102
- When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
102
+ When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object (it carries its own `status`, the same value as your `STATUS:` line) compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
103
103
 
104
104
  ---
105
105
 
@@ -215,7 +215,7 @@ Migrations and indexes are `database-patterns.mdc`; query shape is `review-perfo
215
215
 
216
216
  ## Orchestrated Review Contract
217
217
 
218
- When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
218
+ When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object (it carries its own `status`, the same value as your `STATUS:` line) compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
219
219
 
220
220
  ---
221
221
 
@@ -194,7 +194,7 @@ earlier review round, because there the finding is recorded as closed and is not
194
194
 
195
195
  ## Orchestrated Review Contract
196
196
 
197
- When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing. On a FIX slice, also return `prior_dispositions: [{id, disposition}]` for every attached finding id.
197
+ When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object (it carries its own `status`, the same value as your `STATUS:` line) compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing. On a FIX slice, also return `prior_dispositions: [{id, disposition}]` for every attached finding id.
198
198
 
199
199
  ---
200
200
 
@@ -131,10 +131,10 @@ Publish this checklist with `plan_set` under the ids `step-0`…`step-14` and `s
131
131
 
132
132
  - One `Agent` call per reviewer, all calls of a wave in a single message, so the wave runs in parallel.
133
133
  - Reviewers are read-only: they read the diff and the files and run only the read-only commands: `git log`, `git blame` and `git show` (law 4; `review-premise` too) where the host gives a read-only child git. keryx shell does not: a `spawn_subagent` child has no shell and no git tool, so you run `git log -L <start>,<end>:<file>` and `git blame -L <start>,<end> <file>` for each deliberate-looking site a reviewer must judge and pass the output in `context_files`; with neither, the reviewer says the history was not read. Beyond those, a reviewer runs only the layers-block commands (`keryx gdgraph affected|find`, `keryx test related`, `keryx wiki ask`, `keryx memory search`) and `keryx ctx rg|read`, never tests, health checks, servers, mutation or any command that writes in the reviewed tree: that evidence comes from you (`keryx review verify-run --timeout <seconds>`, `keryx review mutate`), the verifier, or the one testing reviewer with `run-tests`, in a scratch copy and a time budget. Each payload carries `allowed_tools` (`read-only` or `run-tests`) and `exec_budget_s`.
134
- - Use the reviewer's exact `subagent_type`. If the runtime has no such type, use `general-purpose` and name the reviewer's `SKILL.md` path in the prompt. Neither available: that reviewer is `BLOCKED`.
134
+ - Use the reviewer's exact `subagent_type`. If the runtime has no such type, use `general-purpose` and name the reviewer's `SKILL.md` path in the prompt. Neither available: that reviewer is `BLOCKED`. A child that runs in a checkout outside the project (a worktree at the head, a scratch copy) cannot read the project's `.metaproject/skills`: pass the reviewer's `SKILL.md` (the verifier's and the premise judge's too) in `context_files`, so it works from its contract and not from your paraphrase.
135
135
  - Build every payload and prompt from "Reviewer brief — required contents" below, and tick it off per dispatch before the wave goes.
136
136
  - Prompts carry pointers, not pasted files — the diff, the SHAs, the PR, the schema paths — and never paraphrase a contract. On keryx shell the slices travel in `context_files` instead (below). Run `keryx review dispatch-check --payload <file> --manifest <package>/slices/manifest.json --package <package>` on every payload before a mass dispatch; on exit 1 fix the payload it names and do not dispatch around it (no slice, over the wave ceiling: dispatch fewer slices, a missing `skill_path` or `context_doc`, an unconfirmed plan, a schema break, no `pr_context` with `--pr-context`).
137
- - A reply is a result only if it starts with a `STATUS:` line and carries a `REVIEW_RESULT` block matching `reviewer-finding.schema.json`; anything else is `BLOCKED`. The one exception: a reply or dispatch error of `STATUS: RATE_LIMITED` is handled by the Rate limits rule under Control, never marked `BLOCKED`.
137
+ - A reviewer's reply is a result only if it starts with a `STATUS:` line and carries a `REVIEW_RESULT` block matching `reviewer-finding.schema.json`, whose object holds the same `status` (keryx reads the line when the object leaves it out); anything else is `BLOCKED`. The verifier and the premise judge are not reviewers: their results are `verification-claim.schema.json` and the one `keryx:premises` block. The one exception: a reply or dispatch error of `STATUS: RATE_LIMITED` is handled by the Rate limits rule under Control, never marked `BLOCKED`.
138
138
  - The model comes from `keryx review tier` (Step 6). On `spawn_subagent` pass its tier as `model_tier` on every reviewer — `review-verifier` and simple reviewers `light`, normal `standard`, complex reviewers and `review-premise` `deep` (`keryx review tier --premise`); an omitted tier runs the child on your own model.
139
139
 
140
140
  ### Reviewer brief — required contents (every dispatch)
@@ -173,7 +173,7 @@ One payload file per dispatch (`reviewer-input.schema.json`) plus one prompt. Ea
173
173
  - [ ] W Counterpart rules and round obligations: point to `SKILL.detail.md` § "Counterpart verification" and § "Round obligations" by path ← Start question 2.
174
174
  - [ ] X Scope-B reviewer: `keryx review blast-radius … --brief` stdout verbatim; `review-degradation`: the `--degradation` stdout verbatim ← "Scope B".
175
175
  - [ ] Y Write the whole reply to the driver's `result` (`<package>/raw/<reviewer>…txt`) before answering ← line S.
176
- - [ ] Z Start with a `STATUS:` line and return a `REVIEW_RESULT` per `reviewer-finding.schema.json`, listing as `slices` the ids it read in full ← "Slices, waves and results" 3.
176
+ - [ ] Z Start with a `STATUS:` line and return a `REVIEW_RESULT` per `reviewer-finding.schema.json` with the same `status` inside it, listing as `slices` the ids it read in full ← "Slices, waves and results" 3.
177
177
 
178
178
  ## Slices, waves and results — every host; keryx shell specifics marked
179
179
 
@@ -640,8 +640,8 @@ Dispatch rules:
640
640
  A finding can reproduce and still not be a defect. `review-premise` asks the other question, on the deep tier and a clean context: intent, accepted practice, consistency, fix soundness.
641
641
  - Before dispatch, renumber any display id that another finding, carried or new, already has, in the saved reviewer results, so the judge, its claims and ingest all see the same ids (ingest refuses two findings under one key; a claim naming a shared id is rejected as `ambiguous-finding`).
642
642
  - Dispatch it once after the last verifier pass (no verifier ran: after the last reviewer), over the canonical findings of severity ≥ minor, each with its display `id`, the **real** `reviewer` and `source`, and, for a finding carried from an earlier round, its `global_id`. External (PR-comment, `source: external`) findings are included: they can be challenged, never downgraded. In a delta round only findings without a carried premise. On keryx shell the judge has no shell and no git tool: run `git log -L` and `git blame -L` for each cited site first and pass the output in `context_files`.
643
- - Save its claims object unchanged to `research-evidence/premises.json` (the verdict reads it there) and pass that file with `keryx review ingest --premises <file>`; never apply verdicts by hand.
644
- - `challenged` and `owner-decision` **hold** a finding: it is neither fixable nor clean — not an open blocker or major, never in a fix loop's `fix_context.review_feedback`, and it blocks until answered; the verdict lists it as awaiting the operator. **Asking about a held finding** (every skill that meets one points here): at the tail, after `ingest --premises` wrote `findings.json` (never during Wave D, before the ingest: the answer commands read `findings.json`), in keryx shell call the card `review_decide_premise`, which records the answer; elsewhere put its `question` and `options` to the operator with the host's question tool (`uphold` or `dismiss`, the finding id in the question; never send them to a terminal), then record what they chose: `keryx review decide-premise --package <package> --finding <global_id> --answer uphold|dismiss --reason "<why>" --answered-by <source>:<ref> --answer-text "<their words, verbatim>" --question-text "<the question as asked>"` (`confirmedVia: "host-question"`; "Hosts", Operator decisions). Record only an answer they gave and never write their words or their reason yourself. In a flow, journal the recorded answer. Unattended: leave it held and report it.
643
+ - Save its claims object unchanged to `research-evidence/premises.json` (the verdict reads it there) and pass that file with `keryx review ingest --premises <file>`; never apply verdicts by hand. Unchanged means the JSON of the judge's one `keryx:premises` block exactly as it wrote it: never rewrite, reshape or add to it, and never write a `question`, `options`, `intent_signals`, `practice_sources` or `reasoning` yourself. A claim ingest rejects stays rejected, and its finding goes on as reported; a reply with no readable `keryx:premises` block is dispatched again once with the refusal, or recorded as `Not run: premise (<reason>)`.
644
+ - `challenged` and `owner-decision` **hold** a finding: it is neither fixable nor clean — not an open blocker or major, never in a fix loop's `fix_context.review_feedback`, and it blocks until answered; the verdict lists it as awaiting the operator. **Asking about a held finding** (every skill that meets one points here): at the tail, after `ingest --premises` wrote `findings.json` (never during Wave D, before the ingest: the answer commands read `findings.json`), in keryx shell call the card `review_decide_premise`, which records the answer; elsewhere put the judge's `question` and `options`, word for word, to the operator with the host's question tool (`uphold` or `dismiss`, the finding id in the question; never send them to a terminal), then record what they chose: `keryx review decide-premise --package <package> --finding <global_id> --answer uphold|dismiss --reason "<why>" --answered-by <source>:<ref> --answer-text "<their words, verbatim>" --question-text "<the question as asked>"` (`confirmedVia: "host-question"`; "Hosts", Operator decisions). Record only an answer they gave and never write their words or their reason yourself. In a flow, journal the recorded answer. Unattended: leave it held and report it.
645
645
 
646
646
  ### `verification_mode`
647
647
 
@@ -308,7 +308,7 @@ When dispatched by `review-orchestrator` or `job-orchestrator`, the prompt MAY c
308
308
 
309
309
  ## Orchestrated Review Contract
310
310
 
311
- When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
311
+ When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object (it carries its own `status`, the same value as your `STATUS:` line) compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
312
312
 
313
313
  <!-- keryx:layers-block:start -->
314
314
  ## Project layers: graph, tests, wiki, memory
@@ -92,7 +92,7 @@ judgement on it; the claim and the code read first let you see what the reviewer
92
92
  | `upheld` | The premise stands; the finding goes on unchanged. | — |
93
93
  | `downgraded` | A defect, but intent or practice shows it is smaller than reported. Never for a `minor`, an external or a `review-security-code` finding: hold those with `challenged` or `owner-decision` instead. | `severity`, strictly lower and never below `minor`, and ≥1 `intent_signals` or `practice_sources` |
94
94
  | `challenged` | Evidence says it is not a defect. | ≥1 `intent_signals` or `practice_sources`, and a `question` |
95
- | `owner-decision` | A product choice the code cannot settle either way. | a `question` and ≥2 `options` |
95
+ | `owner-decision` | A product choice the code cannot settle either way. | ≥1 `intent_signals` or `practice_sources` showing the choice is the owner's, a `question` and ≥2 `options` |
96
96
 
97
97
  `challenged` and `owner-decision` **hold** the finding: it does not count as an open
98
98
  blocker or major, it is not sent to a fixer, and the verdict lists it as awaiting the
@@ -107,7 +107,7 @@ signal and no practice source against it is upheld.
107
107
  | **You can only lower or hold.** No new finding, no raised severity, no edit to a finding's text. | The merge builds the record from the original finding and takes only your verdict; a claim carrying more is rejected (`unknown-property`), an entry that is no object too (`malformed-claim`). |
108
108
  | **Never judge your own finding.** | The merge rejects a judge equal to the reporter (`self-judgement`). |
109
109
  | **Claim first, argument second.** | The case passed two reviews that read the fix's argument and never the premise. |
110
- | **`challenged` cites.** Each intent signal names its `ref` (`file:line` or a SHA) and what it says; each practice source names the guideline and section precisely enough to look up. | An uncited challenge is rejected and the finding stays as reported. Never invent a quote. |
110
+ | **A hold cites, and only you write it.** A `challenged` or `owner-decision` claim carries ≥1 intent signal (its `ref`, `file:line` or a SHA, and what it says) or practice source (the guideline and section, precise enough to look up); its `question`, `options` and signals are yours, and the caller saves your block as it is. | The operator is asked only on your grounded reason: an uncited hold is rejected (`challenged-without-evidence`, `owner-decision-without-evidence`) and the finding stays as reported. Never invent a quote. |
111
111
  | **Never re-grade by the rubric.** Severity is the reviewer's and the verifier's call; a test gap or a surviving mutant stays as reported unless intent or practice shrinks it, and a minor is upheld or challenged, never downgraded. | An uncited downgrade is rejected (`downgrade-without-evidence`). Minors matter: a finding you weaken is one nobody fixes. |
112
112
  | **Read-only.** Read files; run nothing but `git log`, `git blame` and `git show` (only where your host gives a read-only child git). On keryx shell you have no shell and no git tool: read the history excerpts in `context_files`, or say the history was not read. | Executing is the verifier's job; this judgement is about meaning. |
113
113
  | **An external finding, and a `review-security-code` finding, is held or upheld, never dismissed or downgraded.** | A human asked; the operator answers them. Severity of a security finding measures exposure, which intent does not lower. The merge rejects the downgrade (`external-downgrade`, `security-downgrade`). |
@@ -332,7 +332,7 @@ When dispatched by `review-orchestrator` or `job-orchestrator`, the prompt MAY c
332
332
 
333
333
  ## Orchestrated Review Contract
334
334
 
335
- When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
335
+ When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object (it carries its own `status`, the same value as your `STATUS:` line) compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
336
336
 
337
337
  ---
338
338
 
@@ -173,7 +173,7 @@ Read the review activity rule before the code: `.metaproject/rules/project/activ
173
173
 
174
174
  ## Orchestrated Review Contract
175
175
 
176
- When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
176
+ When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object (it carries its own `status`, the same value as your `STATUS:` line) compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
177
177
 
178
178
  ---
179
179
 
@@ -182,7 +182,7 @@ Read the review activity rule before the code: `.metaproject/rules/project/activ
182
182
 
183
183
  ## Orchestrated Review Contract
184
184
 
185
- When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
185
+ When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object (it carries its own `status`, the same value as your `STATUS:` line) compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
186
186
 
187
187
  ---
188
188