crysk 0.6.1 → 0.8.0

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.
Files changed (179) hide show
  1. package/README.md +28 -22
  2. package/dist/SKILL-1q3658n0.md +74 -0
  3. package/dist/SKILL-25j4q9b8.md +143 -0
  4. package/dist/SKILL-32cmme3j.md +143 -0
  5. package/dist/SKILL-4747bhne.md +143 -0
  6. package/dist/SKILL-4jc3sv23.md +74 -0
  7. package/dist/SKILL-c0492rch.md +540 -0
  8. package/dist/SKILL-d1nzkhhr.md +74 -0
  9. package/dist/SKILL-f8p7kvx0.md +143 -0
  10. package/dist/SKILL-gxd45g38.md +553 -0
  11. package/dist/SKILL-rec41991.md +66 -0
  12. package/dist/SKILL-zze8zj5g.md +536 -0
  13. package/dist/adjudicator-eckqh14e.md +78 -0
  14. package/dist/ci-admission-qn797a6c.md +128 -0
  15. package/dist/cli.js +18608 -18523
  16. package/dist/consolidate-4xw1pkg7.md +24 -0
  17. package/dist/deep-review-logic-dgr112y1.md +196 -0
  18. package/dist/deep-review-logic-fck5z4xe.md +197 -0
  19. package/dist/deep-review-logic-h1fpamfh.md +192 -0
  20. package/dist/deep-review-logic-m4vk5683.md +196 -0
  21. package/dist/deep-review-logic-z63kmgmc.md +157 -0
  22. package/dist/deep-review-parity-7x7s5d81.md +148 -0
  23. package/dist/deep-review-parity-9wxmynsc.md +115 -0
  24. package/dist/deep-review-parity-bwwe7cx6.md +152 -0
  25. package/dist/deep-review-parity-e50pw3pk.md +117 -0
  26. package/dist/deep-review-parity-ennmm9m1.md +151 -0
  27. package/{prompts/default/deep-review-parity.md → dist/deep-review-parity-h7y6y2he.md} +14 -16
  28. package/dist/deep-review-parity-xg6wy69c.md +151 -0
  29. package/dist/deep-review-reliability-6h3c4gmw.md +125 -0
  30. package/dist/deep-review-reliability-dcjab69x.md +122 -0
  31. package/dist/deep-review-reliability-ec7b5pbk.md +159 -0
  32. package/dist/deep-review-reliability-hvasvmt9.md +153 -0
  33. package/dist/deep-review-reliability-mjnayxmt.md +158 -0
  34. package/dist/deep-review-reliability-mm7fnayf.md +124 -0
  35. package/dist/deep-review-reliability-xk4xvc2w.md +158 -0
  36. package/dist/deep-review-resilience-0esd5qeh.md +148 -0
  37. package/dist/deep-review-resilience-envgcmpy.md +115 -0
  38. package/dist/deep-review-resilience-fgx8ythf.md +151 -0
  39. package/dist/deep-review-resilience-mq5qa6ad.md +152 -0
  40. package/dist/deep-review-resilience-pwh1gawp.md +151 -0
  41. package/dist/deep-review-resilience-s9n21dkx.md +117 -0
  42. package/dist/deep-review-resilience-vz4qskea.md +119 -0
  43. package/dist/deep-review-security-1vwjdc9q.md +205 -0
  44. package/dist/deep-review-security-x1cc1z00.md +205 -0
  45. package/dist/index.js +590 -485
  46. package/dist/opencode-ci-jc8mf4wn.md +106 -0
  47. package/dist/opencode-ci-qrcv7a99.md +106 -0
  48. package/dist/opencode-ci-rdpcc7xc.md +106 -0
  49. package/dist/opencode-ci-yt0k74t0.md +106 -0
  50. package/dist/review-refuter-7qffwtzz.md +77 -0
  51. package/dist/verifier-tyh8r45v.md +40 -0
  52. package/dist/verifier-xf4xj701.md +40 -0
  53. package/dist/workflow-andv2dvm.yml +158 -0
  54. package/package.json +1 -1
  55. package/prompts/consolidate.md +1 -1
  56. package/prompts/default/PROVENANCE.md +6 -0
  57. package/prompts/default/deep-review-logic.md +56 -15
  58. package/prompts/default/deep-review-reliability.md +64 -30
  59. package/prompts/default/deep-review-resilience.md +71 -37
  60. package/prompts/default/deep-review-security.md +205 -0
  61. package/prompts/default/review-refuter.md +1 -1
  62. package/prompts/verifier.md +40 -0
  63. package/skills/crysk/SKILL.md +6 -6
  64. package/skills/crysk-ci-setup/SKILL.md +32 -33
  65. package/skills/crysk-ci-setup/assets/workflow.yml +5 -10
  66. package/skills/crysk-ci-setup/references/ci-admission.md +5 -5
  67. package/skills/crysk-ci-setup/references/opencode-ci.md +6 -6
  68. package/skills/crysk-loop/SKILL.md +37 -54
  69. package/skills/crysk-loop/adjudicator.md +10 -18
  70. package/skills/crysk-pr/SKILL.md +1 -1
  71. package/src/asset-manifest.ts +6 -6
  72. package/src/assets.ts +4 -4
  73. package/src/brand.ts +20 -30
  74. package/src/ci/gates.ts +155 -192
  75. package/src/ci/outcome.ts +4 -31
  76. package/src/ci/platform-limits.ts +135 -0
  77. package/src/ci/platform-report.ts +212 -126
  78. package/src/ci/platform.ts +28 -26
  79. package/src/ci/reporter.ts +25 -26
  80. package/src/ci/review-admission.ts +1 -2
  81. package/src/ci/review-levels.ts +12 -53
  82. package/src/ci/setup.ts +96 -66
  83. package/src/ci/trace-bundle.ts +11 -27
  84. package/src/ci/trace-transcripts.ts +4 -6
  85. package/src/ci/trigger.ts +3 -5
  86. package/src/cli.ts +6 -5
  87. package/src/commands/ci-setup-questions.ts +2 -55
  88. package/src/commands/ci-setup.ts +2 -26
  89. package/src/commands/triage.ts +131 -38
  90. package/src/commands/usage.ts +0 -1
  91. package/src/compare/compare.ts +3 -3
  92. package/src/compare/floor-test.ts +30 -201
  93. package/src/compare/hunter-exam.ts +631 -0
  94. package/src/config/config.ts +6 -30
  95. package/src/diversity/accounting.ts +0 -26
  96. package/src/diversity/benchmark.ts +1 -17
  97. package/src/diversity/identity.ts +0 -14
  98. package/src/diversity/pipeline-integration.ts +0 -29
  99. package/src/doctor.ts +3 -6
  100. package/src/execution/claude-session-trace.ts +7 -2
  101. package/src/execution/contracts.ts +15 -9
  102. package/src/execution/harness.ts +165 -187
  103. package/src/execution/spend-limiter.ts +39 -131
  104. package/src/execution/usage-facts.ts +397 -0
  105. package/src/execution/usage-normalized.ts +33 -86
  106. package/src/harness/materiality-judge.ts +0 -5
  107. package/src/harness/pipeline-plan.ts +0 -3
  108. package/src/harness/replay-rows.ts +0 -5
  109. package/src/harness/route-runner.ts +2 -2
  110. package/src/harness/single-step.ts +3 -9
  111. package/src/index.ts +1 -1
  112. package/src/mcp/preflight.ts +2 -2
  113. package/src/model/catalog.ts +1 -3
  114. package/src/model/free-discovery.ts +11 -78
  115. package/src/model/model-name.ts +16 -5
  116. package/src/model/profiles/claude.ts +1 -2
  117. package/src/model/profiles/openai.ts +1 -2
  118. package/src/model/profiles.ts +2 -3
  119. package/src/model/provider-capabilities.ts +16 -55
  120. package/src/model/routing.ts +39 -36
  121. package/src/pr/admission.ts +6 -6
  122. package/src/pr/answered-findings.ts +8 -4
  123. package/src/pr/ci-publish.ts +0 -2
  124. package/src/pr/discovery.ts +4 -25
  125. package/src/pr/plan.ts +40 -121
  126. package/src/pr/pr-status.ts +14 -2
  127. package/src/pr/pr.ts +1 -1
  128. package/src/pr/preflight.ts +44 -15
  129. package/src/pr/publish-outcome.ts +1 -19
  130. package/src/pr/review-pr.ts +15 -47
  131. package/src/pr/target.ts +76 -82
  132. package/src/production-runtime.ts +52 -114
  133. package/src/progress.ts +0 -54
  134. package/src/rereview/prepare.ts +4 -1
  135. package/src/rereview/state.ts +1 -1
  136. package/src/rereview/verify.ts +15 -9
  137. package/src/review/boundary.ts +5 -8
  138. package/src/review/drafts.ts +3 -3
  139. package/src/review/findings-conformance.ts +1 -1
  140. package/src/review/findings.ts +0 -4
  141. package/src/review/pipeline.ts +194 -407
  142. package/src/review/preflight.ts +175 -201
  143. package/src/review/prompt-set.ts +1 -2
  144. package/src/review/report.ts +2 -162
  145. package/src/review/review.ts +25 -74
  146. package/src/review/route-preflight.ts +19 -35
  147. package/src/review/run.ts +37 -73
  148. package/src/review/size-gate.ts +3 -3
  149. package/src/review/spec.ts +6 -11
  150. package/src/review/step-runner.ts +4 -4
  151. package/src/runner-authority.ts +10 -9
  152. package/src/security/credential-broker.ts +5 -6
  153. package/src/server/preflight.ts +0 -1
  154. package/src/server/server.ts +17 -6
  155. package/src/store/activity.ts +1 -2
  156. package/src/store/backfill-preflight.ts +0 -3
  157. package/src/store/backfill.ts +0 -1
  158. package/src/store/metrics-preflight.ts +4 -14
  159. package/src/store/metrics.ts +5 -5
  160. package/src/store/preflight.ts +0 -13
  161. package/src/store/store.ts +11 -12
  162. package/src/transport-registry.ts +6 -30
  163. package/src/transports/claude-code-cli.ts +149 -215
  164. package/src/transports/opencode-client.ts +4 -24
  165. package/src/transports/opencode-sdk.ts +17 -112
  166. package/src/triage/plain-reply.ts +37 -0
  167. package/src/ui/activity.ts +1 -6
  168. package/src/ui/config-edit.ts +14 -67
  169. package/src/ui/config.ts +3 -8
  170. package/src/ui/plan.ts +11 -198
  171. package/src/ui/progress.ts +3 -49
  172. package/src/ui/result.ts +18 -77
  173. package/src/ui/review-menu.ts +3 -12
  174. package/src/ui/select.ts +9 -79
  175. package/src/updater.ts +1 -1
  176. package/src/usage.ts +1 -7
  177. package/prompts/scout.md +0 -140
  178. package/src/ci/platform-estimate.ts +0 -111
  179. package/src/review/scout.ts +0 -323
