lastlight-core 0.21.14 → 0.23.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/config/default.yaml +119 -1
- package/dist/admin/routes.js +195 -38
- package/dist/admin/routes.js.map +1 -1
- package/dist/config/config-resolve.d.ts +38 -1
- package/dist/config/config-resolve.js +41 -17
- package/dist/config/config-resolve.js.map +1 -1
- package/dist/config/config.d.ts +114 -0
- package/dist/config/config.js +225 -7
- package/dist/config/config.js.map +1 -1
- package/dist/config/repo-config.d.ts +120 -0
- package/dist/config/repo-config.js +447 -0
- package/dist/config/repo-config.js.map +1 -0
- package/dist/connectors/github-webhook.d.ts +17 -0
- package/dist/connectors/github-webhook.js +150 -17
- package/dist/connectors/github-webhook.js.map +1 -1
- package/dist/connectors/types.d.ts +48 -1
- package/dist/cron/dependabot-discovery.d.ts +68 -11
- package/dist/cron/dependabot-discovery.js +78 -20
- package/dist/cron/dependabot-discovery.js.map +1 -1
- package/dist/cron/fanout.d.ts +10 -0
- package/dist/cron/fanout.js +35 -2
- package/dist/cron/fanout.js.map +1 -1
- package/dist/cron/jobs.d.ts +16 -2
- package/dist/cron/jobs.js +69 -9
- package/dist/cron/jobs.js.map +1 -1
- package/dist/cron/repo-crons.d.ts +110 -0
- package/dist/cron/repo-crons.js +169 -0
- package/dist/cron/repo-crons.js.map +1 -0
- package/dist/cron/review-discovery.d.ts +33 -20
- package/dist/cron/review-discovery.js +23 -30
- package/dist/cron/review-discovery.js.map +1 -1
- package/dist/engine/agent-executor.d.ts +1 -1
- package/dist/engine/agent-executor.js +1 -1
- package/dist/engine/agent-executor.js.map +1 -1
- package/dist/engine/dispatcher.d.ts +98 -1
- package/dist/engine/dispatcher.js +248 -231
- package/dist/engine/dispatcher.js.map +1 -1
- package/dist/engine/executors/orchestrator.js +39 -15
- package/dist/engine/executors/orchestrator.js.map +1 -1
- package/dist/engine/executors/shared.d.ts +43 -0
- package/dist/engine/executors/shared.js +65 -0
- package/dist/engine/executors/shared.js.map +1 -1
- package/dist/engine/fix-harvest.d.ts +169 -0
- package/dist/engine/fix-harvest.js +345 -0
- package/dist/engine/fix-harvest.js.map +1 -0
- package/dist/engine/fix-markers.d.ts +184 -0
- package/dist/engine/fix-markers.js +329 -0
- package/dist/engine/fix-markers.js.map +1 -0
- package/dist/engine/fix-scratch.d.ts +76 -0
- package/dist/engine/fix-scratch.js +77 -0
- package/dist/engine/fix-scratch.js.map +1 -0
- package/dist/engine/github/github.d.ts +302 -5
- package/dist/engine/github/github.js +614 -54
- package/dist/engine/github/github.js.map +1 -1
- package/dist/engine/github/profiles.d.ts +45 -1
- package/dist/engine/github/profiles.js +35 -0
- package/dist/engine/github/profiles.js.map +1 -1
- package/dist/engine/pr-decisions.d.ts +342 -0
- package/dist/engine/pr-decisions.js +721 -0
- package/dist/engine/pr-decisions.js.map +1 -0
- package/dist/engine/pr-escalation.d.ts +152 -0
- package/dist/engine/pr-escalation.js +320 -0
- package/dist/engine/pr-escalation.js.map +1 -0
- package/dist/engine/pr-notes.d.ts +175 -0
- package/dist/engine/pr-notes.js +315 -0
- package/dist/engine/pr-notes.js.map +1 -0
- package/dist/engine/pr-state.d.ts +313 -0
- package/dist/engine/pr-state.js +515 -0
- package/dist/engine/pr-state.js.map +1 -0
- package/dist/engine/review-check.d.ts +200 -0
- package/dist/engine/review-check.js +305 -0
- package/dist/engine/review-check.js.map +1 -0
- package/dist/engine/router.d.ts +27 -0
- package/dist/engine/router.js +156 -22
- package/dist/engine/router.js.map +1 -1
- package/dist/evals-api.d.ts +10 -0
- package/dist/evals-api.js +38 -0
- package/dist/evals-api.js.map +1 -1
- package/dist/index.js +313 -23
- package/dist/index.js.map +1 -1
- package/dist/sandbox/index.d.ts +13 -0
- package/dist/sandbox/index.js +30 -0
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/k8s/init-clone.d.ts +5 -0
- package/dist/sandbox/k8s/init-clone.js +27 -0
- package/dist/sandbox/k8s/init-clone.js.map +1 -1
- package/dist/sandbox/k8s/kubernetes-sandbox.d.ts +26 -1
- package/dist/sandbox/k8s/kubernetes-sandbox.js +30 -1
- package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -1
- package/dist/state/execution-store.d.ts +27 -0
- package/dist/state/execution-store.js +45 -0
- package/dist/state/execution-store.js.map +1 -1
- package/dist/state/workflow-run-store.d.ts +73 -0
- package/dist/state/workflow-run-store.js +106 -24
- package/dist/state/workflow-run-store.js.map +1 -1
- package/dist/workflows/pr-scope.d.ts +63 -0
- package/dist/workflows/pr-scope.js +113 -0
- package/dist/workflows/pr-scope.js.map +1 -0
- package/dist/workflows/resume.js +113 -8
- package/dist/workflows/resume.js.map +1 -1
- package/dist/workflows/runner.d.ts +2 -1
- package/dist/workflows/runner.js +143 -10
- package/dist/workflows/runner.js.map +1 -1
- package/dist/workflows/simple.d.ts +280 -1
- package/dist/workflows/simple.js +499 -8
- package/dist/workflows/simple.js.map +1 -1
- package/dist/workflows/target-policy.d.ts +0 -12
- package/dist/workflows/target-policy.js +9 -15
- package/dist/workflows/target-policy.js.map +1 -1
- package/package.json +4 -4
- package/skills/README.md +11 -5
- package/skills/dependency-impact/SKILL.md +83 -0
- package/skills/fixing/SKILL.md +190 -0
- package/skills/pr-review/SKILL.md +26 -9
- package/workflows/cron-dependabot-ci-fix.yaml +8 -5
- package/workflows/cron-review.yaml +14 -5
- package/workflows/dependabot-ci-fix.yaml +86 -2
- package/workflows/dependabot-pr-merge.yaml +13 -1
- package/workflows/pr-fix.yaml +84 -1
- package/workflows/pr-review.yaml +7 -0
- package/workflows/prompts/dependabot-ci-fix.md +70 -17
- package/workflows/prompts/dependabot-pr-merge.md +203 -80
- package/workflows/prompts/diagnose-ci.md +96 -0
- package/workflows/prompts/pr-fix.md +63 -4
|
@@ -1,8 +1,213 @@
|
|
|
1
1
|
import type { ExecutorConfig } from "../engine/github/profiles.js";
|
|
2
2
|
import type { StateDb, TriggerActorType } from "../state/db.js";
|
|
3
|
-
import
|
|
3
|
+
import type { DisabledConfig } from "lastlight-shared/config-types";
|
|
4
|
+
import { type DependenciesConfig, type FixConfig, type ModelConfig, type RepoConfigPolicy, type ReviewConfig, type VariantConfig } from "../config/config.js";
|
|
5
|
+
import type { GitHubClient } from "../engine/github/github.js";
|
|
6
|
+
import { type RepoConfigBase, type RepoConfigSources, type RepoConfigWarning, type RepoLayer } from "../config/repo-config.js";
|
|
7
|
+
import { type AgentWorkflowDefinition } from "lastlight-workflow-engine";
|
|
4
8
|
import { type ApprovalGateConfig, type RunnerCallbacks, type WorkflowResult } from "./runner.js";
|
|
5
9
|
import { PER_TARGET_REUSE_WORKFLOWS, PER_TARGET_RECREATE_WORKFLOWS, PREPOPULATE_SYNTH_WORKFLOWS, PR_HEADREF_PREPOPULATE_WORKFLOWS, PR_FIX_SHAPED_WORKFLOWS } from "./target-policy.js";
|
|
10
|
+
/**
|
|
11
|
+
* A managed repo's `.lastlight/` layer, already merged onto the boot config and
|
|
12
|
+
* frozen for the duration of ONE run.
|
|
13
|
+
*
|
|
14
|
+
* Resolved once at the dispatch choke point (`resolveRepoRunConfig`, driven from
|
|
15
|
+
* `dispatchWorkflow` in src/index.ts) and then carried explicitly through the
|
|
16
|
+
* run — never installed into a module global. Up to `concurrency.maxWorkflows`
|
|
17
|
+
* runs plus a cron fan-out across every managed repo are in flight at once, so a
|
|
18
|
+
* global would race and hand repo B's model override to repo A's run.
|
|
19
|
+
*
|
|
20
|
+
* `models` / `variants` / `approval` are the EFFECTIVE maps (base ⊕ repo), not
|
|
21
|
+
* the repo's deltas, so every consumer can use them as a drop-in replacement for
|
|
22
|
+
* the boot config's maps. The deltas are recoverable from {@link sources}.
|
|
23
|
+
*/
|
|
24
|
+
export interface RunRepoConfig {
|
|
25
|
+
/** `owner/repo` the layer was read from. */
|
|
26
|
+
repo: string;
|
|
27
|
+
/** The ref the layer was read from — always the repo's default branch. */
|
|
28
|
+
defaultBranch: string;
|
|
29
|
+
/** Git tree SHA of `.lastlight/` — the content identity of these values. */
|
|
30
|
+
treeSha: string;
|
|
31
|
+
/** ISO timestamp of the last successful download of the layer. */
|
|
32
|
+
fetchedAt: string;
|
|
33
|
+
/**
|
|
34
|
+
* Absolute host path of the unpacked layer, when the repo contributed assets
|
|
35
|
+
* AND the operator allows them. Undefined otherwise — the run then keeps the
|
|
36
|
+
* module-level (built-in + overlay) asset resolver untouched.
|
|
37
|
+
*/
|
|
38
|
+
assetRoot?: string;
|
|
39
|
+
/** Asset paths the repo contributed, relative to {@link assetRoot}. */
|
|
40
|
+
assets: string[];
|
|
41
|
+
/** Effective per-task model map. */
|
|
42
|
+
models: ModelConfig;
|
|
43
|
+
/** Effective per-task reasoning-effort map. */
|
|
44
|
+
variants: VariantConfig;
|
|
45
|
+
/** Effective approval gates. Add-only: the repo can raise a gate, never clear one. */
|
|
46
|
+
approval: Record<string, boolean>;
|
|
47
|
+
/** Effective disables. `workflows` is enforced at dispatch (see below). */
|
|
48
|
+
disabled: DisabledConfig;
|
|
49
|
+
/**
|
|
50
|
+
* Effective fix/dependency/review policy (issues #251, #252). Clamped at
|
|
51
|
+
* resolve time so these are never looser than the operator's own values —
|
|
52
|
+
* a consumer can read them directly without re-checking the bounds.
|
|
53
|
+
*/
|
|
54
|
+
fix: FixConfig;
|
|
55
|
+
dependencies: DependenciesConfig;
|
|
56
|
+
review: ReviewConfig;
|
|
57
|
+
/** Per-leaf provenance — which layer won each key (`default`/`overlay`/`env`/`repo`). */
|
|
58
|
+
sources: RepoConfigSources;
|
|
59
|
+
/** Everything the layer dropped, fetching + validating. Never thrown. */
|
|
60
|
+
warnings: RepoConfigWarning[];
|
|
61
|
+
}
|
|
62
|
+
/** Options for {@link resolveRepoRunConfig}. */
|
|
63
|
+
export interface RepoRunConfigOptions {
|
|
64
|
+
/**
|
|
65
|
+
* GitHub client to fetch through. `null` means chat-only mode (no App, no
|
|
66
|
+
* PAT) — there is nothing to fetch through, so the layer is skipped entirely.
|
|
67
|
+
* Omitted means "let `fetchRepoLayer` resolve the harness client itself".
|
|
68
|
+
*/
|
|
69
|
+
client?: GitHubClient | null;
|
|
70
|
+
/** Operator bounds. Defaults to the boot config's `repoConfig` block. */
|
|
71
|
+
policy?: RepoConfigPolicy;
|
|
72
|
+
/** Config the layer merges onto. Defaults to the boot runtime config. */
|
|
73
|
+
base?: RepoConfigBase;
|
|
74
|
+
/** Cache root override, forwarded to `fetchRepoLayer` (tests). */
|
|
75
|
+
cacheRoot?: string;
|
|
76
|
+
}
|
|
77
|
+
/** Result of {@link resolveRepoRunConfig}. */
|
|
78
|
+
export interface RepoRunConfigResult {
|
|
79
|
+
/** Present only when a repo layer actually applies to this dispatch. */
|
|
80
|
+
repoConfig?: RunRepoConfig;
|
|
81
|
+
/**
|
|
82
|
+
* Set when the repo's own `disabled.workflows` refuses this workflow. The
|
|
83
|
+
* caller must abandon the dispatch — no `workflow_runs` row, no agent call.
|
|
84
|
+
*/
|
|
85
|
+
refusal?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The single repo a dispatch context names, or `undefined` for none/many.
|
|
89
|
+
*
|
|
90
|
+
* A repo layer is per-REPO, so it is only meaningful when the run acts on
|
|
91
|
+
* exactly one: a repo-less Slack explore has nothing to read, and a multi-repo
|
|
92
|
+
* context (a cron fan-out envelope that hasn't been split yet) would have to
|
|
93
|
+
* pick a winner — silently applying one repo's model override to a run that
|
|
94
|
+
* touches another is worse than applying none.
|
|
95
|
+
*/
|
|
96
|
+
export declare function soleRepoInContext(context: {
|
|
97
|
+
repo?: unknown;
|
|
98
|
+
repos?: unknown;
|
|
99
|
+
}): string | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Resolve a dispatch's per-repository config layer (issue #180).
|
|
102
|
+
*
|
|
103
|
+
* Called from the `dispatchWorkflow` choke point in `src/index.ts`, right beside
|
|
104
|
+
* the unmanaged-repo guard, so every trigger path — webhook, router, cron, the
|
|
105
|
+
* direct `/api/run` + `/api/build` triggers, approval resume — gets the same
|
|
106
|
+
* answer from one place.
|
|
107
|
+
*
|
|
108
|
+
* **Never throws and never fails a run.** Every degenerate case (feature off, no
|
|
109
|
+
* repo, several repos, chat-only mode, a GitHub outage, a malformed
|
|
110
|
+
* `lastlight.yml`) returns "no layer applies" or a layer with warnings attached,
|
|
111
|
+
* and the run proceeds on the un-overridden operator config. The one refusal it
|
|
112
|
+
* CAN return is the repo's own `disabled.workflows` — the repo opting itself out
|
|
113
|
+
* of a workflow, which is a deliberate answer rather than a failure.
|
|
114
|
+
*/
|
|
115
|
+
export declare function resolveRepoRunConfig(workflowName: string, context: {
|
|
116
|
+
repo?: unknown;
|
|
117
|
+
repos?: unknown;
|
|
118
|
+
}, options?: RepoRunConfigOptions): Promise<RepoRunConfigResult>;
|
|
119
|
+
/**
|
|
120
|
+
* The JSON projection of a {@link RunRepoConfig} persisted on
|
|
121
|
+
* `workflow_runs.context.repoConfig`, so a specific run stays explainable long
|
|
122
|
+
* after the TTL cache has moved on.
|
|
123
|
+
*
|
|
124
|
+
* `applied` holds ONLY the leaves the repo actually won (provenance `repo`) —
|
|
125
|
+
* the effective full maps are already on `context.models` / `context.variants`,
|
|
126
|
+
* and a diff of the two is exactly what the dashboard wants to render.
|
|
127
|
+
*/
|
|
128
|
+
export interface RepoConfigRunRecord {
|
|
129
|
+
repo: string;
|
|
130
|
+
defaultBranch: string;
|
|
131
|
+
treeSha: string;
|
|
132
|
+
fetchedAt: string;
|
|
133
|
+
applied: {
|
|
134
|
+
models?: Record<string, string>;
|
|
135
|
+
variants?: Record<string, string>;
|
|
136
|
+
approval?: Record<string, boolean>;
|
|
137
|
+
disabled?: Partial<Record<keyof DisabledConfig, string[]>>;
|
|
138
|
+
/**
|
|
139
|
+
* The clamped leaves the repo won in `fix:` / `dependencies:` / `review:`.
|
|
140
|
+
* Loosely typed on purpose: this is a persisted JSON projection, and the
|
|
141
|
+
* restore path re-applies it over whatever the operator's block says today.
|
|
142
|
+
*/
|
|
143
|
+
fix?: Record<string, unknown>;
|
|
144
|
+
dependencies?: Record<string, unknown>;
|
|
145
|
+
review?: Record<string, unknown>;
|
|
146
|
+
};
|
|
147
|
+
assets: string[];
|
|
148
|
+
warnings: RepoConfigWarning[];
|
|
149
|
+
}
|
|
150
|
+
/** Project a {@link RunRepoConfig} into its persisted form. */
|
|
151
|
+
export declare function repoConfigRunRecord(cfg: RunRepoConfig): RepoConfigRunRecord;
|
|
152
|
+
/** Result of {@link restoreRepoRunConfig}. */
|
|
153
|
+
export interface RestoredRepoConfig {
|
|
154
|
+
/** The layer as the original dispatch resolved it, minus anything unrecoverable. */
|
|
155
|
+
repoConfig: RunRepoConfig;
|
|
156
|
+
/**
|
|
157
|
+
* Set when the repo's ASSET layer could not be restored (see
|
|
158
|
+
* {@link restoreRepoRunConfig}). The run still proceeds — on the operator's
|
|
159
|
+
* prompts/skills/agent-context — and the caller is expected to record this
|
|
160
|
+
* where the run is explained.
|
|
161
|
+
*/
|
|
162
|
+
warning?: RepoConfigWarning;
|
|
163
|
+
}
|
|
164
|
+
/** Options for {@link restoreRepoRunConfig}. */
|
|
165
|
+
export interface RestoreRepoRunConfigOptions {
|
|
166
|
+
/** Effective maps to re-apply the repo's leaves onto. Normally the run's own
|
|
167
|
+
* persisted `context.models` / `context.variants`; the operator's boot maps
|
|
168
|
+
* for a row written before those were stored. */
|
|
169
|
+
models?: ModelConfig;
|
|
170
|
+
variants?: VariantConfig;
|
|
171
|
+
approval?: Record<string, boolean>;
|
|
172
|
+
disabled?: DisabledConfig;
|
|
173
|
+
/**
|
|
174
|
+
* Operator policy blocks to re-apply the repo's clamped leaves onto. Default:
|
|
175
|
+
* the boot config's own blocks (the shipped defaults when config isn't
|
|
176
|
+
* loaded), which is what every production caller wants — unlike models and
|
|
177
|
+
* variants, these are not persisted on the run row in effective form.
|
|
178
|
+
*/
|
|
179
|
+
fix?: FixConfig;
|
|
180
|
+
dependencies?: DependenciesConfig;
|
|
181
|
+
review?: ReviewConfig;
|
|
182
|
+
/** Layer lookup seam (tests). Defaults to the cache, then one conditional refetch. */
|
|
183
|
+
resolveLayer?: (repo: string) => Promise<RepoLayer | undefined>;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Rebuild a {@link RunRepoConfig} from the {@link RepoConfigRunRecord} persisted
|
|
187
|
+
* on a run row — the inverse of {@link repoConfigRunRecord}, used when
|
|
188
|
+
* *continuing* a run rather than starting one (`resume.ts`).
|
|
189
|
+
*
|
|
190
|
+
* Why restore instead of re-resolving: a resume (boot orphan recovery, the
|
|
191
|
+
* dashboard's Retry, an admission promotion) is a continuation of a run that
|
|
192
|
+
* already executed phases under a specific config. Re-reading `.lastlight/` from
|
|
193
|
+
* the repo's default branch would let an edit made while the run was
|
|
194
|
+
* paused/queued/dead retarget it mid-flight — half the phases on one model, half
|
|
195
|
+
* on another. The record holds everything needed for a faithful continuation and
|
|
196
|
+
* needs no network.
|
|
197
|
+
*
|
|
198
|
+
* Two things are NOT in the record, by design:
|
|
199
|
+
* - **The unpacked asset root.** It's a cache path with its own lifetime, so it
|
|
200
|
+
* is recovered by content identity ({@link repoLayerForTree}) and dropped —
|
|
201
|
+
* with a warning — when the tree the run used is gone. Prompts/skills/agent
|
|
202
|
+
* context then come from the operator's layers: a degraded run, never a
|
|
203
|
+
* crashed one, and never a *different* repo config.
|
|
204
|
+
* - **Per-leaf provenance for the leaves the repo did NOT win.** `applied` only
|
|
205
|
+
* records the repo's own leaves, so the restored `sources` marks those `repo`
|
|
206
|
+
* and everything else `default`. Nothing on the resume path reads `sources`
|
|
207
|
+
* (it exists to build a record, which a resume never re-derives), so the
|
|
208
|
+
* approximation stays inside this type.
|
|
209
|
+
*/
|
|
210
|
+
export declare function restoreRepoRunConfig(record: RepoConfigRunRecord, options?: RestoreRepoRunConfigOptions): Promise<RestoredRepoConfig>;
|
|
6
211
|
/**
|
|
7
212
|
* Lightweight invocation request for any agent workflow. The runner handles
|
|
8
213
|
* all phase-level logic generically, so this single entry point covers
|
|
@@ -55,6 +260,13 @@ export interface SimpleWorkflowRequest {
|
|
|
55
260
|
* session.
|
|
56
261
|
*/
|
|
57
262
|
prePopulateBranch?: string;
|
|
263
|
+
/**
|
|
264
|
+
* The target repo's own `.lastlight/` layer, already merged onto the boot
|
|
265
|
+
* config by {@link resolveRepoRunConfig} at the dispatch choke point (issue
|
|
266
|
+
* #180). Absent ⇒ no layer applies and the run behaves exactly as it did
|
|
267
|
+
* before the feature existed.
|
|
268
|
+
*/
|
|
269
|
+
repoConfig?: RunRepoConfig;
|
|
58
270
|
}
|
|
59
271
|
export { PER_TARGET_REUSE_WORKFLOWS, PER_TARGET_RECREATE_WORKFLOWS, PREPOPULATE_SYNTH_WORKFLOWS, PR_HEADREF_PREPOPULATE_WORKFLOWS, PR_FIX_SHAPED_WORKFLOWS, };
|
|
60
272
|
export declare function workflowScopedTaskId(repo: string, number: number | undefined, workflowName: string, workflowId: string): string;
|
|
@@ -122,6 +334,73 @@ export declare function resolveRunBranch(args: {
|
|
|
122
334
|
* `../` prefix this function produces — so the two can't disagree.
|
|
123
335
|
*/
|
|
124
336
|
export declare function artifactIssueDir(config: Pick<ExecutorConfig, "buildAssets" | "sandbox">, issueKey: string, preCloned: boolean): string;
|
|
337
|
+
/**
|
|
338
|
+
* Substitute `models["pr-fix-retry"]` for `models["pr-fix"]` once this PR has
|
|
339
|
+
* spent more than `fix.escalateModelAfterAttempt` attempts.
|
|
340
|
+
*
|
|
341
|
+
* `resolveModelVariant` renders `model:` templates against `run.ctx` **only**,
|
|
342
|
+
* so `{{attempt}}` inside a `model:` template cannot work without an engine
|
|
343
|
+
* change. Rewriting the map here is the cheapest correct route: no engine
|
|
344
|
+
* change, no YAML change, and it composes with the per-repo `models` override
|
|
345
|
+
* (issue #180) for free because the map handed in is already the merged
|
|
346
|
+
* `base ⊕ repo` one.
|
|
347
|
+
*
|
|
348
|
+
* Done BEFORE the map is persisted on `context.models`, deliberately: the admin
|
|
349
|
+
* panel renders that map, so an operator can see which model an attempt actually
|
|
350
|
+
* used — and `resume.ts` reads a resumed run's models back off that same stored
|
|
351
|
+
* value rather than re-deriving one, so a restart mid-attempt does not silently
|
|
352
|
+
* demote the model. (A repo layer that pins its own `pr-fix` re-applies that
|
|
353
|
+
* leaf on restore, which is the one case where the escalation does not survive.)
|
|
354
|
+
*
|
|
355
|
+
* Returns the map **by identity** when nothing applies, so a deployment with no
|
|
356
|
+
* `pr-fix-retry` key cannot tell this function exists.
|
|
357
|
+
*/
|
|
358
|
+
export declare function escalateFixModel(workflowName: string, models: ModelConfig | undefined, attempt: number | undefined, fix: FixConfig): ModelConfig | undefined;
|
|
359
|
+
/**
|
|
360
|
+
* The one `skip_if` row that `fix.maxFlakyDeferrals` makes conditional.
|
|
361
|
+
*
|
|
362
|
+
* Matched literally rather than by pattern: the promotion has to be greppable
|
|
363
|
+
* from the YAML, and a fuzzy match would also strip an overlay's own unrelated
|
|
364
|
+
* `flaky` guard.
|
|
365
|
+
*
|
|
366
|
+
* It reads the PARSED class off the marker harvest rather than substring-matching
|
|
367
|
+
* the diagnose phase's output, because the output form matched an agent's prose
|
|
368
|
+
* ("this is not `class=flaky`…"), matched a `{{priorAttempts}}` line replayed
|
|
369
|
+
* from an EARLIER attempt, and evaluated empty across a resume boundary — so the
|
|
370
|
+
* guard silently ran the full sandbox on exactly the verdicts it exists to stop.
|
|
371
|
+
* Keep this string byte-identical to the row in both fix workflow YAMLs.
|
|
372
|
+
*/
|
|
373
|
+
export declare const FLAKY_SKIP_IF_EXPRESSION = "scratch.fixMarkers.diagnosis.class == 'flaky'";
|
|
374
|
+
/**
|
|
375
|
+
* Promote a third consecutive `flaky` diagnosis to `reproducible` by dropping
|
|
376
|
+
* the `flaky` row from the `fix` phase's `skip_if` for this run.
|
|
377
|
+
*
|
|
378
|
+
* §S1: `flaky` short-circuits the `fix` phase — by its own definition there is
|
|
379
|
+
* nothing to fix — but it is **bounded**. Without the cap, a daily
|
|
380
|
+
* `fix-red-dependency-prs` against a PR with one flaky test produces an
|
|
381
|
+
* unbounded series of free full runs; and if a job reports flaky three times
|
|
382
|
+
* running it is not flaky, it is an intermittent real failure — exactly the PR a
|
|
383
|
+
* human would want attempted. So `fix.maxFlakyDeferrals: 2` deferrals, and the
|
|
384
|
+
* THIRD consecutive `flaky` spends a normal attempt.
|
|
385
|
+
*
|
|
386
|
+
* `flakyDeferrals` counts PRIOR runs, so the off-by-one lands here: `0` and `1`
|
|
387
|
+
* still defer, `2` (the third such diagnosis) runs. Same predicate
|
|
388
|
+
* `renderContext` exposes to the prompts as `{{flakyPromoted}}`.
|
|
389
|
+
*
|
|
390
|
+
* **Why a list edit and not an expression.** `skip_if`'s grammar
|
|
391
|
+
* (`core/loop-eval.ts`) is `contains()` / `==` / `!=` against a dotted path, and
|
|
392
|
+
* the list is OR-ed: there is no negation and no conjunction, so
|
|
393
|
+
* "`class=flaky` AND NOT promoted" is not expressible — and the alternatives
|
|
394
|
+
* (a new operator, or template-rendering the expressions) are engine changes
|
|
395
|
+
* bought for one caller. The conjunction instead lands where its second term
|
|
396
|
+
* already lives: the promotion is a fact about the PR's history, known before
|
|
397
|
+
* the run starts, so the run's guard list is composed from it. The other two
|
|
398
|
+
* rows are unconditional and are never touched.
|
|
399
|
+
*
|
|
400
|
+
* The loaded definition is a process-global cache entry, so a promoted run gets
|
|
401
|
+
* a shallow copy; an unpromoted one gets the definition back by identity.
|
|
402
|
+
*/
|
|
403
|
+
export declare function promoteFlakyDiagnosis(definition: AgentWorkflowDefinition, flakyDeferrals: number | undefined, fix: FixConfig): AgentWorkflowDefinition;
|
|
125
404
|
/**
|
|
126
405
|
* Run a named agent workflow against a target.
|
|
127
406
|
*
|