crysk 0.7.0 → 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.
- package/README.md +27 -23
- package/dist/SKILL-1q3658n0.md +74 -0
- package/dist/SKILL-25j4q9b8.md +143 -0
- package/dist/SKILL-4747bhne.md +143 -0
- package/dist/SKILL-4jc3sv23.md +74 -0
- package/dist/SKILL-c0492rch.md +540 -0
- package/dist/SKILL-d1nzkhhr.md +74 -0
- package/dist/SKILL-f8p7kvx0.md +143 -0
- package/dist/SKILL-gxd45g38.md +553 -0
- package/dist/SKILL-rec41991.md +66 -0
- package/dist/SKILL-zze8zj5g.md +536 -0
- package/dist/cli.js +24658 -24654
- package/dist/index.js +492 -463
- package/dist/opencode-ci-qrcv7a99.md +106 -0
- package/dist/opencode-ci-rdpcc7xc.md +106 -0
- package/dist/opencode-ci-yt0k74t0.md +106 -0
- package/dist/workflow-andv2dvm.yml +158 -0
- package/package.json +1 -1
- package/prompts/default/PROVENANCE.md +1 -0
- package/skills/crysk/SKILL.md +6 -6
- package/skills/crysk-ci-setup/SKILL.md +32 -33
- package/skills/crysk-ci-setup/assets/workflow.yml +5 -10
- package/skills/crysk-ci-setup/references/ci-admission.md +5 -5
- package/skills/crysk-ci-setup/references/opencode-ci.md +6 -6
- package/skills/crysk-loop/SKILL.md +37 -54
- package/skills/crysk-pr/SKILL.md +1 -1
- package/src/asset-manifest.ts +0 -6
- package/src/assets.ts +1 -4
- package/src/brand.ts +20 -30
- package/src/ci/gates.ts +155 -201
- package/src/ci/outcome.ts +4 -31
- package/src/ci/platform-limits.ts +135 -0
- package/src/ci/platform-report.ts +212 -126
- package/src/ci/platform.ts +28 -26
- package/src/ci/reporter.ts +25 -26
- package/src/ci/review-admission.ts +1 -2
- package/src/ci/review-levels.ts +12 -53
- package/src/ci/setup.ts +96 -66
- package/src/ci/trace-bundle.ts +11 -27
- package/src/ci/trace-transcripts.ts +4 -6
- package/src/ci/trigger.ts +3 -5
- package/src/cli.ts +6 -5
- package/src/commands/ci-setup-questions.ts +2 -55
- package/src/commands/ci-setup.ts +2 -26
- package/src/commands/triage.ts +131 -38
- package/src/commands/usage.ts +0 -1
- package/src/compare/compare.ts +3 -3
- package/src/compare/floor-test.ts +30 -201
- package/src/config/config.ts +6 -30
- package/src/diversity/accounting.ts +0 -26
- package/src/diversity/benchmark.ts +1 -17
- package/src/diversity/identity.ts +0 -14
- package/src/diversity/pipeline-integration.ts +0 -29
- package/src/doctor.ts +3 -6
- package/src/execution/claude-session-trace.ts +7 -2
- package/src/execution/contracts.ts +15 -9
- package/src/execution/harness.ts +165 -187
- package/src/execution/spend-limiter.ts +39 -131
- package/src/execution/usage-facts.ts +397 -0
- package/src/execution/usage-normalized.ts +33 -86
- package/src/harness/materiality-judge.ts +0 -5
- package/src/harness/pipeline-plan.ts +0 -3
- package/src/harness/replay-rows.ts +0 -5
- package/src/harness/route-runner.ts +2 -2
- package/src/harness/single-step.ts +3 -9
- package/src/index.ts +1 -1
- package/src/mcp/preflight.ts +2 -2
- package/src/model/catalog.ts +1 -3
- package/src/model/free-discovery.ts +11 -78
- package/src/model/model-name.ts +14 -4
- package/src/model/profiles/claude.ts +1 -2
- package/src/model/profiles/openai.ts +1 -2
- package/src/model/profiles.ts +1 -2
- package/src/model/provider-capabilities.ts +16 -55
- package/src/model/routing.ts +39 -36
- package/src/pr/admission.ts +6 -6
- package/src/pr/answered-findings.ts +8 -4
- package/src/pr/ci-publish.ts +0 -2
- package/src/pr/discovery.ts +4 -25
- package/src/pr/plan.ts +40 -121
- package/src/pr/pr-status.ts +14 -2
- package/src/pr/preflight.ts +15 -12
- package/src/pr/publish-outcome.ts +1 -19
- package/src/pr/review-pr.ts +10 -47
- package/src/pr/target.ts +76 -82
- package/src/production-runtime.ts +52 -114
- package/src/progress.ts +0 -54
- package/src/rereview/prepare.ts +4 -1
- package/src/rereview/state.ts +1 -1
- package/src/review/boundary.ts +4 -8
- package/src/review/drafts.ts +3 -3
- package/src/review/findings-conformance.ts +1 -1
- package/src/review/findings.ts +0 -4
- package/src/review/pipeline.ts +57 -395
- package/src/review/preflight.ts +162 -201
- package/src/review/prompt-set.ts +0 -2
- package/src/review/report.ts +2 -162
- package/src/review/review.ts +16 -65
- package/src/review/route-preflight.ts +3 -35
- package/src/review/run.ts +37 -73
- package/src/review/size-gate.ts +3 -3
- package/src/review/spec.ts +6 -11
- package/src/review/step-runner.ts +4 -4
- package/src/runner-authority.ts +10 -9
- package/src/security/credential-broker.ts +5 -6
- package/src/server/preflight.ts +0 -1
- package/src/server/server.ts +17 -6
- package/src/store/activity.ts +1 -2
- package/src/store/backfill-preflight.ts +0 -3
- package/src/store/backfill.ts +0 -1
- package/src/store/metrics-preflight.ts +4 -14
- package/src/store/metrics.ts +5 -5
- package/src/store/preflight.ts +0 -13
- package/src/store/store.ts +11 -12
- package/src/transport-registry.ts +6 -30
- package/src/transports/claude-code-cli.ts +149 -215
- package/src/transports/opencode-client.ts +4 -24
- package/src/transports/opencode-sdk.ts +17 -112
- package/src/triage/plain-reply.ts +37 -0
- package/src/ui/activity.ts +1 -6
- package/src/ui/config-edit.ts +14 -67
- package/src/ui/config.ts +3 -8
- package/src/ui/plan.ts +11 -198
- package/src/ui/progress.ts +3 -49
- package/src/ui/result.ts +18 -77
- package/src/ui/review-menu.ts +3 -12
- package/src/ui/select.ts +9 -79
- package/src/updater.ts +1 -1
- package/src/usage.ts +1 -7
- package/prompts/default/deep-review-parity.md +0 -152
- package/prompts/scout.md +0 -140
- package/src/ci/platform-estimate.ts +0 -111
- 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
|
|
2
|
-
// card, its
|
|
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
|
-
// `
|
|
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`
|
|
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
|
-
|
|
29
|
-
type
|
|
30
|
-
|
|
31
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
-
//
|
|
156
|
-
//
|
|
157
|
-
//
|
|
158
|
-
//
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
//
|
|
162
|
-
//
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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
|
-
|
|
221
|
-
|
|
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 (
|
|
170
|
+
if (limitsPlan !== null) {
|
|
228
171
|
await settleCiGateSkip(
|
|
229
172
|
params.ciAdmissionLedger,
|
|
230
|
-
"
|
|
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:
|
|
181
|
+
plan: limitsPlan,
|
|
239
182
|
noticeMessage:
|
|
240
|
-
"crysk review skipped —
|
|
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
|
-
|
|
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
|
}
|
package/src/pr/pr-status.ts
CHANGED
|
@@ -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(
|
|
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(
|
|
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/preflight.ts
CHANGED
|
@@ -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,
|
|
@@ -783,9 +784,9 @@ export function commitStatusRequest(input: {
|
|
|
783
784
|
// S4, gate mode: a finished review with unresolved blocking findings. The count
|
|
784
785
|
// is the gate's own (rereview/state.ts): this run's blocking survivors plus every
|
|
785
786
|
// live blocking prior that a verifier verdict or a deletion did not clear. A
|
|
786
|
-
// same-head `/
|
|
787
|
+
// same-head `/crysk review` re-runs that same count, so it stays red. The
|
|
787
788
|
// ways to green are a fix that the re-review verifies gone, or
|
|
788
|
-
// `/
|
|
789
|
+
// `/crysk override`. A triage reply never lowers the count on its own (S7).
|
|
789
790
|
// Gate-only: the only caller is a gate-mode settle, which is always a `--ci` run.
|
|
790
791
|
// The context defaults to LOCAL so a caller that forgets it cannot reach the
|
|
791
792
|
// gate; the gate's callers pass COMMIT_STATUS_CONTEXT explicitly.
|
|
@@ -798,14 +799,14 @@ export function blockingCommitStatusRequest(input: {
|
|
|
798
799
|
state: "failure",
|
|
799
800
|
context: input.context ?? LOCAL_COMMIT_STATUS_CONTEXT,
|
|
800
801
|
description: clipStatusDescription(
|
|
801
|
-
`${STATUS_CONTEXT}: ${input.blockingCount} blocking finding(s) — fix and push, or /
|
|
802
|
+
`${STATUS_CONTEXT}: ${input.blockingCount} blocking finding(s) — fix and push, or /crysk override`,
|
|
802
803
|
),
|
|
803
804
|
targetUrl: input.targetUrl,
|
|
804
805
|
};
|
|
805
806
|
}
|
|
806
807
|
|
|
807
808
|
// S4, gate mode: a size or budget skip is red, so an unreviewed head cannot
|
|
808
|
-
// read as a clean one. `/
|
|
809
|
+
// read as a clean one. `/crysk review` force-runs the review past both
|
|
809
810
|
// gates, which is the unlock the description names.
|
|
810
811
|
// Gate-only, like blockingCommitStatusRequest: the context defaults to LOCAL, and
|
|
811
812
|
// the one production caller (the admission gate's publishCiSkip) passes the gate's context.
|
|
@@ -817,12 +818,12 @@ export function skipCommitStatusRequest(input: {
|
|
|
817
818
|
const reason =
|
|
818
819
|
input.kind === "size"
|
|
819
820
|
? "diff over the size gate"
|
|
820
|
-
: "
|
|
821
|
+
: "over a cost limit set in Crysk";
|
|
821
822
|
return {
|
|
822
823
|
state: "failure",
|
|
823
824
|
context: input.context ?? LOCAL_COMMIT_STATUS_CONTEXT,
|
|
824
825
|
description: clipStatusDescription(
|
|
825
|
-
`${STATUS_CONTEXT} skipped the review: ${reason}. /
|
|
826
|
+
`${STATUS_CONTEXT} skipped the review: ${reason}. /crysk review reviews it anyway`,
|
|
826
827
|
),
|
|
827
828
|
targetUrl: input.targetUrl,
|
|
828
829
|
};
|
|
@@ -907,7 +908,7 @@ function partialCountsSuffix(set: string | undefined): string {
|
|
|
907
908
|
|
|
908
909
|
// S1, gate mode: a finished review where some hunters failed but not all, and no blocking
|
|
909
910
|
// finding survived. The gate cannot call that green: a reviewer that never ran may have been
|
|
910
|
-
// the one that would have blocked. `/
|
|
911
|
+
// the one that would have blocked. `/crysk review` runs the head again, which is the unlock.
|
|
911
912
|
// The variable parts are the failed count (N) and the hunters that ran (M).
|
|
912
913
|
export function partialReviewDescription(
|
|
913
914
|
failed: number,
|
|
@@ -915,7 +916,7 @@ export function partialReviewDescription(
|
|
|
915
916
|
set?: string,
|
|
916
917
|
): string {
|
|
917
918
|
return clipStatusDescription(
|
|
918
|
-
`${STATUS_CONTEXT}: review partial (${failed} of ${total} hunters failed${partialCountsSuffix(set)}) — /
|
|
919
|
+
`${STATUS_CONTEXT}: review partial (${failed} of ${total} hunters failed${partialCountsSuffix(set)}) — /crysk review retries it`,
|
|
919
920
|
);
|
|
920
921
|
}
|
|
921
922
|
|
|
@@ -927,7 +928,7 @@ export function partialReviewAgainDescription(
|
|
|
927
928
|
set?: string,
|
|
928
929
|
): string {
|
|
929
930
|
return clipStatusDescription(
|
|
930
|
-
`${STATUS_CONTEXT}: review partial again (${failed} of ${total} hunters failed${partialCountsSuffix(set)}) — fix the failing route or /
|
|
931
|
+
`${STATUS_CONTEXT}: review partial again (${failed} of ${total} hunters failed${partialCountsSuffix(set)}) — fix the failing route or /crysk override`,
|
|
931
932
|
);
|
|
932
933
|
}
|
|
933
934
|
|
|
@@ -1042,7 +1043,7 @@ export function manualReviewHoldDescription(
|
|
|
1042
1043
|
sha: string,
|
|
1043
1044
|
): string {
|
|
1044
1045
|
return clipStatusDescription(
|
|
1045
|
-
`${STATUS_CONTEXT}: waiting for a manual review (${label}); carried from ${sha.slice(0, 7)} — /
|
|
1046
|
+
`${STATUS_CONTEXT}: waiting for a manual review (${label}); carried from ${sha.slice(0, 7)} — /crysk review or /crysk override`,
|
|
1046
1047
|
);
|
|
1047
1048
|
}
|
|
1048
1049
|
|
|
@@ -1057,7 +1058,7 @@ export function isManualReviewHold(
|
|
|
1057
1058
|
): boolean {
|
|
1058
1059
|
return (
|
|
1059
1060
|
status.state === "pending" &&
|
|
1060
|
-
MANUAL_REVIEW_HOLD.test(status.description ?? "")
|
|
1061
|
+
MANUAL_REVIEW_HOLD.test(canonicalStatusText(status.description ?? ""))
|
|
1061
1062
|
);
|
|
1062
1063
|
}
|
|
1063
1064
|
|
|
@@ -1067,7 +1068,9 @@ export function heldVerdictSha(
|
|
|
1067
1068
|
status: Pick<CommitStatusFact, "state" | "description">,
|
|
1068
1069
|
): string | null {
|
|
1069
1070
|
if (!isManualReviewHold(status)) return null;
|
|
1070
|
-
|
|
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 ?? "");
|
|
1071
1074
|
const match = HELD_VERDICT.exec(description);
|
|
1072
1075
|
if (match === null) return null;
|
|
1073
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,
|
package/src/pr/review-pr.ts
CHANGED
|
@@ -93,22 +93,16 @@ import {
|
|
|
93
93
|
resolveMaxConcurrentSteps,
|
|
94
94
|
resolveSharedPrefix,
|
|
95
95
|
} from "#review/preflight";
|
|
96
|
-
import { code
|
|
96
|
+
import { code } from "#review/report";
|
|
97
97
|
import {
|
|
98
98
|
claudeAuthorityRequired,
|
|
99
99
|
isBundledAgentsDir,
|
|
100
100
|
pipelineConsolidateInput,
|
|
101
101
|
pipelineMaterialityInput,
|
|
102
|
-
pipelineScoutInput,
|
|
103
102
|
pipelineSummarizerInput,
|
|
104
103
|
pipelineVerifierInput,
|
|
105
104
|
} from "#review/route-preflight";
|
|
106
|
-
import {
|
|
107
|
-
fullReviewHunterCount,
|
|
108
|
-
prepareRunnerForRoute,
|
|
109
|
-
resolveParityFires,
|
|
110
|
-
validateGotchas,
|
|
111
|
-
} from "#review/run";
|
|
105
|
+
import { prepareRunnerForRoute, validateGotchas } from "#review/run";
|
|
112
106
|
import { sizeGateConfigFor, sizeGateLine } from "#review/size-gate";
|
|
113
107
|
import { registerActiveRun, unregisterActiveRun } from "#store/activity";
|
|
114
108
|
import {
|
|
@@ -117,7 +111,7 @@ import {
|
|
|
117
111
|
CI_ADJUDICATOR_LOGIN,
|
|
118
112
|
trustedAdjudicator,
|
|
119
113
|
} from "#triage/adjudication";
|
|
120
|
-
import {
|
|
114
|
+
import { reviewingLine } from "#ui/plan";
|
|
121
115
|
import { log, styleEnabled, terminalWidth } from "#ui/primitives";
|
|
122
116
|
import { applySizeGate, startProgressRenderer } from "#ui/progress";
|
|
123
117
|
import { parsePrFiles } from "#watch/preflight";
|
|
@@ -362,7 +356,8 @@ export async function reviewPr(
|
|
|
362
356
|
throw error;
|
|
363
357
|
}
|
|
364
358
|
const {
|
|
365
|
-
|
|
359
|
+
ciBillingMode,
|
|
360
|
+
ciRoleBilling,
|
|
366
361
|
ciSizeLimits,
|
|
367
362
|
agents,
|
|
368
363
|
spec,
|
|
@@ -429,15 +424,6 @@ export async function reviewPr(
|
|
|
429
424
|
// dry run that says SKIP for a PR the real per-file run happily accepts
|
|
430
425
|
// reads as a broken tool, not a conservative estimate.
|
|
431
426
|
if (options.dryRun) {
|
|
432
|
-
const hunterCount = dryRunHunterCount(spec, config);
|
|
433
|
-
const estimate = estimateCost(
|
|
434
|
-
target.ghDiffStat,
|
|
435
|
-
hunterCount,
|
|
436
|
-
summary.enabled,
|
|
437
|
-
options.scout,
|
|
438
|
-
0,
|
|
439
|
-
true,
|
|
440
|
-
);
|
|
441
427
|
const dryRunGateConfig = sizeGateConfigFor(
|
|
442
428
|
sizeGateOverrides,
|
|
443
429
|
config,
|
|
@@ -468,8 +454,6 @@ export async function reviewPr(
|
|
|
468
454
|
summary,
|
|
469
455
|
loaded,
|
|
470
456
|
isCi,
|
|
471
|
-
hunterCount,
|
|
472
|
-
estimate,
|
|
473
457
|
dryRunGateConfig,
|
|
474
458
|
perFile,
|
|
475
459
|
});
|
|
@@ -595,7 +579,6 @@ export async function reviewPr(
|
|
|
595
579
|
adjudicationQueue,
|
|
596
580
|
phaseB,
|
|
597
581
|
diffStat,
|
|
598
|
-
prDiffStat,
|
|
599
582
|
sizeGate,
|
|
600
583
|
} = discovery;
|
|
601
584
|
|
|
@@ -704,23 +687,13 @@ export async function reviewPr(
|
|
|
704
687
|
|
|
705
688
|
// 7 — the plan and the paid gate, exactly like local mode but with the
|
|
706
689
|
// real numstat replacing GitHub's counters.
|
|
707
|
-
const parityFires = resolveParityFires(
|
|
708
|
-
effectiveDiff.patch,
|
|
709
|
-
config.parity_trigger_paths,
|
|
710
|
-
);
|
|
711
690
|
const activeHunters = discoveryHunters({
|
|
712
691
|
skipDiscovery,
|
|
713
692
|
agents: spec.agents,
|
|
714
|
-
parityFires,
|
|
715
693
|
});
|
|
716
694
|
const hunterCount = activeHunters.length;
|
|
717
|
-
const fullHunterCount = fullReviewHunterCount(
|
|
718
|
-
spec.agents,
|
|
719
|
-
anchorPatch,
|
|
720
|
-
config.parity_trigger_paths,
|
|
721
|
-
);
|
|
722
695
|
// See resolvePrPlanAndConfirm (src/pr/plan.ts) for the full rationale —
|
|
723
|
-
//
|
|
696
|
+
// route/capability resolution, the plan card, the
|
|
724
697
|
// interactive confirm, and the "committed to spending" commit-status
|
|
725
698
|
// hold that follows a successful one.
|
|
726
699
|
const planResult = await resolvePrPlanAndConfirm({
|
|
@@ -735,7 +708,6 @@ export async function reviewPr(
|
|
|
735
708
|
diffFromSha,
|
|
736
709
|
diffPath,
|
|
737
710
|
diffStat,
|
|
738
|
-
prDiffStat,
|
|
739
711
|
droppedPaths: effectiveDiff.droppedPaths,
|
|
740
712
|
sizeGate,
|
|
741
713
|
sizeGateConfirmed,
|
|
@@ -750,13 +722,11 @@ export async function reviewPr(
|
|
|
750
722
|
isCi,
|
|
751
723
|
ciMode,
|
|
752
724
|
statusContext,
|
|
753
|
-
|
|
725
|
+
ciBillingMode,
|
|
726
|
+
ciRoleBilling,
|
|
754
727
|
claudeRun,
|
|
755
728
|
ciAdmissionLedger,
|
|
756
729
|
skipDiscovery,
|
|
757
|
-
hunterCount,
|
|
758
|
-
fullHunterCount,
|
|
759
|
-
parityFires,
|
|
760
730
|
verifyQueue,
|
|
761
731
|
prepared,
|
|
762
732
|
});
|
|
@@ -767,9 +737,7 @@ export async function reviewPr(
|
|
|
767
737
|
productionAdmission,
|
|
768
738
|
runnerAuthority,
|
|
769
739
|
maxVerificationSteps,
|
|
770
|
-
estimate,
|
|
771
740
|
statusTargetUrl,
|
|
772
|
-
freeRoute,
|
|
773
741
|
} = planResult;
|
|
774
742
|
|
|
775
743
|
let result: PipelineResult | undefined;
|
|
@@ -809,7 +777,7 @@ export async function reviewPr(
|
|
|
809
777
|
// into a group nothing ever closes.
|
|
810
778
|
let started = 0;
|
|
811
779
|
await withCiWorkflowGroup(isCi, "crysk review", log, async () => {
|
|
812
|
-
log(reviewingLine(hunterCount, summary
|
|
780
|
+
log(reviewingLine(hunterCount, summary));
|
|
813
781
|
// runnerAuthority resolved before confirm with the exact-binding gate.
|
|
814
782
|
// A plan with no claude-code route never starts the Claude CLI.
|
|
815
783
|
if (
|
|
@@ -887,15 +855,12 @@ export async function reviewPr(
|
|
|
887
855
|
mcpConfigPath,
|
|
888
856
|
hopBudget: options.hopBudget,
|
|
889
857
|
...(options.model ? { model: options.model } : {}),
|
|
890
|
-
parityTriggerPaths:
|
|
858
|
+
parityTriggerPaths: [],
|
|
891
859
|
suspicionPriors: config.suspicion_priors,
|
|
892
860
|
modelProfile: profile,
|
|
893
861
|
...(skipDiscovery
|
|
894
862
|
? {}
|
|
895
863
|
: pipelineSummarizerInput(summary, { profile })),
|
|
896
|
-
...(skipDiscovery
|
|
897
|
-
? {}
|
|
898
|
-
: pipelineScoutInput(options, { profile })),
|
|
899
864
|
...(skipDiscovery ? {} : pipelineConsolidateInput({ profile })),
|
|
900
865
|
// Gated on skipDiscovery like consolidation: an empty-delta
|
|
901
866
|
// re-review posts no new findings, so there is nothing to judge.
|
|
@@ -982,8 +947,6 @@ export async function reviewPr(
|
|
|
982
947
|
isCi,
|
|
983
948
|
ciMode,
|
|
984
949
|
postMinSeverity: config.post_min_severity,
|
|
985
|
-
estimate,
|
|
986
|
-
freeRoute,
|
|
987
950
|
ciAdmissionLedger,
|
|
988
951
|
onPosted: (outcome) => {
|
|
989
952
|
posted = outcome;
|