package/src/pr/plan.ts CHANGED
@@ -1,17 +1,16 @@
1
- // PR mode's plan-and-confirm stage (ROADMAP B1): the real (non-dry-run) plan
2
- // card, its two possible early exits (the CI budget gate, a declined
1
+ // PR mode's plan-and-confirm stage (ROADMAP B1): the CI platform-limits gate,
2
+ // the real (non-dry-run) plan card, its early exit (a declined
3
3
  // interactive confirm), and the "committed to spending" commit-status hold
4
4
  // that follows a successful confirm. Relocated out of reviewPr()
5
5
  // (src/pr/review-pr.ts): identifiers moved onto explicit parameters, control
6
6
  // flow and WHY comments unchanged.
7
7
  //
8
- // `parityFires` / `activeHunters` / `hunterCount` stay computed in
8
+ // `activeHunters` / `hunterCount` stay computed in
9
9
  // reviewPr() itself: `activeHunters` is derived via `discoveryHunters`
10
10
  // (src/pr/discovery.ts, invariant 1 — behavior-tested in
11
11
  // test/pr/discovery.test.ts, not pinned as literal source) and is read only
12
12
  // by reviewPr()'s own progress renderer, never by this stage. Only
13
- // `hunterCount` (and `parityFires`, for the plan card's `resolved` field)
14
- // actually cross into this function.
13
+ // `hunterCount` actually crosses into this function.
15
14
  //
