opencastle 0.36.0 → 0.36.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/convoy/engine.d.ts.map +1 -1
- package/dist/cli/convoy/engine.js +0 -7
- package/dist/cli/convoy/engine.js.map +1 -1
- package/dist/cli/convoy/engine.test.js +0 -1
- package/dist/cli/convoy/engine.test.js.map +1 -1
- package/dist/cli/convoy/event-emission.test.d.ts +2 -0
- package/dist/cli/convoy/event-emission.test.d.ts.map +1 -0
- package/dist/cli/convoy/event-emission.test.js +73 -0
- package/dist/cli/convoy/event-emission.test.js.map +1 -0
- package/dist/cli/convoy/event-schemas.d.ts.map +1 -1
- package/dist/cli/convoy/event-schemas.js +0 -25
- package/dist/cli/convoy/event-schemas.js.map +1 -1
- package/dist/cli/convoy/events.test.js +2 -2
- package/dist/cli/convoy/events.test.js.map +1 -1
- package/dist/cli/convoy/last-run.d.ts +53 -0
- package/dist/cli/convoy/last-run.d.ts.map +1 -0
- package/dist/cli/convoy/last-run.js +54 -0
- package/dist/cli/convoy/last-run.js.map +1 -0
- package/dist/cli/convoy/last-run.test.d.ts +2 -0
- package/dist/cli/convoy/last-run.test.d.ts.map +1 -0
- package/dist/cli/convoy/last-run.test.js +110 -0
- package/dist/cli/convoy/last-run.test.js.map +1 -0
- package/dist/cli/convoy/spec-types.d.ts +8 -2
- package/dist/cli/convoy/spec-types.d.ts.map +1 -1
- package/dist/cli/convoy/store.d.ts +3 -2
- package/dist/cli/convoy/store.d.ts.map +1 -1
- package/dist/cli/convoy/store.js +33 -8
- package/dist/cli/convoy/store.js.map +1 -1
- package/dist/cli/convoy/store.test.js +76 -13
- package/dist/cli/convoy/store.test.js.map +1 -1
- package/dist/cli/convoy/types.d.ts +0 -35
- package/dist/cli/convoy/types.d.ts.map +1 -1
- package/dist/cli/convoy/types.js +0 -4
- package/dist/cli/convoy/types.js.map +1 -1
- package/dist/cli/convoy-args.test.d.ts +2 -0
- package/dist/cli/convoy-args.test.d.ts.map +1 -0
- package/dist/cli/convoy-args.test.js +132 -0
- package/dist/cli/convoy-args.test.js.map +1 -0
- package/dist/cli/convoy-cmd.d.ts +25 -0
- package/dist/cli/convoy-cmd.d.ts.map +1 -1
- package/dist/cli/convoy-cmd.js +155 -19
- package/dist/cli/convoy-cmd.js.map +1 -1
- package/dist/cli/publish-workflow.test.js +12 -0
- package/dist/cli/publish-workflow.test.js.map +1 -1
- package/dist/cli/run/adapters/codex.d.ts.map +1 -1
- package/dist/cli/run/adapters/codex.js +8 -1
- package/dist/cli/run/adapters/codex.js.map +1 -1
- package/dist/cli/run/adapters/permission-modes.d.ts +20 -0
- package/dist/cli/run/adapters/permission-modes.d.ts.map +1 -0
- package/dist/cli/run/adapters/permission-modes.js +82 -0
- package/dist/cli/run/adapters/permission-modes.js.map +1 -0
- package/dist/cli/run/adapters/permission-modes.test.d.ts +2 -0
- package/dist/cli/run/adapters/permission-modes.test.d.ts.map +1 -0
- package/dist/cli/run/adapters/permission-modes.test.js +95 -0
- package/dist/cli/run/adapters/permission-modes.test.js.map +1 -0
- package/dist/cli/run/schema.d.ts.map +1 -1
- package/dist/cli/run/schema.js +69 -0
- package/dist/cli/run/schema.js.map +1 -1
- package/dist/cli/run/schema.test.js +62 -0
- package/dist/cli/run/schema.test.js.map +1 -1
- package/dist/cli/run-dry-run.test.d.ts +2 -0
- package/dist/cli/run-dry-run.test.d.ts.map +1 -0
- package/dist/cli/run-dry-run.test.js +83 -0
- package/dist/cli/run-dry-run.test.js.map +1 -0
- package/dist/cli/run-executor-flags.test.d.ts +2 -0
- package/dist/cli/run-executor-flags.test.d.ts.map +1 -0
- package/dist/cli/run-executor-flags.test.js +31 -0
- package/dist/cli/run-executor-flags.test.js.map +1 -0
- package/dist/cli/run.d.ts +40 -0
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +198 -24
- package/dist/cli/run.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/convoy/TELEMETRY.md +0 -2
- package/src/cli/convoy/engine.test.ts +0 -1
- package/src/cli/convoy/engine.ts +0 -7
- package/src/cli/convoy/event-emission.test.ts +79 -0
- package/src/cli/convoy/event-schemas.ts +0 -25
- package/src/cli/convoy/events.test.ts +2 -2
- package/src/cli/convoy/last-run.test.ts +130 -0
- package/src/cli/convoy/last-run.ts +87 -0
- package/src/cli/convoy/spec-types.ts +8 -2
- package/src/cli/convoy/store.test.ts +87 -13
- package/src/cli/convoy/store.ts +40 -12
- package/src/cli/convoy/types.ts +0 -10
- package/src/cli/convoy-args.test.ts +156 -0
- package/src/cli/convoy-cmd.ts +162 -19
- package/src/cli/publish-workflow.test.ts +13 -0
- package/src/cli/run/adapters/codex.ts +9 -1
- package/src/cli/run/adapters/permission-modes.test.ts +114 -0
- package/src/cli/run/adapters/permission-modes.ts +89 -0
- package/src/cli/run/schema.test.ts +72 -0
- package/src/cli/run/schema.ts +71 -0
- package/src/cli/run-dry-run.test.ts +97 -0
- package/src/cli/run-executor-flags.test.ts +38 -0
- package/src/cli/run.ts +242 -29
- package/src/dashboard/dist/index.html +1 -1
- package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
- package/src/dashboard/src/pages/index.astro +1 -1
package/src/cli/run.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { stringify as yamlStringify } from 'yaml'
|
|
|
5
5
|
import { parseTaskSpecText, isConvoySpec, isPipelineSpec } from './run/schema.js'
|
|
6
6
|
import { createExecutor, buildPhases } from './run/executor.js'
|
|
7
7
|
import { getAdapter, detectAdapter } from './run/adapters/index.js'
|
|
8
|
+
import { permissionModeError } from './run/adapters/permission-modes.js'
|
|
8
9
|
import { createReporter, printExecutionPlan } from './run/reporter.js'
|
|
9
10
|
import { c } from './prompt.js'
|
|
10
11
|
import type { CliContext } from './types.js'
|
|
@@ -30,10 +31,13 @@ const HELP = `
|
|
|
30
31
|
--file, -f <path> Task spec file
|
|
31
32
|
--formula <path> Use a formula template (alternative to --file)
|
|
32
33
|
--set key=value Set a formula variable (repeatable)
|
|
33
|
-
--dry-run Show execution plan without running
|
|
34
|
+
--dry-run Show execution plan without running; with --resume
|
|
35
|
+
or --retry-failed, list the tasks that would run
|
|
34
36
|
--concurrency, -c <n> Override max parallel tasks
|
|
35
37
|
--adapter, -a <name> Override agent runtime adapter
|
|
36
|
-
--report-dir <path> Where to write run reports
|
|
38
|
+
--report-dir <path> Where to write run reports, for legacy specs only
|
|
39
|
+
(default: .opencastle/runs). Convoy specs record to
|
|
40
|
+
.opencastle/convoy.db and .opencastle/logs instead
|
|
37
41
|
--permission-mode <m> How much a worker may do unattended: default,
|
|
38
42
|
acceptEdits (the default), auto, dontAsk,
|
|
39
43
|
bypassPermissions, plan
|
|
@@ -46,9 +50,11 @@ const HELP = `
|
|
|
46
50
|
--dlq-retry <id> Reset a DLQ task to pending for retry
|
|
47
51
|
--convoy <id> Filter by convoy ID (used with --dlq-list)
|
|
48
52
|
--resolution <text> Resolution text (used with --dlq-resolve)
|
|
49
|
-
--watch
|
|
50
|
-
|
|
51
|
-
--
|
|
53
|
+
--watch Keep running, re-triggering on file changes, cron,
|
|
54
|
+
or git push (convoy specs only)
|
|
55
|
+
--watch-config <p> Path to watch configuration file (overrides spec
|
|
56
|
+
watch config)
|
|
57
|
+
--clear-scratchpad Clear scratchpad data at watch start
|
|
52
58
|
--help, -h Show this help
|
|
53
59
|
`
|
|
54
60
|
|
|
@@ -116,6 +122,59 @@ export function finishRun(
|
|
|
116
122
|
process.exit(exitCode)
|
|
117
123
|
}
|
|
118
124
|
|
|
125
|
+
/**
|
|
126
|
+
* The statuses `engine.retryFailed` reopens, and the ones `engine.resume` picks
|
|
127
|
+
* up. Named here so the `--dry-run` preview and the engine cannot drift about
|
|
128
|
+
* which tasks a run would touch.
|
|
129
|
+
*/
|
|
130
|
+
export const RETRYABLE_TASK_STATUSES = [
|
|
131
|
+
'failed',
|
|
132
|
+
'gate-failed',
|
|
133
|
+
'timed-out',
|
|
134
|
+
'review-blocked',
|
|
135
|
+
'disputed',
|
|
136
|
+
] as const
|
|
137
|
+
export const RESUMABLE_TASK_STATUSES = ['pending', 'assigned', 'running'] as const
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* What `--resume` or `--retry-failed` would do, without doing it.
|
|
141
|
+
*
|
|
142
|
+
* `--dry-run` was read only on the fresh-run path, so combining it with either
|
|
143
|
+
* of those flags spawned agents against the user's repository for real. The flag
|
|
144
|
+
* a person reaches for to find out what will happen was the one flag that did
|
|
145
|
+
* not change what happened.
|
|
146
|
+
*/
|
|
147
|
+
export function printRunDryRun(
|
|
148
|
+
verb: 'resume' | 'retry',
|
|
149
|
+
runLabel: string,
|
|
150
|
+
runName: string,
|
|
151
|
+
tasks: Array<{ id: string; agent: string; status: string }>,
|
|
152
|
+
statuses: readonly string[],
|
|
153
|
+
): void {
|
|
154
|
+
const selected = tasks.filter((t) => statuses.includes(t.status))
|
|
155
|
+
|
|
156
|
+
console.log(`\n 🏰 ${runLabel}: ${runName}`)
|
|
157
|
+
console.log(c.dim(` [dry-run] Nothing will be executed.\n`))
|
|
158
|
+
|
|
159
|
+
if (selected.length === 0) {
|
|
160
|
+
console.log(
|
|
161
|
+
verb === 'retry'
|
|
162
|
+
? ' No failed tasks to retry.'
|
|
163
|
+
: ' No unfinished tasks — nothing to resume.',
|
|
164
|
+
)
|
|
165
|
+
console.log(c.dim(` (matching: ${statuses.join(', ')})\n`))
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
console.log(
|
|
170
|
+
` Would ${verb === 'retry' ? 're-run' : 'run'} ${selected.length} of ${tasks.length} task(s):`,
|
|
171
|
+
)
|
|
172
|
+
for (const t of selected) {
|
|
173
|
+
console.log(` ${t.id} ${c.dim(`— ${t.agent} [${t.status}]`)}`)
|
|
174
|
+
}
|
|
175
|
+
console.log()
|
|
176
|
+
}
|
|
177
|
+
|
|
119
178
|
/**
|
|
120
179
|
* Parse CLI arguments for the run command.
|
|
121
180
|
*/
|
|
@@ -269,6 +328,106 @@ function parseArgs(args: string[]): RunOptions {
|
|
|
269
328
|
return opts
|
|
270
329
|
}
|
|
271
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Which executor a spec will run on, and therefore which flags mean anything.
|
|
333
|
+
*
|
|
334
|
+
* Three exist — the pipeline orchestrator for `version: 2`, the convoy engine
|
|
335
|
+
* for `version: 1`, and the legacy executor for everything else — and several
|
|
336
|
+
* flags are wired into exactly one of them:
|
|
337
|
+
*
|
|
338
|
+
* `--report-dir` is read where `createReporter` is called, which is the legacy
|
|
339
|
+
* path alone. For a `version: 1` spec, which is what every generated spec is,
|
|
340
|
+
* it was parsed, resolved against cwd, and never passed to the engine; the
|
|
341
|
+
* engine writes to SQLite and NDJSON and has no report directory at all. The
|
|
342
|
+
* flag was accepted, documented as "where to write run reports", and did
|
|
343
|
+
* nothing on the path nearly every user is on.
|
|
344
|
+
*
|
|
345
|
+
* `--watch` and its two companions are the mirror image: they live inside the
|
|
346
|
+
* convoy-engine branch, so a legacy or pipeline spec accepted them and ran
|
|
347
|
+
* once.
|
|
348
|
+
*/
|
|
349
|
+
export function specExecutor(spec: TaskSpec): 'pipeline' | 'engine' | 'legacy' {
|
|
350
|
+
if (isPipelineSpec(spec)) return 'pipeline'
|
|
351
|
+
if (isConvoySpec(spec)) return 'engine'
|
|
352
|
+
return 'legacy'
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** Flags that only one executor reads, and the one that reads each. */
|
|
356
|
+
const EXECUTOR_ONLY_FLAGS: Array<{
|
|
357
|
+
flag: string
|
|
358
|
+
executor: 'pipeline' | 'engine' | 'legacy'
|
|
359
|
+
set: (_o: RunOptions) => boolean
|
|
360
|
+
why: string
|
|
361
|
+
}> = [
|
|
362
|
+
{
|
|
363
|
+
flag: '--report-dir',
|
|
364
|
+
executor: 'legacy',
|
|
365
|
+
set: (o) => o.reportDir !== null,
|
|
366
|
+
why: 'the convoy engine records runs in .opencastle/convoy.db and .opencastle/logs, not as report files',
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
flag: '--watch',
|
|
370
|
+
executor: 'engine',
|
|
371
|
+
set: (o) => o.watch,
|
|
372
|
+
why: 'only the convoy engine has a watch loop',
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
flag: '--watch-config',
|
|
376
|
+
executor: 'engine',
|
|
377
|
+
set: (o) => o.watchConfig !== null,
|
|
378
|
+
why: 'only the convoy engine has a watch loop',
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
flag: '--clear-scratchpad',
|
|
382
|
+
executor: 'engine',
|
|
383
|
+
set: (o) => o.clearScratchpad,
|
|
384
|
+
why: 'only the convoy engine has a watch loop',
|
|
385
|
+
},
|
|
386
|
+
]
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Refuse a flag the spec's executor will never read.
|
|
390
|
+
*
|
|
391
|
+
* Same rule as everywhere else on this command: a flag is honoured or refused,
|
|
392
|
+
* never accepted and dropped. Silence here meant `--report-dir ./out` on an
|
|
393
|
+
* ordinary convoy spec exited 0 with `./out` empty.
|
|
394
|
+
*/
|
|
395
|
+
function assertFlagsApplyToSpec(spec: TaskSpec, opts: RunOptions): void {
|
|
396
|
+
const executor = specExecutor(spec)
|
|
397
|
+
for (const entry of EXECUTOR_ONLY_FLAGS) {
|
|
398
|
+
if (!entry.set(opts) || entry.executor === executor) continue
|
|
399
|
+
const kind =
|
|
400
|
+
executor === 'pipeline'
|
|
401
|
+
? 'a pipeline spec (version: 2)'
|
|
402
|
+
: executor === 'engine'
|
|
403
|
+
? 'a convoy spec (version: 1)'
|
|
404
|
+
: 'a legacy spec (no version)'
|
|
405
|
+
console.error(` ✗ ${entry.flag} does nothing for ${kind}.`)
|
|
406
|
+
console.error(` ${entry.why}.`)
|
|
407
|
+
process.exit(1)
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Refuse a permission mode the chosen adapter cannot honour, before it runs.
|
|
413
|
+
*
|
|
414
|
+
* Every entry point resolves its own adapter, so every one of them calls this.
|
|
415
|
+
* Until now the mode simply evaporated on four of the five adapters: a run told
|
|
416
|
+
* to hold its workers to `plan` went ahead and wrote files, and said nothing
|
|
417
|
+
* about it. Refusing is the only honest answer left once a mode cannot be
|
|
418
|
+
* carried out, and it has to happen here — before a worker starts, while the
|
|
419
|
+
* user can still change the flag.
|
|
420
|
+
*/
|
|
421
|
+
function assertPermissionModeSupported(adapterName: string, spec: TaskSpec): void {
|
|
422
|
+
const mode = spec.defaults?.permission_mode
|
|
423
|
+
if (!mode) return
|
|
424
|
+
const problem = permissionModeError(adapterName, mode)
|
|
425
|
+
if (problem) {
|
|
426
|
+
console.error(` ✗ ${problem}`)
|
|
427
|
+
process.exit(1)
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
272
431
|
/**
|
|
273
432
|
* Print a user-friendly adapter unavailable error.
|
|
274
433
|
*/
|
|
@@ -567,12 +726,28 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
|
|
|
567
726
|
const { createConvoyStore } = await import('./convoy/store.js')
|
|
568
727
|
const store = createConvoyStore(dbPath)
|
|
569
728
|
const convoy = store.getLatestConvoy()
|
|
729
|
+
const retryTasks = convoy ? store.getTasksByConvoy(convoy.id) : []
|
|
570
730
|
store.close()
|
|
571
731
|
if (!convoy) {
|
|
572
732
|
console.error(' ✗ No convoy records found in .opencastle/convoy.db')
|
|
573
733
|
process.exit(1)
|
|
574
734
|
}
|
|
575
735
|
|
|
736
|
+
// Before adapter detection: a preview should not require an agent CLI to be
|
|
737
|
+
// installed, and it must return before anything is executed.
|
|
738
|
+
if (opts.dryRun) {
|
|
739
|
+
printRunDryRun(
|
|
740
|
+
'retry',
|
|
741
|
+
'OpenCastle Convoy (Retry Failed)',
|
|
742
|
+
convoy.name,
|
|
743
|
+
opts.retryFailedTaskIds?.length
|
|
744
|
+
? retryTasks.filter((t) => opts.retryFailedTaskIds!.includes(t.id))
|
|
745
|
+
: retryTasks,
|
|
746
|
+
RETRYABLE_TASK_STATUSES,
|
|
747
|
+
)
|
|
748
|
+
return
|
|
749
|
+
}
|
|
750
|
+
|
|
576
751
|
const retrySpec = parseTaskSpecText(convoy.spec_yaml)
|
|
577
752
|
applyCliOverrides(retrySpec, opts)
|
|
578
753
|
|
|
@@ -594,6 +769,7 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
|
|
|
594
769
|
printAdapterError(retryDetectionFailed, retrySpec.adapter)
|
|
595
770
|
process.exit(1)
|
|
596
771
|
}
|
|
772
|
+
assertPermissionModeSupported(retrySpec.adapter, retrySpec)
|
|
597
773
|
|
|
598
774
|
console.log(`\n 🏰 OpenCastle Convoy (Retry Failed): ${convoy.name}`)
|
|
599
775
|
console.log(` Convoy ID: ${convoy.id}`)
|
|
@@ -644,10 +820,60 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
|
|
|
644
820
|
}
|
|
645
821
|
const { createConvoyStore } = await import('./convoy/store.js')
|
|
646
822
|
const store = createConvoyStore(dbPath)
|
|
647
|
-
const
|
|
823
|
+
const { selectResumableRun } = await import('./convoy/last-run.js')
|
|
824
|
+
const selected = selectResumableRun(store)
|
|
825
|
+
|
|
826
|
+
if (!selected) {
|
|
827
|
+
store.close()
|
|
828
|
+
console.error(' ✗ No convoy records found in .opencastle/convoy.db')
|
|
829
|
+
process.exit(1)
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
// Whichever run was started most recently, and only if it can be continued.
|
|
833
|
+
// Preferring pipelines unconditionally meant a standalone convoy could never
|
|
834
|
+
// be resumed once the project had run one, and the status screen — which
|
|
835
|
+
// reads the same selector — named a different run than this command resumed.
|
|
836
|
+
if (!selected.resumable) {
|
|
837
|
+
store.close()
|
|
838
|
+
const { kind, record } = selected.run
|
|
839
|
+
console.error(
|
|
840
|
+
` ✗ Last ${kind} "${record.name}" already finished with status: ${record.status}`,
|
|
841
|
+
)
|
|
842
|
+
console.error(
|
|
843
|
+
kind === 'pipeline'
|
|
844
|
+
? ' Only interrupted (running/pending/failed) pipelines can be resumed.'
|
|
845
|
+
: ' Only interrupted (running/pending) convoys can be resumed.',
|
|
846
|
+
)
|
|
847
|
+
if (kind === 'convoy' && record.status === 'failed') {
|
|
848
|
+
console.error(`\n To re-run its failed tasks: opencastle convoy retry`)
|
|
849
|
+
}
|
|
850
|
+
process.exit(1)
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// Before adapter detection, and before either orchestrator is constructed.
|
|
854
|
+
if (opts.dryRun) {
|
|
855
|
+
const previewIds =
|
|
856
|
+
selected.run.kind === 'pipeline'
|
|
857
|
+
? store.getConvoysByPipeline(selected.run.record.id).map((c) => c.id)
|
|
858
|
+
: [selected.run.record.id]
|
|
859
|
+
const previewTasks = previewIds.flatMap((id) => store.getTasksByConvoy(id))
|
|
860
|
+
store.close()
|
|
861
|
+
printRunDryRun(
|
|
862
|
+
'resume',
|
|
863
|
+
selected.run.kind === 'pipeline'
|
|
864
|
+
? 'OpenCastle Pipeline (Resume)'
|
|
865
|
+
: 'OpenCastle Convoy (Resume)',
|
|
866
|
+
selected.run.record.name,
|
|
867
|
+
previewTasks,
|
|
868
|
+
RESUMABLE_TASK_STATUSES,
|
|
869
|
+
)
|
|
870
|
+
return
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
const latestPipeline = selected.run.kind === 'pipeline' ? selected.run.record : null
|
|
648
874
|
|
|
649
875
|
// ── Pipeline resume (pending / running / failed) ────────────
|
|
650
|
-
if (latestPipeline
|
|
876
|
+
if (latestPipeline) {
|
|
651
877
|
store.close()
|
|
652
878
|
const resumePipelineSpec = parseTaskSpecText(latestPipeline.spec_yaml)
|
|
653
879
|
applyCliOverrides(resumePipelineSpec, opts)
|
|
@@ -670,6 +896,7 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
|
|
|
670
896
|
printAdapterError(resumePipelineDetectionFailed, resumePipelineSpec.adapter)
|
|
671
897
|
process.exit(1)
|
|
672
898
|
}
|
|
899
|
+
assertPermissionModeSupported(resumePipelineSpec.adapter, resumePipelineSpec)
|
|
673
900
|
|
|
674
901
|
console.log(`\n 🏰 OpenCastle Pipeline (Resume): ${latestPipeline.name}`)
|
|
675
902
|
console.log(` Pipeline ID: ${latestPipeline.id}`)
|
|
@@ -701,30 +928,11 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
|
|
|
701
928
|
return finishRun(resumePipelineDashResult, resumePipelineResult.status !== 'done')
|
|
702
929
|
}
|
|
703
930
|
|
|
704
|
-
// ── Pipeline done — don't fall through to convoy check ──────
|
|
705
|
-
if (latestPipeline && latestPipeline.status === 'done') {
|
|
706
|
-
store.close()
|
|
707
|
-
console.error(
|
|
708
|
-
` ✗ Last pipeline "${latestPipeline.name}" already finished with status: done`
|
|
709
|
-
)
|
|
710
|
-
console.error(` Only interrupted (running/pending/failed) pipelines can be resumed.`)
|
|
711
|
-
process.exit(1)
|
|
712
|
-
}
|
|
713
|
-
|
|
714
931
|
// ── Standalone convoy resume ────────────────────────────────
|
|
715
|
-
|
|
932
|
+
// Selection and the finished-run refusal both happened above, against the
|
|
933
|
+
// one selector. This branch only executes what was chosen.
|
|
934
|
+
const convoy = selected.run.record as import('./convoy/types.js').ConvoyRecord
|
|
716
935
|
store.close()
|
|
717
|
-
if (!convoy) {
|
|
718
|
-
console.error(' ✗ No convoy records found in .opencastle/convoy.db')
|
|
719
|
-
process.exit(1)
|
|
720
|
-
}
|
|
721
|
-
if (convoy.status === 'done' || convoy.status === 'failed') {
|
|
722
|
-
console.error(
|
|
723
|
-
` ✗ Last convoy "${convoy.name}" already finished with status: ${convoy.status}`
|
|
724
|
-
)
|
|
725
|
-
console.error(` Only interrupted (running/pending) convoys can be resumed.`)
|
|
726
|
-
process.exit(1)
|
|
727
|
-
}
|
|
728
936
|
|
|
729
937
|
const resumeSpec = parseTaskSpecText(convoy.spec_yaml)
|
|
730
938
|
applyCliOverrides(resumeSpec, opts)
|
|
@@ -747,6 +955,7 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
|
|
|
747
955
|
printAdapterError(resumeDetectionFailed, resumeSpec.adapter)
|
|
748
956
|
process.exit(1)
|
|
749
957
|
}
|
|
958
|
+
assertPermissionModeSupported(resumeSpec.adapter, resumeSpec)
|
|
750
959
|
|
|
751
960
|
console.log(`\n \uD83C\uDFF0 OpenCastle Convoy (Resume): ${convoy.name}`)
|
|
752
961
|
console.log(` Convoy ID: ${convoy.id}`)
|
|
@@ -860,6 +1069,9 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
|
|
|
860
1069
|
// Apply CLI overrides
|
|
861
1070
|
applyCliOverrides(spec, opts)
|
|
862
1071
|
|
|
1072
|
+
// Refuse the flags this spec's executor cannot act on, before anything runs.
|
|
1073
|
+
assertFlagsApplyToSpec(spec, opts)
|
|
1074
|
+
|
|
863
1075
|
// ── Auto-detect adapter if not specified ─────────────────────
|
|
864
1076
|
let detectionFailed = false
|
|
865
1077
|
if (!spec.adapter) {
|
|
@@ -905,6 +1117,7 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
|
|
|
905
1117
|
console.log(`\n ${c.dim('Resume:')} npx opencastle convoy run -f ${opts.file}`)
|
|
906
1118
|
process.exit(1)
|
|
907
1119
|
}
|
|
1120
|
+
assertPermissionModeSupported(spec.adapter, spec)
|
|
908
1121
|
|
|
909
1122
|
// ── Pipeline orchestrator path (version: 2 specs with depends_on_convoy) ──
|
|
910
1123
|
if (isPipelineSpec(spec)) {
|
|
@@ -1647,7 +1647,7 @@ Export
|
|
|
1647
1647
|
lifecycle: ['convoy_started', 'convoy_finished', 'convoy_failed'],
|
|
1648
1648
|
tasks: ['task_started', 'task_done', 'task_failed', 'task_assigned', 'task_skipped', 'task_retried', 'task_timed_out', 'task_gate_failed', 'task_hook_failed', 'task_wait_input'],
|
|
1649
1649
|
reviews: ['review_started', 'review_verdict', 'panel_started', 'panel_verdict'],
|
|
1650
|
-
system: ['circuit_breaker_open', 'circuit_breaker_close', 'circuit_breaker_half_open', 'merge_conflict_detected', 'merge_conflict_resolved', 'watch_started', 'watch_stopped', 'watch_cycle_start', 'watch_cycle_end', '
|
|
1650
|
+
system: ['circuit_breaker_open', 'circuit_breaker_close', 'circuit_breaker_half_open', 'merge_conflict_detected', 'merge_conflict_resolved', 'watch_started', 'watch_stopped', 'watch_cycle_start', 'watch_cycle_end', 'secret_leak_prevented'],
|
|
1651
1651
|
errors: []
|
|
1652
1652
|
};
|
|
1653
1653
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"hash": "
|
|
2
|
+
"hash": "d8392344",
|
|
3
3
|
"configHash": "30f8ea04",
|
|
4
|
-
"lockfileHash": "
|
|
5
|
-
"browserHash": "
|
|
4
|
+
"lockfileHash": "fa619691",
|
|
5
|
+
"browserHash": "f3c7cfa8",
|
|
6
6
|
"optimized": {
|
|
7
7
|
"astro > cssesc": {
|
|
8
8
|
"src": "../../../../../node_modules/cssesc/cssesc.js",
|
|
9
9
|
"file": "astro___cssesc.js",
|
|
10
|
-
"fileHash": "
|
|
10
|
+
"fileHash": "6b516f93",
|
|
11
11
|
"needsInterop": true
|
|
12
12
|
},
|
|
13
13
|
"astro > aria-query": {
|
|
14
14
|
"src": "../../../../../node_modules/aria-query/lib/index.js",
|
|
15
15
|
"file": "astro___aria-query.js",
|
|
16
|
-
"fileHash": "
|
|
16
|
+
"fileHash": "84b1235a",
|
|
17
17
|
"needsInterop": true
|
|
18
18
|
},
|
|
19
19
|
"astro > axobject-query": {
|
|
20
20
|
"src": "../../../../../node_modules/axobject-query/lib/index.js",
|
|
21
21
|
"file": "astro___axobject-query.js",
|
|
22
|
-
"fileHash": "
|
|
22
|
+
"fileHash": "aa764e20",
|
|
23
23
|
"needsInterop": true
|
|
24
24
|
}
|
|
25
25
|
},
|
|
@@ -1997,7 +1997,7 @@ try {
|
|
|
1997
1997
|
lifecycle: ['convoy_started', 'convoy_finished', 'convoy_failed'],
|
|
1998
1998
|
tasks: ['task_started', 'task_done', 'task_failed', 'task_assigned', 'task_skipped', 'task_retried', 'task_timed_out', 'task_gate_failed', 'task_hook_failed', 'task_wait_input'],
|
|
1999
1999
|
reviews: ['review_started', 'review_verdict', 'panel_started', 'panel_verdict'],
|
|
2000
|
-
system: ['circuit_breaker_open', 'circuit_breaker_close', 'circuit_breaker_half_open', 'merge_conflict_detected', 'merge_conflict_resolved', 'watch_started', 'watch_stopped', 'watch_cycle_start', 'watch_cycle_end', '
|
|
2000
|
+
system: ['circuit_breaker_open', 'circuit_breaker_close', 'circuit_breaker_half_open', 'merge_conflict_detected', 'merge_conflict_resolved', 'watch_started', 'watch_stopped', 'watch_cycle_start', 'watch_cycle_end', 'secret_leak_prevented'],
|
|
2001
2001
|
errors: []
|
|
2002
2002
|
};
|
|
2003
2003
|
|