@kbediako/codex-orchestrator 0.1.33 → 0.1.34
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 +19 -3
- package/codex.orchestrator.json +448 -0
- package/dist/bin/codex-orchestrator.js +365 -78
- package/dist/orchestrator/src/cli/config/repoConfigPolicy.js +22 -0
- package/dist/orchestrator/src/cli/config/userConfig.js +20 -9
- package/dist/orchestrator/src/cli/delegationSetup.js +111 -14
- package/dist/orchestrator/src/cli/doctor.js +82 -5
- package/dist/orchestrator/src/cli/doctorIssueLog.js +350 -0
- package/dist/orchestrator/src/cli/init.js +23 -0
- package/dist/orchestrator/src/cli/orchestrator.js +19 -3
- package/dist/orchestrator/src/cli/services/pipelineResolver.js +70 -18
- package/dist/orchestrator/src/cli/services/runPreparation.js +2 -0
- package/dist/orchestrator/src/cli/utils/commandPreview.js +10 -0
- package/dist/orchestrator/src/cli/utils/devtools.js +2 -1
- package/dist/orchestrator/src/cloud/CodexCloudTaskExecutor.js +21 -0
- package/docs/README.md +12 -7
- package/package.json +2 -1
|
@@ -84,6 +84,18 @@ export class CodexCloudTaskExecutor {
|
|
|
84
84
|
log_path: relative(input.repoRoot, commandLogPath),
|
|
85
85
|
error: null
|
|
86
86
|
};
|
|
87
|
+
const reportCloudExecution = async () => {
|
|
88
|
+
if (!input.onUpdate) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
await input.onUpdate({ ...cloudExecution });
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
notes.push(`Cloud execution update callback failed: ${error?.message ?? String(error)}`);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
await reportCloudExecution();
|
|
87
99
|
const statusRetryLimit = normalizePositiveInt(input.statusRetryLimit, DEFAULT_STATUS_RETRY_LIMIT, MAX_STATUS_RETRY_LIMIT);
|
|
88
100
|
const statusRetryBackoffMs = normalizePositiveInt(input.statusRetryBackoffMs, DEFAULT_STATUS_RETRY_BACKOFF_MS, MAX_STATUS_RETRY_BACKOFF_MS);
|
|
89
101
|
const runCloudCommand = async (args) => {
|
|
@@ -127,10 +139,12 @@ export class CodexCloudTaskExecutor {
|
|
|
127
139
|
cloudExecution.status = 'running';
|
|
128
140
|
cloudExecution.submitted_at = this.now();
|
|
129
141
|
notes.push(`Cloud task submitted: ${taskId}`);
|
|
142
|
+
await reportCloudExecution();
|
|
130
143
|
const metadata = await this.lookupTaskMetadata(taskId, runCloudCommand);
|
|
131
144
|
if (metadata?.url) {
|
|
132
145
|
cloudExecution.status_url = metadata.url;
|
|
133
146
|
}
|
|
147
|
+
await reportCloudExecution();
|
|
134
148
|
const timeoutAt = Date.now() + cloudExecution.timeout_seconds * 1000;
|
|
135
149
|
let statusRetries = 0;
|
|
136
150
|
let lastKnownStatus = cloudExecution.status;
|
|
@@ -148,6 +162,7 @@ export class CodexCloudTaskExecutor {
|
|
|
148
162
|
if (statusRetries > statusRetryLimit) {
|
|
149
163
|
throw new Error(`codex cloud status failed ${statusRetries} times: ${compactError(statusResult.stderr, statusResult.stdout)}`);
|
|
150
164
|
}
|
|
165
|
+
await reportCloudExecution();
|
|
151
166
|
const retryDelayMs = Math.min(statusRetryBackoffMs * statusRetries, Math.max(0, timeoutAt - Date.now()));
|
|
152
167
|
if (retryDelayMs > 0) {
|
|
153
168
|
await this.sleepFn(retryDelayMs);
|
|
@@ -164,18 +179,22 @@ export class CodexCloudTaskExecutor {
|
|
|
164
179
|
lastKnownStatus = mapped;
|
|
165
180
|
}
|
|
166
181
|
if (mapped === 'ready') {
|
|
182
|
+
await reportCloudExecution();
|
|
167
183
|
notes.push(`Cloud task completed: ${taskId}`);
|
|
168
184
|
break;
|
|
169
185
|
}
|
|
170
186
|
if (mapped === 'error' || mapped === 'failed' || mapped === 'cancelled') {
|
|
171
187
|
cloudExecution.error = `Cloud task ended with status ${mapped}.`;
|
|
188
|
+
await reportCloudExecution();
|
|
172
189
|
break;
|
|
173
190
|
}
|
|
191
|
+
await reportCloudExecution();
|
|
174
192
|
await this.sleepFn(cloudExecution.poll_interval_seconds * 1000);
|
|
175
193
|
}
|
|
176
194
|
if (cloudExecution.status === 'running' || cloudExecution.status === 'queued') {
|
|
177
195
|
cloudExecution.status = 'failed';
|
|
178
196
|
cloudExecution.error = `Timed out waiting for cloud task completion after ${cloudExecution.timeout_seconds}s (last remote status: ${lastKnownStatus}, polls: ${cloudExecution.poll_count}).`;
|
|
197
|
+
await reportCloudExecution();
|
|
179
198
|
}
|
|
180
199
|
if (cloudExecution.status === 'ready') {
|
|
181
200
|
const diffResult = await runCloudCommand(['cloud', 'diff', taskId]);
|
|
@@ -201,6 +220,7 @@ export class CodexCloudTaskExecutor {
|
|
|
201
220
|
cloudExecution.diff_status = 'unavailable';
|
|
202
221
|
}
|
|
203
222
|
cloudExecution.completed_at = this.now();
|
|
223
|
+
await reportCloudExecution();
|
|
204
224
|
const success = cloudExecution.status === 'ready';
|
|
205
225
|
const summary = success
|
|
206
226
|
? `Cloud task ${cloudExecution.task_id} completed successfully.`
|
|
@@ -215,6 +235,7 @@ export class CodexCloudTaskExecutor {
|
|
|
215
235
|
cloudExecution.diff_status = 'unavailable';
|
|
216
236
|
cloudExecution.error = error?.message ?? String(error);
|
|
217
237
|
cloudExecution.completed_at = this.now();
|
|
238
|
+
await reportCloudExecution();
|
|
218
239
|
const summary = `Cloud execution failed: ${cloudExecution.error}`;
|
|
219
240
|
notes.push(summary);
|
|
220
241
|
return { success: false, summary, notes, cloudExecution };
|
package/docs/README.md
CHANGED
|
@@ -100,10 +100,11 @@ Use `npx @kbediako/codex-orchestrator resume --run <run-id>` to continue interru
|
|
|
100
100
|
|
|
101
101
|
## Companion Package Commands
|
|
102
102
|
- `codex-orchestrator mcp serve [--repo <path>] [--dry-run] [-- <extra args>]`: launch the MCP stdio server (delegates to `codex mcp-server`; stdout guard keeps protocol-only output, logs to stderr).
|
|
103
|
-
- `codex-orchestrator init codex [--cwd <path>] [--force]`: copy starter templates into a repo (includes `mcp-client.json` and `
|
|
103
|
+
- `codex-orchestrator init codex [--cwd <path>] [--force]`: copy starter templates into a repo (includes `mcp-client.json`, `AGENTS.md`, and `codex.orchestrator.json`; no overwrite unless `--force`).
|
|
104
104
|
- `codex-orchestrator setup [--yes] [--refresh-skills]`: one-shot bootstrap for downstream users (installs bundled skills, configures delegation + DevTools wiring, and prints policy/usage guidance). By default, setup does not overwrite existing skills; add `--refresh-skills` when you want to replace existing bundled skill files.
|
|
105
|
-
- `codex-orchestrator
|
|
106
|
-
- `codex-orchestrator
|
|
105
|
+
- `codex-orchestrator start [pipeline] [--auto-issue-log] [--repo-config-required]`: starts a pipeline run. `--auto-issue-log` writes failure bundles automatically (including setup failures before manifest creation); `--repo-config-required` disables packaged config fallback.
|
|
106
|
+
- `codex-orchestrator flow [--task <task-id>] [--auto-issue-log] [--repo-config-required]`: runs `docs-review` then `implementation-gate` in sequence; stops on the first failure. `--auto-issue-log` writes failure bundles automatically (including setup failures before manifest creation); `--repo-config-required` disables packaged config fallback.
|
|
107
|
+
- `codex-orchestrator doctor [--format json] [--usage] [--cloud-preflight] [--issue-log] [--apply]`: check optional tooling dependencies plus collab/cloud/delegation readiness and print enablement commands. `--usage` appends a local usage snapshot (scans `.runs/`) with adoption KPIs. `--issue-log` appends/creates `docs/codex-orchestrator-issues.md` (or `--issue-log-path`) and writes a JSON bundle under `out/<resolved-task>/doctor/issue-bundles/` with doctor context plus latest run context when available. `--apply` plans/applies quick fixes (use with `--yes`).
|
|
107
108
|
- `codex-orchestrator devtools setup [--yes]`: print DevTools MCP setup instructions (`--yes` applies `codex mcp add ...`).
|
|
108
109
|
- `codex-orchestrator delegation setup [--yes]`: configure delegation MCP wiring (`--yes` applies `codex mcp add ...`).
|
|
109
110
|
- `codex-orchestrator skills install [--force] [--only <skills>] [--codex-home <path>]`: install bundled skills into `$CODEX_HOME/skills` (prefer global skills when installed; fall back to bundled skills, for example use `$CODEX_HOME/skills/docs-first` when present, otherwise `skills/docs-first/SKILL.md`).
|
|
@@ -149,14 +150,18 @@ Notes:
|
|
|
149
150
|
- Note: prompt installers and guardrail scripts live under `scripts/` and are repo-only (not included in the npm package).
|
|
150
151
|
- The custom prompts live outside the repo at `~/.codex/prompts/diagnostics.md` and `~/.codex/prompts/review-handoff.md`. Recreate those files on every fresh machine so `/prompts:diagnostics` and `/prompts:review-handoff` are available in the Codex CLI palette.
|
|
151
152
|
- Canonical diagnostics prompt + output expectations: `docs/diagnostics-prompt-guide.md` (keep in sync with `scripts/setup-codex-prompts.sh`).
|
|
152
|
-
- Standalone review guidance (
|
|
153
|
+
- Standalone review guidance (wrapper-first with `npm run review`, plus direct `codex review` quick mode): `docs/standalone-review-guide.md`.
|
|
153
154
|
- These prompts are consumed by the Codex CLI UI only; the orchestrator does not read them. Keep updates synced across machines during onboarding.
|
|
154
155
|
- To install or refresh the prompts (repo-only), run `scripts/setup-codex-prompts.sh` (use `--force` to overwrite existing files).
|
|
155
156
|
- `/prompts:diagnostics` takes `TASK=<task-id> MANIFEST=<path> [NOTES=<free text>]`, exports `MCP_RUNNER_TASK_ID=$TASK`, runs `npx @kbediako/codex-orchestrator start diagnostics --format json`, tails `.runs/$TASK/cli/<run-id>/manifest.json` (or `npx @kbediako/codex-orchestrator status --run <run-id> --watch --interval 10`), and records evidence to `/tasks`, `docs/TASKS.md`, `.agent/task/...`, `.runs/$TASK/metrics.json`, and `out/$TASK/state.json` using `$MANIFEST`.
|
|
156
157
|
- `/prompts:review-handoff` takes `TASK=<task-id> MANIFEST=<path> NOTES=<goal + summary + risks + optional questions>`, re-exports `MCP_RUNNER_TASK_ID`, and (repo-only) runs `node scripts/delegation-guard.mjs`, `node scripts/spec-guard.mjs --dry-run`, `npm run lint`, `npm run test`, optional `npm run eval:test`, plus `npm run review` (wraps `codex review` against the current diff and includes the latest run manifest path as evidence). It also reminds you to log approvals in `$MANIFEST` and mirror the evidence to the same docs/metrics/state targets.
|
|
157
158
|
- In CI / `--no-interactive` pipelines (or when stdin is not a TTY, or `CODEX_REVIEW_NON_INTERACTIVE=1` / `CODEX_NON_INTERACTIVE=1` / `CODEX_NO_INTERACTIVE=1`), `npm run review` prints the review handoff prompt (including evidence paths) and exits successfully instead of invoking `codex review`. Set `FORCE_CODEX_REVIEW=1` to run `codex review` in those environments.
|
|
158
|
-
-
|
|
159
|
-
-
|
|
159
|
+
- `npm run review` keeps delegation MCP enabled by default; disable for troubleshooting with `CODEX_REVIEW_DISABLE_DELEGATION_MCP=1` (or `--disable-delegation-mcp`). Legacy disable control (`CODEX_REVIEW_ENABLE_DELEGATION_MCP=0`) remains supported.
|
|
160
|
+
- `npm run review` allows unbounded runtime by default; set `CODEX_REVIEW_TIMEOUT_SECONDS`, `CODEX_REVIEW_STALL_TIMEOUT_SECONDS`, and/or `CODEX_REVIEW_STARTUP_LOOP_TIMEOUT_SECONDS` to opt into explicit guards (`0` disables each guard when set).
|
|
161
|
+
- `CODEX_REVIEW_STARTUP_LOOP_MIN_EVENTS` defaults to `8` when startup-loop timeout detection is enabled.
|
|
162
|
+
- `npm run review` emits patience-first monitor checkpoints every 60 seconds by default; set `CODEX_REVIEW_MONITOR_INTERVAL_SECONDS=<seconds>` to tune cadence (`0` disables checkpoints).
|
|
163
|
+
- `npm run review` detects large uncommitted scopes and injects a high-signal scope advisory into the review prompt; tune detection via `CODEX_REVIEW_LARGE_SCOPE_FILE_THRESHOLD` (default `25`) and `CODEX_REVIEW_LARGE_SCOPE_LINE_THRESHOLD` (default `1200`).
|
|
164
|
+
- Optional failure issue-bundle capture: set `CODEX_REVIEW_AUTO_ISSUE_LOG=1` (or pass `--auto-issue-log` to `npm run review -- ...`).
|
|
160
165
|
- Always trigger diagnostics and review workflows through these prompts whenever you run the orchestrator so contributors consistently execute the required command sequences and capture auditable manifests.
|
|
161
166
|
|
|
162
167
|
### Identifier Guardrails
|
|
@@ -211,7 +216,7 @@ Note: the commands below assume a source checkout; `scripts/` helpers are not in
|
|
|
211
216
|
| `node scripts/delegation-guard.mjs` | Enforces subagent delegation evidence before review (repo-only). |
|
|
212
217
|
| `node scripts/spec-guard.mjs --dry-run` | Validates spec freshness; required before review (repo-only). |
|
|
213
218
|
| `node scripts/diff-budget.mjs` | Guards against oversized diffs before review (repo-only; defaults: 25 files / 800 lines; supports explicit overrides). |
|
|
214
|
-
| `npm run review` | Runs `codex review` with
|
|
219
|
+
| `npm run review` | Runs `codex review` with task-scoped manifest evidence; delegation MCP is enabled by default (explicit disable available via `CODEX_REVIEW_DISABLE_DELEGATION_MCP=1` / `--disable-delegation-mcp`), runtime guards are opt-in via `CODEX_REVIEW_*` env vars, and patience-first checkpoints log by default (`CODEX_REVIEW_MONITOR_INTERVAL_SECONDS` tunes/disables). Large uncommitted scopes get an automatic prompt advisory (`CODEX_REVIEW_LARGE_SCOPE_FILE_THRESHOLD` / `CODEX_REVIEW_LARGE_SCOPE_LINE_THRESHOLD`). Optional auto failure issue logging via `CODEX_REVIEW_AUTO_ISSUE_LOG=1` or `--auto-issue-log`. |
|
|
215
220
|
|
|
216
221
|
Run `npm run build` to compile TypeScript before packaging or invoking the CLI directly from `dist/`.
|
|
217
222
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kbediako/codex-orchestrator",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"schemas/**",
|
|
26
26
|
"templates/**",
|
|
27
27
|
"skills/**",
|
|
28
|
+
"codex.orchestrator.json",
|
|
28
29
|
"docs/assets/setup.gif",
|
|
29
30
|
"README.md",
|
|
30
31
|
"LICENSE"
|