16
15
  // A discriminated union, not a flat result-plus-sentinel: the two early-exit
17
16
  // branches (`exitCode: number`) genuinely have no route plan, runner
@@ -20,15 +19,16 @@
20
19
  // fabricating values nothing produced. Same intent as
21
20
  // CiAdmissionGateResult's `exitCode: number | undefined` sentinel
22
21
  // (src/pr/ci-admission-gate.ts), expressed so the type checker enforces it.
22
+
23
23
  import { recordPendingCreatedAt, recordReviewing } from "#ci/cli-record";
24
- import { planCiBudgetSkip } from "#ci/gates";
25
- import { actionsRunUrl } from "#ci/outcome";
26
- import { readPlatformEstimate, runCostEstimate } from "#ci/platform-estimate";
27
24
  import {
28
- countFreeRouteSteps,
29
- type FreeRouteBilling,
30
- } from "#model/free-discovery";
31
- import { planRoutes, type ResolvedRoutePlan } from "#model/routing";
25
+ type CiBillingMode,
26
+ type ModelRoleBilling,
27
+ planCiLimitsSkip,
28
+ } from "#ci/gates";
29
+ import { actionsRunUrl } from "#ci/outcome";
30
+ import { readPlatformLimits } from "#ci/platform-limits";
31
+ import type { ResolvedRoutePlan } from "#model/routing";
32
32
  import {
33
33
  type CiAdmissionLedgerState,
34
34
  publishCiSkip,
@@ -52,7 +52,7 @@ import {
52
52
  resolveMaxVerificationSteps,
53
53
  } from "#review/preflight";
54
54
  import type { ParsedAgent } from "#review/prompt-set";
55
- import { type DiffStat, estimateCost } from "#review/report";
55
+ import type { DiffStat } from "#review/report";
56
56
  import { isBundledAgentsDir } from "#review/route-preflight";
57
57
  import {
58
58
  enforceCapabilityGate,
@@ -86,11 +86,7 @@ export type PrPlanAndConfirmResult =
86
86
  productionAdmission: ProductionAdmissionContext | undefined;
87
87
  runnerAuthority: RunnerAuthorityResolution;
88
88
  maxVerificationSteps: number;
89
- estimate: ReturnType<typeof estimateCost>;
90
89
  statusTargetUrl: string | undefined;
91
- // W3-FOOTER: the count the plan card priced by, handed on so the end-of-run
92
- // footer names a free route the same way the card did.
93
- freeRoute: FreeRouteBilling | undefined;
94
90
  };
95
91
 
96
92
  // The pending's target_url (SB3 follow-up): in GitHub Actions it is this run's attempt, so the
@@ -115,8 +111,6 @@ export async function resolvePrPlanAndConfirm(params: {
115
111
  diffFromSha: string;
116
112
  diffPath: string;
117
113
  diffStat: DiffStat;
118
- // The whole PR range's stat under the same filters (discovery's prDiffStat).
119
- prDiffStat: DiffStat;
120
114
  droppedPaths: string[];
121
115
  sizeGate: SizeGateVerdict;
122
116
  sizeGateConfirmed: boolean;
@@ -135,15 +129,15 @@ export async function resolvePrPlanAndConfirm(params: {
135
129
  // The context this run's statuses post on: pr-hero only for an explicit --ci
136
130
  // run, pr-hero/local otherwise (resolveCiPosture). Passed down, never re-derived.
137
131
  statusContext: CommitStatusContext;
138
- ciBudgetCeiling: { budgetUsd: number | undefined };
132
+ // The run's credential class (resolvePrPromptSetAndBudget), resolved once.
133
+ ciBillingMode: CiBillingMode;
134
+ // Which model roles bill an API key (resolvePrPromptSetAndBudget), resolved
135
+ // once beside the billing mode.
136
+ ciRoleBilling: ModelRoleBilling | undefined;
139
137
  // S5: the run's Claude credential, chosen once at run start (reviewPr).
140
138
  claudeRun: RunClaudeCredential;
141
139
  ciAdmissionLedger: CiAdmissionLedgerState | null;
142
140
  skipDiscovery: boolean;
143
- hunterCount: number;
144
- // Hunters a full review of the whole PR runs (fullReviewHunterCount).
145
- fullHunterCount: number;
146
- parityFires: boolean;
147
141
  verifyQueue: ReturnType<typeof buildPhaseBQueue>["queued"];
148
142
  prepared: PreparedDiscovery;
149
143
  }): Promise<PrPlanAndConfirmResult> {
@@ -152,82 +146,31 @@ export async function resolvePrPlanAndConfirm(params: {
152
146
  params.verifyQueue.length,
153
147
  maxVerificationSteps,
154
148
  );
155
- // cryskai/platform#12: in a platform run the platform's estimate, priced from
156
- // the setup's models and its recent reviews, replaces the band, which prices
157
- // every model as Claude. The platform prices the whole pull request, so a run
158
- // that covers less of it (a re-review whose discovery reads only the commits
159
- // or paths since the last review, or one that hunts nothing new) scales it by
160
- // the share of a full review it does, which the band measures
161
- // (runCostEstimate). Without a platform estimate (standalone, or nothing
162
- // priceable) the band decides.
163
- const platformEstimate = params.isCi
164
- ? readPlatformEstimate(process.env)
165
- : undefined;
166
- const band = estimateCost(
167
- params.diffStat,
168
- params.hunterCount,
169
- params.summary.enabled && !params.skipDiscovery,
170
- params.options.scout && !params.skipDiscovery,
171
- queuedVerification,
172
- !params.skipDiscovery,
173
- );
174
- // discoveryPaths is null only when the hunters read the full PR range.
175
- const narrowed =
176
- params.skipDiscovery || params.prepared.discoveryPaths !== null;
177
- const estimate = runCostEstimate(
178
- platformEstimate,
179
- band,
180
- narrowed && platformEstimate !== undefined
181
- ? estimateCost(
182
- params.prDiffStat,
183
- params.fullHunterCount,
184
- params.summary.enabled,
185
- params.options.scout,
186
- queuedVerification,
187
- true,
188
- )
189
- : undefined,
190
- );
191
- // 7b(CI) — the budget gate, immediately after the estimate it reads and
192
- // BEFORE the plan card/confirm/"committed to spending" commit-status
193
- // block below: spec 3.1 ("Review MUST halt before agent spawning") is
194
- // satisfied at any point before runPipeline, and this is the earliest
195
- // point the REAL (parity-narrowed) estimate exists — the same one the
196
- // plan card is about to show, so the skip comment's number and the
197
- // (unrendered) plan's number can never have disagreed. `estimate.high`,
198
- // not `.low`: report.ts's own doctrine (~97-98) is that every recorded
199
- // overrun was an UNDER-estimate, so the generous side is the cheap one
200
- // to be wrong on. `force` is passed through: a `/pr-hero review` comment
201
- // sets `--force`, and that one run clears this ceiling the same way it
202
- // clears the size gate and admission. The interactive cost-band prompt
203
- // is a different question and still requires `--yes` on its own.
204
- // Unlike the size gate, this runs AFTER
205
- // createPrRunDir (step 6), so a budget skip can leave a near-empty run
206
- // dir behind — the tidiness rationale that placement protects against
207
- // (the watcher's attempt counter) does not apply to an ephemeral CI
208
- // runner, and restructuring the cost estimate earlier is out of Phase
209
- // 3's scope.
210
- // `ciBudgetCeiling.budgetUsd`, not `options.budgetUsd`: since issue #156
211
- // an unset `--budget-usd` is a POLICY, not an absent number. It resolves
212
- // to no ceiling on a subscription route (where `estimate.high` is a token
213
- // figure and the cash cost is $0.00, so gating on it refused work over an
214
- // overrun that cannot happen) and to the default ceiling on a metered one.
215
- // `undefined` here still means the gate does not run — the announcement
216
- // for that already fired at the resolution site above.
217
- if (params.isCi && params.ciBudgetCeiling.budgetUsd !== undefined) {
218
- const budgetPlan = planCiBudgetSkip({
149
+ // The platform limits gate (platform-owned-cost L55), BEFORE the route is
150
+ // resolved and anything is spawned: spec 3.1 ("Review MUST halt before agent
151
+ // spawning") holds at any point before runPipeline. The engine keeps one
152
+ // comparison, because only it knows whether this run bills an API key
153
+ // (`ciBillingMode`): see `evaluatePlatformLimits`. `force` is passed through:
154
+ // a `/crysk review` comment sets `--force`, and that one run clears the limits
155
+ // the same way it clears the size gate and admission (the platform also sends
156
+ // none for a forced dispatch). The interactive confirm is a different question
157
+ // and still requires `--yes` on its own.
158
+ if (params.isCi) {
159
+ const limitsPlan = planCiLimitsSkip({
219
160
  isCi: params.isCi,
220
- estimatedCostUsd: estimate.high,
221
- budgetUsd: params.ciBudgetCeiling.budgetUsd,
161
+ billingMode: params.ciBillingMode,
162
+ ...(params.ciRoleBilling === undefined
163
+ ? {}
164
+ : { roleBilling: params.ciRoleBilling }),
165
+ limits: readPlatformLimits(process.env),
222
166
  prNumber: params.prNumber,
223
167
  force: params.options.force,
224
168
  ciMode: params.ciMode,
225
- platformConnected: process.env.CRYSK_PLATFORM_CONNECTED === "true",
226
169
  });
227
- if (budgetPlan !== null) {
170
+ if (limitsPlan !== null) {
228
171
  await settleCiGateSkip(
229
172
  params.ciAdmissionLedger,
230
- "estimated cost exceeds the configured CI budget ceiling",
173
+ "the platform's dollar limits were reached",
231
174
  );
232
175
  const exitCode = await publishCiSkip({
233
176
  operatorRoot: params.operatorRoot,
@@ -235,9 +178,9 @@ export async function resolvePrPlanAndConfirm(params: {
235
178
  post: params.options.post === true,
236
179
  isCi: params.isCi,
237
180
  stepSummaryFlag: params.options.stepSummary,
238
- plan: budgetPlan,
181
+ plan: limitsPlan,
239
182
  noticeMessage:
240
- "crysk review skipped — estimated cost exceeds the configured CI budget ceiling",
183
+ "crysk review skipped — the Crysk platform's dollar limits were reached",
241
184
  ciMode: params.ciMode,
242
185
  headSha: params.headSha,
243
186
  });
@@ -255,7 +198,6 @@ export async function resolvePrPlanAndConfirm(params: {
255
198
  profile: params.profile,
256
199
  summary: params.summary,
257
200
  summarizerEnabled: params.summary.enabled && !params.skipDiscovery,
258
- scoutEnabled: params.options.scout && !params.skipDiscovery,
259
201
  consolidateEnabled: !params.skipDiscovery,
260
202
  // Mirrors pipelineMaterialityInput in review-pr.ts: no judge step on a
261
203
  // re-review that hunts nothing new.
@@ -268,19 +210,6 @@ export async function resolvePrPlanAndConfirm(params: {
268
210
  });
269
211
  const routePlan = productionRoute?.routePlan;
270
212
  const productionAdmission = productionRoute?.productionAdmission;
271
- // Read off the admission above, which already decided every free verdict:
272
- // this adds no probe. Absent without routing, so the band stays.
273
- const freeRoute =
274
- routePlan === undefined || productionAdmission === undefined
275
- ? undefined
276
- : await countFreeRouteSteps({
277
- steps: planRoutes(routePlan),
278
- probe: productionAdmission.freeModelProbe,
279
- // The CRYSK_OPENCODE_* names admission bound each route's kind with,
280
- // so the card counts free exactly the routes admission probed (U3).
281
- openCodeSecretNames:
282
- productionAdmission.authorityOptions.openCodeSecretNames,
283
- });
284
213
  const runnerAuthority = await resolveRunnerAuthority({
285
214
  workspaceRoot: params.worktreePath,
286
215
  env: params.claudeRun.env,
@@ -308,8 +237,6 @@ export async function resolvePrPlanAndConfirm(params: {
308
237
  spec: params.spec,
309
238
  config: params.config,
310
239
  summary: params.summary,
311
- estimate,
312
- hunterCount: params.hunterCount,
313
240
  sizeGate: params.sizeGate,
314
241
  droppedPaths: params.droppedPaths,
315
242
  configProvenance: configProvenanceOf(params.loaded, params.agentsDirSource),
@@ -317,7 +244,6 @@ export async function resolvePrPlanAndConfirm(params: {
317
244
  baseSha: params.baseSha,
318
245
  diffFromSha: params.diffFromSha,
319
246
  diffPath: params.diffPath,
320
- parityFires: params.parityFires,
321
247
  },
322
248
  ...(params.sizeGateConfirmed ? { sizeGateConfirmed: true } : {}),
323
249
  ...(queuedVerification > 0
@@ -334,7 +260,6 @@ export async function resolvePrPlanAndConfirm(params: {
334
260
  },
335
261
  }),
336
262
  ...(routePlan === undefined ? {} : { routePlan }),
337
- ...(freeRoute === undefined ? {} : { freeRoute }),
338
263
  };
339
264
  for (const line of renderPrPlan(planContext, styleEnabled())) log(line);
340
265
  // What this run will actually publish. `options` is never mutated: the plan
@@ -342,12 +267,8 @@ export async function resolvePrPlanAndConfirm(params: {
342
267
  // itself follows the answer given here.
343
268
  let postEnabled = params.options.post ?? false;
344
269
  if (!params.options.yes) {
345
- const choice = await confirm(
346
- estimate.low,
347
- estimate.high,
348
- params.options.post ?? false,
349
- () => prPlanDetails(planContext, styleEnabled()),
350
- freeRoute,
270
+ const choice = await confirm(params.options.post ?? false, () =>
271
+ prPlanDetails(planContext, styleEnabled()),
351
272
  );
352
273
  if (choice.kind === "cancel") {
353
274
  log("aborted; nothing was spent.");
@@ -419,8 +340,6 @@ export async function resolvePrPlanAndConfirm(params: {
419
340
  productionAdmission,
420
341
  runnerAuthority,
421
342
  maxVerificationSteps,
422
- estimate,
423
343
  statusTargetUrl,
424
- freeRoute,
425
344
  };
426
345
  }
@@ -44,6 +44,7 @@ import {
44
44
  parseAdjudicationMarker,
45
45
  trustedAdjudicator,
46
46
  } from "#triage/adjudication";
47
+ import { withPlainAppliedReplies } from "#triage/plain-reply";
47
48
  import {
48
49
  type ParsedTriageMarker,
49
50
  parseTriageMarker,
@@ -179,7 +180,8 @@ interface AnalyzedFinding {
179
180
  triagedAtPostedHead: boolean;
180
181
  }
181
182
 
182
- export function buildPrStatus(input: PrStatusInput): PrStatusJson {
183
+ export function buildPrStatus(raw: PrStatusInput): PrStatusJson {
184
+ const input = withPlainReplies(raw);
183
185
  const gate = readGate(input);
184
186
  const summary = readSummary(input.issueComments);
185
187
  const analyzed = readFindings(input, summary.rows);
@@ -254,9 +256,19 @@ function gateStateOf(state: string): PrGateState {
254
256
  return "error";
255
257
  }
256
258
 
259
+ // triage-without-skill S1: a plain `applied` reply to a finding reads as the marker it implies, so the status
260
+ // a person or an agent reads agrees with the gate (triage/plain-reply.ts).
261
+ function withPlainReplies(input: PrStatusInput): PrStatusInput {
262
+ return {
263
+ ...input,
264
+ reviewComments: withPlainAppliedReplies(input.reviewComments),
265
+ };
266
+ }
267
+
257
268
  // The live blocking findings at input.head, each with its newest triage reply and CI ruling, read exactly as
258
269
  // buildPrStatus reads them. The admission gate reads them for the reviewed head (pr/answered-findings.ts).
259
- export function liveBlockingFindings(input: PrStatusInput): PrStatusFinding[] {
270
+ export function liveBlockingFindings(raw: PrStatusInput): PrStatusFinding[] {
271
+ const input = withPlainReplies(raw);
260
272
  const summary = readSummary(input.issueComments);
261
273
  return readFindings(input, summary.rows)
262
274
  .filter((a) => a.finding.blocking && a.finding.live_on_head)
package/src/pr/pr.ts CHANGED
@@ -186,7 +186,7 @@ async function gh(
186
186
  // exactly these fields; change them together.
187
187
  export const PR_VIEW_JSON_FIELDS =
188
188
  "number,title,state,headRefOid,baseRefName,baseRefOid,mergeCommit," +
189
- "additions,deletions,changedFiles";
189
+ "additions,deletions,changedFiles,body";
190
190
 
191
191
  export async function ghPrView(
192
192
  operatorRoot: string,
@@ -31,6 +31,7 @@ import {
31
31
  type SizeGateVerdict,
32
32
  } from "#review/size-gate";
33
33
  import {
34
+ canonicalStatusText,
34
35
  isLegacyStatusContext,
35
36
  isStatusContext,
36
37
  LOCAL_STATUS_CONTEXT,
@@ -50,6 +51,10 @@ export type PrBaseSource = "merge-commit-parent" | "base-branch";
50
51
  export interface PrTarget {
51
52
  number: number;
52
53
  title: string;
54
+ // The description the author wrote, "" when there is none (gh reports an
55
+ // empty or null `body`; many PRs have no description). The hunters read it
56
+ // as the change's stated intent (S10), never as evidence.
57
+ body: string;
53
58
  state: PrState;
54
59
  headSha: string;
55
60
  // A rev EXPRESSION, not always a sha: for a merged PR it is
@@ -67,9 +72,10 @@ export interface PrTarget {
67
72
 
68
73
  // Parses the raw stdout of `gh pr view <n> --json number,title,state,
69
74
  // headRefOid,baseRefName,baseRefOid,mergeCommit,additions,deletions,
70
- // changedFiles`. Every field is validated loudly and names itself when it is
71
- // missing or mistyped: a PR record read wrong reviews a range nobody asked
72
- // for, and gh's output is still input from outside this process.
75
+ // changedFiles,body`. Every field is validated loudly and names itself when
76
+ // it is missing or mistyped, `body` aside, which may be empty, null or absent:
77
+ // a PR record read wrong reviews a range nobody asked for, and gh's output is
78
+ // still input from outside this process.
73
79
  export function resolvePrTarget(raw: string): PrTarget {
74
80
  let parsed: unknown;
75
81
  try {
@@ -90,6 +96,7 @@ export function resolvePrTarget(raw: string): PrTarget {
90
96
  );
91
97
  }
92
98
  const title = readString(record, "title");
99
+ const body = readOptionalText(record, "body");
93
100
  const state = readString(record, "state");
94
101
  if (state !== "OPEN" && state !== "CLOSED" && state !== "MERGED") {
95
102
  throw new CliUsageError(
@@ -124,6 +131,7 @@ export function resolvePrTarget(raw: string): PrTarget {
124
131
  return {
125
132
  number,
126
133
  title,
134
+ body,
127
135
  state,
128
136
  headSha,
129
137
  baseRef: `${mergeOid}^1`,
@@ -138,6 +146,7 @@ export function resolvePrTarget(raw: string): PrTarget {
138
146
  return {
139
147
  number,
140
148
  title,
149
+ body,
141
150
  state,
142
151
  headSha,
143
152
  baseRef: readSha(record, "baseRefOid"),
@@ -184,6 +193,24 @@ function readString(record: Record<string, unknown>, field: string): string {
184
193
  return value;
185
194
  }
186
195
 
196
+ // A field gh reports as text, null, or leaves out: absent is "" and never an
197
+ // error, because a PR without a description is the ordinary case. Any other
198
+ // type is still gh output this process does not understand, so it fails loud.
199
+ function readOptionalText(
200
+ record: Record<string, unknown>,
201
+ field: string,
202
+ ): string {
203
+ const value = record[field];
204
+ if (value === undefined || value === null) return "";
205
+ if (typeof value !== "string") {
206
+ throw new CliUsageError(
207
+ `gh pr view "${field}" must be a string or null, got: ` +
208
+ JSON.stringify(value),
209
+ );
210
+ }
211
+ return value;
212
+ }
213
+
187
214
  function readSha(record: Record<string, unknown>, field: string): string {
188
215
  const value = readString(record, field);
189
216
  if (!isFullCommitId(value)) {
@@ -757,9 +784,9 @@ export function commitStatusRequest(input: {
757
784
  // S4, gate mode: a finished review with unresolved blocking findings. The count
758
785
  // is the gate's own (rereview/state.ts): this run's blocking survivors plus every
759
786
  // live blocking prior that a verifier verdict or a deletion did not clear. A
760
- // same-head `/pr-hero review` re-runs that same count, so it stays red. The
787
+ // same-head `/crysk review` re-runs that same count, so it stays red. The
761
788
  // ways to green are a fix that the re-review verifies gone, or
762
- // `/pr-hero override`. A triage reply never lowers the count on its own (S7).
789
+ // `/crysk override`. A triage reply never lowers the count on its own (S7).
763
790
  // Gate-only: the only caller is a gate-mode settle, which is always a `--ci` run.
764
791
  // The context defaults to LOCAL so a caller that forgets it cannot reach the
765
792
  // gate; the gate's callers pass COMMIT_STATUS_CONTEXT explicitly.
@@ -772,14 +799,14 @@ export function blockingCommitStatusRequest(input: {
772
799
  state: "failure",
773
800
  context: input.context ?? LOCAL_COMMIT_STATUS_CONTEXT,
774
801
  description: clipStatusDescription(
775
- `${STATUS_CONTEXT}: ${input.blockingCount} blocking finding(s) — fix and push, or /pr-hero override`,
802
+ `${STATUS_CONTEXT}: ${input.blockingCount} blocking finding(s) — fix and push, or /crysk override`,
776
803
  ),
777
804
  targetUrl: input.targetUrl,
778
805
  };
779
806
  }
780
807
 
781
808
  // S4, gate mode: a size or budget skip is red, so an unreviewed head cannot
782
- // read as a clean one. `/pr-hero review` force-runs the review past both
809
+ // read as a clean one. `/crysk review` force-runs the review past both
783
810
  // gates, which is the unlock the description names.
784
811
  // Gate-only, like blockingCommitStatusRequest: the context defaults to LOCAL, and
785
812
  // the one production caller (the admission gate's publishCiSkip) passes the gate's context.
@@ -791,12 +818,12 @@ export function skipCommitStatusRequest(input: {
791
818
  const reason =
792
819
  input.kind === "size"
793
820
  ? "diff over the size gate"
794
- : "estimated cost over the CI budget";
821
+ : "over a cost limit set in Crysk";
795
822
  return {
796
823
  state: "failure",
797
824
  context: input.context ?? LOCAL_COMMIT_STATUS_CONTEXT,
798
825
  description: clipStatusDescription(
799
- `${STATUS_CONTEXT} skipped the review: ${reason}. /pr-hero review reviews it anyway`,
826
+ `${STATUS_CONTEXT} skipped the review: ${reason}. /crysk review reviews it anyway`,
800
827
  ),
801
828
  targetUrl: input.targetUrl,
802
829
  };
@@ -881,7 +908,7 @@ function partialCountsSuffix(set: string | undefined): string {
881
908
 
882
909
  // S1, gate mode: a finished review where some hunters failed but not all, and no blocking
883
910
  // finding survived. The gate cannot call that green: a reviewer that never ran may have been
884
- // the one that would have blocked. `/pr-hero review` runs the head again, which is the unlock.
911
+ // the one that would have blocked. `/crysk review` runs the head again, which is the unlock.
885
912
  // The variable parts are the failed count (N) and the hunters that ran (M).
886
913
  export function partialReviewDescription(
887
914
  failed: number,
@@ -889,7 +916,7 @@ export function partialReviewDescription(
889
916
  set?: string,
890
917
  ): string {
891
918
  return clipStatusDescription(
892
- `${STATUS_CONTEXT}: review partial (${failed} of ${total} hunters failed${partialCountsSuffix(set)}) — /pr-hero review retries it`,
919
+ `${STATUS_CONTEXT}: review partial (${failed} of ${total} hunters failed${partialCountsSuffix(set)}) — /crysk review retries it`,
893
920
  );
894
921
  }
895
922
 
@@ -901,7 +928,7 @@ export function partialReviewAgainDescription(
901
928
  set?: string,
902
929
  ): string {
903
930
  return clipStatusDescription(
904
- `${STATUS_CONTEXT}: review partial again (${failed} of ${total} hunters failed${partialCountsSuffix(set)}) — fix the failing route or /pr-hero override`,
931
+ `${STATUS_CONTEXT}: review partial again (${failed} of ${total} hunters failed${partialCountsSuffix(set)}) — fix the failing route or /crysk override`,
905
932
  );
906
933
  }
907
934
 
@@ -1016,7 +1043,7 @@ export function manualReviewHoldDescription(
1016
1043
  sha: string,
1017
1044
  ): string {
1018
1045
  return clipStatusDescription(
1019
- `${STATUS_CONTEXT}: waiting for a manual review (${label}); carried from ${sha.slice(0, 7)} — /pr-hero review or /pr-hero override`,
1046
+ `${STATUS_CONTEXT}: waiting for a manual review (${label}); carried from ${sha.slice(0, 7)} — /crysk review or /crysk override`,
1020
1047
  );
1021
1048
  }
1022
1049
 
@@ -1031,7 +1058,7 @@ export function isManualReviewHold(
1031
1058
  ): boolean {
1032
1059
  return (
1033
1060
  status.state === "pending" &&
1034
- MANUAL_REVIEW_HOLD.test(status.description ?? "")
1061
+ MANUAL_REVIEW_HOLD.test(canonicalStatusText(status.description ?? ""))
1035
1062
  );
1036
1063
  }
1037
1064
 
@@ -1041,7 +1068,9 @@ export function heldVerdictSha(
1041
1068
  status: Pick<CommitStatusFact, "state" | "description">,
1042
1069
  ): string | null {
1043
1070
  if (!isManualReviewHold(status)) return null;
1044
- const description = status.description ?? "";
1071
+ // A hold an earlier release wrote names `/pr-hero …` (and, before the rename, leads with `pr-hero:`): read
1072
+ // it as this version writes it, or the walk cannot jump over it (PR #549 R004).
1073
+ const description = canonicalStatusText(status.description ?? "");
1045
1074
  const match = HELD_VERDICT.exec(description);
1046
1075
  if (match === null) return null;
1047
1076
  const [, label, sha] = match as unknown as [string, string, string];
@@ -27,14 +27,9 @@
27
27
  import path from "node:path";
28
28
  import { classifyCliError } from "#ci/classify-error";
29
29
  import { recordReviewDelivered, writeCliRecord } from "#ci/cli-record";
30
- import {
31
- ingestReviewMetrics,
32
- notionalCostInput,
33
- persistCanonicalReview,
34
- } from "#config/config";
30
+ import { ingestReviewMetrics, persistCanonicalReview } from "#config/config";
35
31
  import { gitRemoteWebUrl } from "#git/git";
36
32
  import { engineIdentity } from "#git/identity";
37
- import type { FreeRouteBilling } from "#model/free-discovery";
38
33
  import {
39
34
  type CiAdmissionLedgerState,
40
35
  settleCiAdmissionLedger,
@@ -54,13 +49,11 @@ import type { ParsedAgent, PromptSetIdentity } from "#review/prompt-set";
54
49
  import {
55
50
  type DiffStat,
56
51
  envelopeModel,
57
- type estimateCost,
58
52
  incompleteReviewAnnotation,
59
53
  } from "#review/report";
60
54
  import { buildTelemetry, writeRunFindings, writeRunReport } from "#review/run";
61
55
  import { log, styleEnabled } from "#ui/primitives";
62
56
  import { type ResultLinks, renderResult } from "#ui/result";
63
- import { freeBillingMode } from "#ui/select";
64
57
  import { CliError } from "../errors";
65
58
  import { prheroLayout } from "../home-preflight";
66
59
 
@@ -93,10 +86,6 @@ export interface PublishRunOutcomeInput {
93
86
  ciMode: CiMode;
94
87
  // The `post_min_severity` config key. Only the PR comments read it.
95
88
  postMinSeverity?: PostMinSeverity;
96
- estimate: ReturnType<typeof estimateCost>;
97
- // W3-FOOTER: the plan's free-route count. Absent means no free share, and the
98
- // footer keeps its subscription wording.
99
- freeRoute?: FreeRouteBilling;
100
89
  ciAdmissionLedger: CiAdmissionLedgerState | null;
101
90
  // Fired the instant `posted` would have been assigned inside reviewPr()
102
91
  // itself — see the header above.
@@ -289,13 +278,7 @@ export async function publishRunOutcome(
289
278
  };
290
279
  for (const line of renderResult({
291
280
  doc,
292
- costUsd: result.usage.cost_usd_est,
293
- ...notionalCostInput(result),
294
- ...(input.freeRoute === undefined
295
- ? {}
296
- : { billing: freeBillingMode(input.freeRoute) }),
297
281
  wallMs,
298
- estimate: { low: input.estimate.low, high: input.estimate.high },
299
282
  runDir: input.runDir,
300
283
  artifacts: [
301
284
  path.basename(reportPath),
@@ -337,7 +320,6 @@ export async function publishRunOutcome(
337
320
  prNumber: input.prNumber,
338
321
  headSha: input.headSha,
339
322
  findings: doc.findings,
340
- costUsdEst: result.usage.cost_usd_est,
341
323
  wallMs,
342
324
  model: envelopeModel(input.options, input.agentFiles, result.routePlan),
343
325
  webUrl,