codex-orchestrator 0.1.50 → 2.0.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/CHANGELOG.md +27 -0
- package/README.md +45 -389
- package/dist/src/index.d.ts +16 -46
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -24
- package/dist/src/index.js.map +1 -1
- package/dist/src/v2/acceptance-proof.d.ts +111 -0
- package/dist/src/v2/acceptance-proof.d.ts.map +1 -0
- package/dist/src/v2/acceptance-proof.js +427 -0
- package/dist/src/v2/acceptance-proof.js.map +1 -0
- package/dist/src/v2/adapters/command.d.ts.map +1 -0
- package/dist/src/v2/adapters/command.js.map +1 -0
- package/dist/src/v2/adapters/durable-atomic-file.d.ts.map +1 -0
- package/dist/src/v2/adapters/durable-atomic-file.js.map +1 -0
- package/dist/src/v2/adapters/gh-cli.d.ts.map +1 -0
- package/dist/src/v2/adapters/gh-cli.js.map +1 -0
- package/dist/src/v2/adapters/gh-issue-adapter.d.ts.map +1 -0
- package/dist/src/v2/adapters/gh-issue-adapter.js.map +1 -0
- package/dist/src/v2/adapters/gh-pull-request-adapter.d.ts.map +1 -0
- package/dist/src/v2/adapters/gh-pull-request-adapter.js.map +1 -0
- package/dist/src/v2/adapters/issues.d.ts.map +1 -0
- package/dist/src/v2/adapters/issues.js.map +1 -0
- package/dist/src/v2/adapters/mission-coordinator-lock.d.ts.map +1 -0
- package/dist/src/v2/adapters/mission-coordinator-lock.js.map +1 -0
- package/dist/src/v2/adapters/path-policy.d.ts.map +1 -0
- package/dist/src/v2/adapters/path-policy.js.map +1 -0
- package/dist/src/v2/adapters/pull-requests.d.ts.map +1 -0
- package/dist/src/v2/adapters/pull-requests.js.map +1 -0
- package/dist/src/v2/adapters/target-activity-fence.d.ts.map +1 -0
- package/dist/src/{runner → v2/adapters}/target-activity-fence.js +1 -1
- package/dist/src/v2/adapters/target-activity-fence.js.map +1 -0
- package/dist/src/{git → v2/adapters}/worktree.d.ts +1 -1
- package/dist/src/v2/adapters/worktree.d.ts.map +1 -0
- package/dist/src/{git → v2/adapters}/worktree.js +2 -2
- package/dist/src/v2/adapters/worktree.js.map +1 -0
- package/dist/src/v2/atomic-store.d.ts +36 -0
- package/dist/src/v2/atomic-store.d.ts.map +1 -0
- package/dist/src/v2/atomic-store.js +328 -0
- package/dist/src/v2/atomic-store.js.map +1 -0
- package/dist/src/v2/candidate-cli.d.ts +22 -0
- package/dist/src/v2/candidate-cli.d.ts.map +1 -0
- package/dist/src/v2/candidate-cli.js +161 -0
- package/dist/src/v2/candidate-cli.js.map +1 -0
- package/dist/src/v2/checked-change.d.ts +49 -0
- package/dist/src/v2/checked-change.d.ts.map +1 -0
- package/dist/src/v2/checked-change.js +139 -0
- package/dist/src/v2/checked-change.js.map +1 -0
- package/dist/src/v2/cli-contract.d.ts +8 -0
- package/dist/src/v2/cli-contract.d.ts.map +1 -0
- package/dist/src/v2/cli-contract.js +32 -0
- package/dist/src/v2/cli-contract.js.map +1 -0
- package/dist/src/v2/codex-process.d.ts +71 -0
- package/dist/src/v2/codex-process.d.ts.map +1 -0
- package/dist/src/v2/codex-process.js +404 -0
- package/dist/src/v2/codex-process.js.map +1 -0
- package/dist/src/v2/config.d.ts +45 -0
- package/dist/src/v2/config.d.ts.map +1 -0
- package/dist/src/v2/config.js +139 -0
- package/dist/src/v2/config.js.map +1 -0
- package/dist/src/v2/containment.d.ts +55 -0
- package/dist/src/v2/containment.d.ts.map +1 -0
- package/dist/src/v2/containment.js +370 -0
- package/dist/src/v2/containment.js.map +1 -0
- package/dist/src/v2/implementation-report.d.ts +18 -0
- package/dist/src/v2/implementation-report.d.ts.map +1 -0
- package/dist/src/v2/implementation-report.js +147 -0
- package/dist/src/v2/implementation-report.js.map +1 -0
- package/dist/src/v2/legacy-cutover.d.ts +52 -0
- package/dist/src/v2/legacy-cutover.d.ts.map +1 -0
- package/dist/src/v2/legacy-cutover.js +87 -0
- package/dist/src/v2/legacy-cutover.js.map +1 -0
- package/dist/src/v2/mobile-lease.d.ts +97 -0
- package/dist/src/v2/mobile-lease.d.ts.map +1 -0
- package/dist/src/v2/mobile-lease.js +253 -0
- package/dist/src/v2/mobile-lease.js.map +1 -0
- package/dist/src/v2/proof-report.d.ts +118 -0
- package/dist/src/v2/proof-report.d.ts.map +1 -0
- package/dist/src/v2/proof-report.js +703 -0
- package/dist/src/v2/proof-report.js.map +1 -0
- package/dist/src/v2/proof-store.d.ts +42 -0
- package/dist/src/v2/proof-store.d.ts.map +1 -0
- package/dist/src/v2/proof-store.js +180 -0
- package/dist/src/v2/proof-store.js.map +1 -0
- package/dist/src/v2/report-envelope.d.ts +4 -0
- package/dist/src/v2/report-envelope.d.ts.map +1 -0
- package/dist/src/v2/report-envelope.js +46 -0
- package/dist/src/v2/report-envelope.js.map +1 -0
- package/dist/src/v2/run-issue.d.ts +213 -0
- package/dist/src/v2/run-issue.d.ts.map +1 -0
- package/dist/src/v2/run-issue.js +906 -0
- package/dist/src/v2/run-issue.js.map +1 -0
- package/dist/src/v2/run-store.d.ts +136 -0
- package/dist/src/v2/run-store.d.ts.map +1 -0
- package/dist/src/v2/run-store.js +346 -0
- package/dist/src/v2/run-store.js.map +1 -0
- package/dist/src/v2/runtime-assets.d.ts +31 -0
- package/dist/src/v2/runtime-assets.d.ts.map +1 -0
- package/dist/src/v2/runtime-assets.js +473 -0
- package/dist/src/v2/runtime-assets.js.map +1 -0
- package/dist/src/v2/runtime.d.ts +137 -0
- package/dist/src/v2/runtime.d.ts.map +1 -0
- package/dist/src/v2/runtime.js +847 -0
- package/dist/src/v2/runtime.js.map +1 -0
- package/dist/src/v2/setup-cli.d.ts +5 -0
- package/dist/src/v2/setup-cli.d.ts.map +1 -0
- package/dist/src/v2/setup-cli.js +83 -0
- package/dist/src/v2/setup-cli.js.map +1 -0
- package/dist/src/v2/setup-runtime.d.ts +6 -0
- package/dist/src/v2/setup-runtime.d.ts.map +1 -0
- package/dist/src/v2/setup-runtime.js +213 -0
- package/dist/src/v2/setup-runtime.js.map +1 -0
- package/dist/src/v2/setup-store.d.ts +19 -0
- package/dist/src/v2/setup-store.d.ts.map +1 -0
- package/dist/src/v2/setup-store.js +208 -0
- package/dist/src/v2/setup-store.js.map +1 -0
- package/dist/src/v2/setup.d.ts +147 -0
- package/dist/src/v2/setup.d.ts.map +1 -0
- package/dist/src/v2/setup.js +529 -0
- package/dist/src/v2/setup.js.map +1 -0
- package/docs/deep-dive.md +54 -803
- package/internal-skills/acceptance-proof/SKILL.md +14 -0
- package/internal-skills/acceptance-proof/references/android.md +14 -0
- package/internal-skills/acceptance-proof/references/browser.md +13 -0
- package/internal-skills/acceptance-proof/references/ios.md +14 -0
- package/internal-skills/acceptance-proof/tools/android-lease.mjs +280 -0
- package/internal-skills/acceptance-proof/tools/ios-lease.mjs +288 -0
- package/internal-skills/agent-auto/SKILL.md +14 -0
- package/package.json +11 -18
- package/bridge-runtime.json +0 -2719
- package/dist/src/bridge-runtime.d.ts +0 -17
- package/dist/src/bridge-runtime.d.ts.map +0 -1
- package/dist/src/bridge-runtime.js +0 -168
- package/dist/src/bridge-runtime.js.map +0 -1
- package/dist/src/cli.d.ts +0 -3
- package/dist/src/cli.d.ts.map +0 -1
- package/dist/src/cli.js +0 -569
- package/dist/src/cli.js.map +0 -1
- package/dist/src/codex/command-adapter.d.ts +0 -47
- package/dist/src/codex/command-adapter.d.ts.map +0 -1
- package/dist/src/codex/command-adapter.js +0 -169
- package/dist/src/codex/command-adapter.js.map +0 -1
- package/dist/src/codex/mobile-device-guard.d.ts +0 -7
- package/dist/src/codex/mobile-device-guard.d.ts.map +0 -1
- package/dist/src/codex/mobile-device-guard.js +0 -63
- package/dist/src/codex/mobile-device-guard.js.map +0 -1
- package/dist/src/config/constants.d.ts +0 -6
- package/dist/src/config/constants.d.ts.map +0 -1
- package/dist/src/config/constants.js +0 -19
- package/dist/src/config/constants.js.map +0 -1
- package/dist/src/config/schema.d.ts +0 -234
- package/dist/src/config/schema.d.ts.map +0 -1
- package/dist/src/config/schema.js +0 -673
- package/dist/src/config/schema.js.map +0 -1
- package/dist/src/fs/durable-atomic-file.d.ts.map +0 -1
- package/dist/src/fs/durable-atomic-file.js.map +0 -1
- package/dist/src/git/base-branch.d.ts +0 -26
- package/dist/src/git/base-branch.d.ts.map +0 -1
- package/dist/src/git/base-branch.js +0 -45
- package/dist/src/git/base-branch.js.map +0 -1
- package/dist/src/git/worktree.d.ts.map +0 -1
- package/dist/src/git/worktree.js.map +0 -1
- package/dist/src/github/gh-cli.d.ts.map +0 -1
- package/dist/src/github/gh-cli.js.map +0 -1
- package/dist/src/github/gh-issue-adapter.d.ts.map +0 -1
- package/dist/src/github/gh-issue-adapter.js.map +0 -1
- package/dist/src/github/gh-pull-request-adapter.d.ts.map +0 -1
- package/dist/src/github/gh-pull-request-adapter.js.map +0 -1
- package/dist/src/github/issues.d.ts.map +0 -1
- package/dist/src/github/issues.js.map +0 -1
- package/dist/src/github/pull-requests.d.ts.map +0 -1
- package/dist/src/github/pull-requests.js.map +0 -1
- package/dist/src/package-info.d.ts +0 -6
- package/dist/src/package-info.d.ts.map +0 -1
- package/dist/src/package-info.js +0 -13
- package/dist/src/package-info.js.map +0 -1
- package/dist/src/path-policy.d.ts.map +0 -1
- package/dist/src/path-policy.js.map +0 -1
- package/dist/src/process/command.d.ts.map +0 -1
- package/dist/src/process/command.js.map +0 -1
- package/dist/src/review-handoff.d.ts +0 -3
- package/dist/src/review-handoff.d.ts.map +0 -1
- package/dist/src/review-handoff.js +0 -8
- package/dist/src/review-handoff.js.map +0 -1
- package/dist/src/runner/acceptance-proof-loop.d.ts +0 -97
- package/dist/src/runner/acceptance-proof-loop.d.ts.map +0 -1
- package/dist/src/runner/acceptance-proof-loop.js +0 -404
- package/dist/src/runner/acceptance-proof-loop.js.map +0 -1
- package/dist/src/runner/acceptance-proof-runner.d.ts +0 -24
- package/dist/src/runner/acceptance-proof-runner.d.ts.map +0 -1
- package/dist/src/runner/acceptance-proof-runner.js +0 -121
- package/dist/src/runner/acceptance-proof-runner.js.map +0 -1
- package/dist/src/runner/acceptance-proof.d.ts +0 -189
- package/dist/src/runner/acceptance-proof.d.ts.map +0 -1
- package/dist/src/runner/acceptance-proof.js +0 -594
- package/dist/src/runner/acceptance-proof.js.map +0 -1
- package/dist/src/runner/agent-attempt.d.ts +0 -105
- package/dist/src/runner/agent-attempt.d.ts.map +0 -1
- package/dist/src/runner/agent-attempt.js +0 -245
- package/dist/src/runner/agent-attempt.js.map +0 -1
- package/dist/src/runner/android-visual-proof-command.d.ts +0 -26
- package/dist/src/runner/android-visual-proof-command.d.ts.map +0 -1
- package/dist/src/runner/android-visual-proof-command.js +0 -592
- package/dist/src/runner/android-visual-proof-command.js.map +0 -1
- package/dist/src/runner/auto-visual-proof-command.d.ts +0 -15
- package/dist/src/runner/auto-visual-proof-command.d.ts.map +0 -1
- package/dist/src/runner/auto-visual-proof-command.js +0 -64
- package/dist/src/runner/auto-visual-proof-command.js.map +0 -1
- package/dist/src/runner/browser-proof-contract.d.ts +0 -134
- package/dist/src/runner/browser-proof-contract.d.ts.map +0 -1
- package/dist/src/runner/browser-proof-contract.js +0 -400
- package/dist/src/runner/browser-proof-contract.js.map +0 -1
- package/dist/src/runner/browser-visual-proof-command.d.ts +0 -101
- package/dist/src/runner/browser-visual-proof-command.d.ts.map +0 -1
- package/dist/src/runner/browser-visual-proof-command.js +0 -532
- package/dist/src/runner/browser-visual-proof-command.js.map +0 -1
- package/dist/src/runner/command-utils.d.ts +0 -15
- package/dist/src/runner/command-utils.d.ts.map +0 -1
- package/dist/src/runner/command-utils.js +0 -228
- package/dist/src/runner/command-utils.js.map +0 -1
- package/dist/src/runner/completion-report.d.ts +0 -121
- package/dist/src/runner/completion-report.d.ts.map +0 -1
- package/dist/src/runner/completion-report.js +0 -381
- package/dist/src/runner/completion-report.js.map +0 -1
- package/dist/src/runner/context-snapshot.d.ts +0 -33
- package/dist/src/runner/context-snapshot.d.ts.map +0 -1
- package/dist/src/runner/context-snapshot.js +0 -99
- package/dist/src/runner/context-snapshot.js.map +0 -1
- package/dist/src/runner/daemon-command.d.ts +0 -30
- package/dist/src/runner/daemon-command.d.ts.map +0 -1
- package/dist/src/runner/daemon-command.js +0 -262
- package/dist/src/runner/daemon-command.js.map +0 -1
- package/dist/src/runner/doctor-command.d.ts +0 -41
- package/dist/src/runner/doctor-command.d.ts.map +0 -1
- package/dist/src/runner/doctor-command.js +0 -177
- package/dist/src/runner/doctor-command.js.map +0 -1
- package/dist/src/runner/durable-run-summary.d.ts +0 -80
- package/dist/src/runner/durable-run-summary.d.ts.map +0 -1
- package/dist/src/runner/durable-run-summary.js +0 -200
- package/dist/src/runner/durable-run-summary.js.map +0 -1
- package/dist/src/runner/flutter-sdk-discovery.d.ts +0 -5
- package/dist/src/runner/flutter-sdk-discovery.d.ts.map +0 -1
- package/dist/src/runner/flutter-sdk-discovery.js +0 -103
- package/dist/src/runner/flutter-sdk-discovery.js.map +0 -1
- package/dist/src/runner/fresh-context-review.d.ts +0 -22
- package/dist/src/runner/fresh-context-review.d.ts.map +0 -1
- package/dist/src/runner/fresh-context-review.js +0 -177
- package/dist/src/runner/fresh-context-review.js.map +0 -1
- package/dist/src/runner/handoff-evidence.d.ts +0 -141
- package/dist/src/runner/handoff-evidence.d.ts.map +0 -1
- package/dist/src/runner/handoff-evidence.js +0 -543
- package/dist/src/runner/handoff-evidence.js.map +0 -1
- package/dist/src/runner/hygiene-cleanup.d.ts +0 -15
- package/dist/src/runner/hygiene-cleanup.d.ts.map +0 -1
- package/dist/src/runner/hygiene-cleanup.js +0 -25
- package/dist/src/runner/hygiene-cleanup.js.map +0 -1
- package/dist/src/runner/ios-visual-proof-command.d.ts +0 -25
- package/dist/src/runner/ios-visual-proof-command.d.ts.map +0 -1
- package/dist/src/runner/ios-visual-proof-command.js +0 -353
- package/dist/src/runner/ios-visual-proof-command.js.map +0 -1
- package/dist/src/runner/issue-state-machine.d.ts +0 -39
- package/dist/src/runner/issue-state-machine.d.ts.map +0 -1
- package/dist/src/runner/issue-state-machine.js +0 -124
- package/dist/src/runner/issue-state-machine.js.map +0 -1
- package/dist/src/runner/issue-tree.d.ts +0 -65
- package/dist/src/runner/issue-tree.d.ts.map +0 -1
- package/dist/src/runner/issue-tree.js +0 -474
- package/dist/src/runner/issue-tree.js.map +0 -1
- package/dist/src/runner/lifecycle-events.d.ts +0 -44
- package/dist/src/runner/lifecycle-events.d.ts.map +0 -1
- package/dist/src/runner/lifecycle-events.js +0 -108
- package/dist/src/runner/lifecycle-events.js.map +0 -1
- package/dist/src/runner/local-execution-session.d.ts +0 -112
- package/dist/src/runner/local-execution-session.d.ts.map +0 -1
- package/dist/src/runner/local-execution-session.js +0 -1064
- package/dist/src/runner/local-execution-session.js.map +0 -1
- package/dist/src/runner/local-state.d.ts +0 -44
- package/dist/src/runner/local-state.d.ts.map +0 -1
- package/dist/src/runner/local-state.js +0 -150
- package/dist/src/runner/local-state.js.map +0 -1
- package/dist/src/runner/mission-activation.d.ts +0 -29
- package/dist/src/runner/mission-activation.d.ts.map +0 -1
- package/dist/src/runner/mission-activation.js +0 -54
- package/dist/src/runner/mission-activation.js.map +0 -1
- package/dist/src/runner/mission-agent-broker.d.ts +0 -53
- package/dist/src/runner/mission-agent-broker.d.ts.map +0 -1
- package/dist/src/runner/mission-agent-broker.js +0 -182
- package/dist/src/runner/mission-agent-broker.js.map +0 -1
- package/dist/src/runner/mission-cancellation.d.ts +0 -77
- package/dist/src/runner/mission-cancellation.d.ts.map +0 -1
- package/dist/src/runner/mission-cancellation.js +0 -180
- package/dist/src/runner/mission-cancellation.js.map +0 -1
- package/dist/src/runner/mission-canonical-path.d.ts +0 -34
- package/dist/src/runner/mission-canonical-path.d.ts.map +0 -1
- package/dist/src/runner/mission-canonical-path.js +0 -121
- package/dist/src/runner/mission-canonical-path.js.map +0 -1
- package/dist/src/runner/mission-capability-kernel.d.ts +0 -34
- package/dist/src/runner/mission-capability-kernel.d.ts.map +0 -1
- package/dist/src/runner/mission-capability-kernel.js +0 -158
- package/dist/src/runner/mission-capability-kernel.js.map +0 -1
- package/dist/src/runner/mission-check-policy.d.ts +0 -17
- package/dist/src/runner/mission-check-policy.d.ts.map +0 -1
- package/dist/src/runner/mission-check-policy.js +0 -31
- package/dist/src/runner/mission-check-policy.js.map +0 -1
- package/dist/src/runner/mission-coordinator-lock.d.ts.map +0 -1
- package/dist/src/runner/mission-coordinator-lock.js.map +0 -1
- package/dist/src/runner/mission-deployment.d.ts +0 -21
- package/dist/src/runner/mission-deployment.d.ts.map +0 -1
- package/dist/src/runner/mission-deployment.js +0 -108
- package/dist/src/runner/mission-deployment.js.map +0 -1
- package/dist/src/runner/mission-evaluation.d.ts +0 -61
- package/dist/src/runner/mission-evaluation.d.ts.map +0 -1
- package/dist/src/runner/mission-evaluation.js +0 -183
- package/dist/src/runner/mission-evaluation.js.map +0 -1
- package/dist/src/runner/mission-executor-probe.d.ts +0 -10
- package/dist/src/runner/mission-executor-probe.d.ts.map +0 -1
- package/dist/src/runner/mission-executor-probe.js +0 -180
- package/dist/src/runner/mission-executor-probe.js.map +0 -1
- package/dist/src/runner/mission-git-contracts.d.ts +0 -75
- package/dist/src/runner/mission-git-contracts.d.ts.map +0 -1
- package/dist/src/runner/mission-git-contracts.js +0 -201
- package/dist/src/runner/mission-git-contracts.js.map +0 -1
- package/dist/src/runner/mission-git-runtime-owner-ref.d.ts +0 -13
- package/dist/src/runner/mission-git-runtime-owner-ref.d.ts.map +0 -1
- package/dist/src/runner/mission-git-runtime-owner-ref.js +0 -111
- package/dist/src/runner/mission-git-runtime-owner-ref.js.map +0 -1
- package/dist/src/runner/mission-git-transaction.d.ts +0 -97
- package/dist/src/runner/mission-git-transaction.d.ts.map +0 -1
- package/dist/src/runner/mission-git-transaction.js +0 -1009
- package/dist/src/runner/mission-git-transaction.js.map +0 -1
- package/dist/src/runner/mission-identifiers.d.ts +0 -31
- package/dist/src/runner/mission-identifiers.d.ts.map +0 -1
- package/dist/src/runner/mission-identifiers.js +0 -75
- package/dist/src/runner/mission-identifiers.js.map +0 -1
- package/dist/src/runner/mission-input-snapshot.d.ts +0 -21
- package/dist/src/runner/mission-input-snapshot.d.ts.map +0 -1
- package/dist/src/runner/mission-input-snapshot.js +0 -63
- package/dist/src/runner/mission-input-snapshot.js.map +0 -1
- package/dist/src/runner/mission-ownership.d.ts +0 -38
- package/dist/src/runner/mission-ownership.d.ts.map +0 -1
- package/dist/src/runner/mission-ownership.js +0 -88
- package/dist/src/runner/mission-ownership.js.map +0 -1
- package/dist/src/runner/mission-patch-audit.d.ts +0 -21
- package/dist/src/runner/mission-patch-audit.d.ts.map +0 -1
- package/dist/src/runner/mission-patch-audit.js +0 -186
- package/dist/src/runner/mission-patch-audit.js.map +0 -1
- package/dist/src/runner/mission-path-language.d.ts +0 -6
- package/dist/src/runner/mission-path-language.d.ts.map +0 -1
- package/dist/src/runner/mission-path-language.js +0 -106
- package/dist/src/runner/mission-path-language.js.map +0 -1
- package/dist/src/runner/mission-permit-authority.d.ts +0 -26
- package/dist/src/runner/mission-permit-authority.d.ts.map +0 -1
- package/dist/src/runner/mission-permit-authority.js +0 -145
- package/dist/src/runner/mission-permit-authority.js.map +0 -1
- package/dist/src/runner/mission-plan-parent-coordinator.d.ts +0 -87
- package/dist/src/runner/mission-plan-parent-coordinator.d.ts.map +0 -1
- package/dist/src/runner/mission-plan-parent-coordinator.js +0 -441
- package/dist/src/runner/mission-plan-parent-coordinator.js.map +0 -1
- package/dist/src/runner/mission-plan-parent.d.ts +0 -156
- package/dist/src/runner/mission-plan-parent.d.ts.map +0 -1
- package/dist/src/runner/mission-plan-parent.js +0 -589
- package/dist/src/runner/mission-plan-parent.js.map +0 -1
- package/dist/src/runner/mission-process-executor.d.ts +0 -25
- package/dist/src/runner/mission-process-executor.d.ts.map +0 -1
- package/dist/src/runner/mission-process-executor.js +0 -182
- package/dist/src/runner/mission-process-executor.js.map +0 -1
- package/dist/src/runner/mission-publication-git.d.ts +0 -21
- package/dist/src/runner/mission-publication-git.d.ts.map +0 -1
- package/dist/src/runner/mission-publication-git.js +0 -61
- package/dist/src/runner/mission-publication-git.js.map +0 -1
- package/dist/src/runner/mission-publication.d.ts +0 -192
- package/dist/src/runner/mission-publication.d.ts.map +0 -1
- package/dist/src/runner/mission-publication.js +0 -1001
- package/dist/src/runner/mission-publication.js.map +0 -1
- package/dist/src/runner/mission-quarantine-patch-executor.d.ts +0 -29
- package/dist/src/runner/mission-quarantine-patch-executor.d.ts.map +0 -1
- package/dist/src/runner/mission-quarantine-patch-executor.js +0 -121
- package/dist/src/runner/mission-quarantine-patch-executor.js.map +0 -1
- package/dist/src/runner/mission-repository-executor.d.ts +0 -54
- package/dist/src/runner/mission-repository-executor.d.ts.map +0 -1
- package/dist/src/runner/mission-repository-executor.js +0 -192
- package/dist/src/runner/mission-repository-executor.js.map +0 -1
- package/dist/src/runner/mission-repository-observer.d.ts +0 -8
- package/dist/src/runner/mission-repository-observer.d.ts.map +0 -1
- package/dist/src/runner/mission-repository-observer.js +0 -24
- package/dist/src/runner/mission-repository-observer.js.map +0 -1
- package/dist/src/runner/mission-reservations.d.ts +0 -15
- package/dist/src/runner/mission-reservations.d.ts.map +0 -1
- package/dist/src/runner/mission-reservations.js +0 -116
- package/dist/src/runner/mission-reservations.js.map +0 -1
- package/dist/src/runner/mission-resolution-loop.d.ts +0 -172
- package/dist/src/runner/mission-resolution-loop.d.ts.map +0 -1
- package/dist/src/runner/mission-resolution-loop.js +0 -318
- package/dist/src/runner/mission-resolution-loop.js.map +0 -1
- package/dist/src/runner/mission-runtime-owner.d.ts +0 -36
- package/dist/src/runner/mission-runtime-owner.d.ts.map +0 -1
- package/dist/src/runner/mission-runtime-owner.js +0 -174
- package/dist/src/runner/mission-runtime-owner.js.map +0 -1
- package/dist/src/runner/mission-safe-executor.d.ts +0 -96
- package/dist/src/runner/mission-safe-executor.d.ts.map +0 -1
- package/dist/src/runner/mission-safe-executor.js +0 -288
- package/dist/src/runner/mission-safe-executor.js.map +0 -1
- package/dist/src/runner/mission-sandbox.d.ts +0 -16
- package/dist/src/runner/mission-sandbox.d.ts.map +0 -1
- package/dist/src/runner/mission-sandbox.js +0 -91
- package/dist/src/runner/mission-sandbox.js.map +0 -1
- package/dist/src/runner/mission-scheduler.d.ts +0 -57
- package/dist/src/runner/mission-scheduler.d.ts.map +0 -1
- package/dist/src/runner/mission-scheduler.js +0 -205
- package/dist/src/runner/mission-scheduler.js.map +0 -1
- package/dist/src/runner/mission-scope-expansion.d.ts +0 -47
- package/dist/src/runner/mission-scope-expansion.d.ts.map +0 -1
- package/dist/src/runner/mission-scope-expansion.js +0 -147
- package/dist/src/runner/mission-scope-expansion.js.map +0 -1
- package/dist/src/runner/mission-state-machine.d.ts +0 -118
- package/dist/src/runner/mission-state-machine.d.ts.map +0 -1
- package/dist/src/runner/mission-state-machine.js +0 -316
- package/dist/src/runner/mission-state-machine.js.map +0 -1
- package/dist/src/runner/mission-state-store.d.ts +0 -70
- package/dist/src/runner/mission-state-store.d.ts.map +0 -1
- package/dist/src/runner/mission-state-store.js +0 -916
- package/dist/src/runner/mission-state-store.js.map +0 -1
- package/dist/src/runner/mobile-device-lease.d.ts +0 -11
- package/dist/src/runner/mobile-device-lease.d.ts.map +0 -1
- package/dist/src/runner/mobile-device-lease.js +0 -121
- package/dist/src/runner/mobile-device-lease.js.map +0 -1
- package/dist/src/runner/mobile-visual-proof-command.d.ts +0 -17
- package/dist/src/runner/mobile-visual-proof-command.d.ts.map +0 -1
- package/dist/src/runner/mobile-visual-proof-command.js +0 -168
- package/dist/src/runner/mobile-visual-proof-command.js.map +0 -1
- package/dist/src/runner/plan-auto-command.d.ts +0 -35
- package/dist/src/runner/plan-auto-command.d.ts.map +0 -1
- package/dist/src/runner/plan-auto-command.js +0 -918
- package/dist/src/runner/plan-auto-command.js.map +0 -1
- package/dist/src/runner/plan-auto-recovery.d.ts +0 -83
- package/dist/src/runner/plan-auto-recovery.d.ts.map +0 -1
- package/dist/src/runner/plan-auto-recovery.js +0 -303
- package/dist/src/runner/plan-auto-recovery.js.map +0 -1
- package/dist/src/runner/prompt.d.ts +0 -68
- package/dist/src/runner/prompt.d.ts.map +0 -1
- package/dist/src/runner/prompt.js +0 -202
- package/dist/src/runner/prompt.js.map +0 -1
- package/dist/src/runner/proof-routing.d.ts +0 -73
- package/dist/src/runner/proof-routing.d.ts.map +0 -1
- package/dist/src/runner/proof-routing.js +0 -182
- package/dist/src/runner/proof-routing.js.map +0 -1
- package/dist/src/runner/proof-strategy.d.ts +0 -21
- package/dist/src/runner/proof-strategy.d.ts.map +0 -1
- package/dist/src/runner/proof-strategy.js +0 -26
- package/dist/src/runner/proof-strategy.js.map +0 -1
- package/dist/src/runner/recovery.d.ts +0 -25
- package/dist/src/runner/recovery.d.ts.map +0 -1
- package/dist/src/runner/recovery.js +0 -89
- package/dist/src/runner/recovery.js.map +0 -1
- package/dist/src/runner/review-gate-policy.d.ts +0 -13
- package/dist/src/runner/review-gate-policy.d.ts.map +0 -1
- package/dist/src/runner/review-gate-policy.js +0 -241
- package/dist/src/runner/review-gate-policy.js.map +0 -1
- package/dist/src/runner/review-gates.d.ts +0 -28
- package/dist/src/runner/review-gates.d.ts.map +0 -1
- package/dist/src/runner/review-gates.js +0 -328
- package/dist/src/runner/review-gates.js.map +0 -1
- package/dist/src/runner/rework-policy.d.ts +0 -48
- package/dist/src/runner/rework-policy.d.ts.map +0 -1
- package/dist/src/runner/rework-policy.js +0 -150
- package/dist/src/runner/rework-policy.js.map +0 -1
- package/dist/src/runner/run-log.d.ts +0 -18
- package/dist/src/runner/run-log.d.ts.map +0 -1
- package/dist/src/runner/run-log.js +0 -53
- package/dist/src/runner/run-log.js.map +0 -1
- package/dist/src/runner/runner-handoff-decision.d.ts +0 -48
- package/dist/src/runner/runner-handoff-decision.d.ts.map +0 -1
- package/dist/src/runner/runner-handoff-decision.js +0 -93
- package/dist/src/runner/runner-handoff-decision.js.map +0 -1
- package/dist/src/runner/safety.d.ts +0 -14
- package/dist/src/runner/safety.d.ts.map +0 -1
- package/dist/src/runner/safety.js +0 -31
- package/dist/src/runner/safety.js.map +0 -1
- package/dist/src/runner/scope-isolation-policy.d.ts +0 -17
- package/dist/src/runner/scope-isolation-policy.d.ts.map +0 -1
- package/dist/src/runner/scope-isolation-policy.js +0 -82
- package/dist/src/runner/scope-isolation-policy.js.map +0 -1
- package/dist/src/runner/scoped-auto-command.d.ts +0 -90
- package/dist/src/runner/scoped-auto-command.d.ts.map +0 -1
- package/dist/src/runner/scoped-auto-command.js +0 -561
- package/dist/src/runner/scoped-auto-command.js.map +0 -1
- package/dist/src/runner/scoped-recovery.d.ts +0 -78
- package/dist/src/runner/scoped-recovery.d.ts.map +0 -1
- package/dist/src/runner/scoped-recovery.js +0 -601
- package/dist/src/runner/scoped-recovery.js.map +0 -1
- package/dist/src/runner/session-home.d.ts +0 -8
- package/dist/src/runner/session-home.d.ts.map +0 -1
- package/dist/src/runner/session-home.js +0 -18
- package/dist/src/runner/session-home.js.map +0 -1
- package/dist/src/runner/status-command.d.ts +0 -38
- package/dist/src/runner/status-command.d.ts.map +0 -1
- package/dist/src/runner/status-command.js +0 -97
- package/dist/src/runner/status-command.js.map +0 -1
- package/dist/src/runner/target-activity-fence.d.ts.map +0 -1
- package/dist/src/runner/target-activity-fence.js.map +0 -1
- package/dist/src/runner/terminal-outcome.d.ts +0 -58
- package/dist/src/runner/terminal-outcome.d.ts.map +0 -1
- package/dist/src/runner/terminal-outcome.js +0 -73
- package/dist/src/runner/terminal-outcome.js.map +0 -1
- package/dist/src/runner/visual-proof-runner.d.ts +0 -27
- package/dist/src/runner/visual-proof-runner.d.ts.map +0 -1
- package/dist/src/runner/visual-proof-runner.js +0 -379
- package/dist/src/runner/visual-proof-runner.js.map +0 -1
- package/dist/src/runner/worktree-cleanup.d.ts +0 -27
- package/dist/src/runner/worktree-cleanup.d.ts.map +0 -1
- package/dist/src/runner/worktree-cleanup.js +0 -63
- package/dist/src/runner/worktree-cleanup.js.map +0 -1
- package/dist/src/setup/codex-command-resolver.d.ts +0 -10
- package/dist/src/setup/codex-command-resolver.d.ts.map +0 -1
- package/dist/src/setup/codex-command-resolver.js +0 -91
- package/dist/src/setup/codex-command-resolver.js.map +0 -1
- package/dist/src/setup/github-label-adapter.d.ts +0 -13
- package/dist/src/setup/github-label-adapter.d.ts.map +0 -1
- package/dist/src/setup/github-label-adapter.js +0 -28
- package/dist/src/setup/github-label-adapter.js.map +0 -1
- package/dist/src/setup/labels.d.ts +0 -27
- package/dist/src/setup/labels.d.ts.map +0 -1
- package/dist/src/setup/labels.js +0 -42
- package/dist/src/setup/labels.js.map +0 -1
- package/dist/src/setup/project-config.d.ts +0 -24
- package/dist/src/setup/project-config.d.ts.map +0 -1
- package/dist/src/setup/project-config.js +0 -678
- package/dist/src/setup/project-config.js.map +0 -1
- package/dist/src/setup/prompt-sync.d.ts +0 -14
- package/dist/src/setup/prompt-sync.d.ts.map +0 -1
- package/dist/src/setup/prompt-sync.js +0 -228
- package/dist/src/setup/prompt-sync.js.map +0 -1
- package/dist/src/setup/setup-command.d.ts +0 -29
- package/dist/src/setup/setup-command.d.ts.map +0 -1
- package/dist/src/setup/setup-command.js +0 -304
- package/dist/src/setup/setup-command.js.map +0 -1
- package/dist/src/setup/skill-runtime-v2-preparation.d.ts +0 -56
- package/dist/src/setup/skill-runtime-v2-preparation.d.ts.map +0 -1
- package/dist/src/setup/skill-runtime-v2-preparation.js +0 -304
- package/dist/src/setup/skill-runtime-v2-preparation.js.map +0 -1
- package/dist/src/setup/workflows.d.ts +0 -10
- package/dist/src/setup/workflows.d.ts.map +0 -1
- package/dist/src/setup/workflows.js +0 -41
- package/dist/src/setup/workflows.js.map +0 -1
- package/prompts/setup-skill.md +0 -12
- package/prompts/workflows/acceptance-proof.md +0 -29
- package/prompts/workflows/breakdown-review.md +0 -48
- package/prompts/workflows/issue-breakdown.md +0 -155
- package/prompts/workflows/issue-tree-orchestration.md +0 -163
- package/prompts/workflows/prd.md +0 -80
- package/prompts/workflows/scoped-implementation.md +0 -129
- package/prompts/workflows/triage.md +0 -149
- /package/dist/src/{process → v2/adapters}/command.d.ts +0 -0
- /package/dist/src/{process → v2/adapters}/command.js +0 -0
- /package/dist/src/{fs → v2/adapters}/durable-atomic-file.d.ts +0 -0
- /package/dist/src/{fs → v2/adapters}/durable-atomic-file.js +0 -0
- /package/dist/src/{github → v2/adapters}/gh-cli.d.ts +0 -0
- /package/dist/src/{github → v2/adapters}/gh-cli.js +0 -0
- /package/dist/src/{github → v2/adapters}/gh-issue-adapter.d.ts +0 -0
- /package/dist/src/{github → v2/adapters}/gh-issue-adapter.js +0 -0
- /package/dist/src/{github → v2/adapters}/gh-pull-request-adapter.d.ts +0 -0
- /package/dist/src/{github → v2/adapters}/gh-pull-request-adapter.js +0 -0
- /package/dist/src/{github → v2/adapters}/issues.d.ts +0 -0
- /package/dist/src/{github → v2/adapters}/issues.js +0 -0
- /package/dist/src/{runner → v2/adapters}/mission-coordinator-lock.d.ts +0 -0
- /package/dist/src/{runner → v2/adapters}/mission-coordinator-lock.js +0 -0
- /package/dist/src/{path-policy.d.ts → v2/adapters/path-policy.d.ts} +0 -0
- /package/dist/src/{path-policy.js → v2/adapters/path-policy.js} +0 -0
- /package/dist/src/{github → v2/adapters}/pull-requests.d.ts +0 -0
- /package/dist/src/{github → v2/adapters}/pull-requests.js +0 -0
- /package/dist/src/{runner → v2/adapters}/target-activity-fence.d.ts +0 -0
|
@@ -1,918 +0,0 @@
|
|
|
1
|
-
import { mkdir, readFile } from 'node:fs/promises';
|
|
2
|
-
import { hostname as osHostname } from 'node:os';
|
|
3
|
-
import { dirname, join, resolve } from 'node:path';
|
|
4
|
-
import { CodexCommandAdapter } from '../codex/command-adapter.js';
|
|
5
|
-
import { resolveBaseBranch } from '../git/base-branch.js';
|
|
6
|
-
import { GitMergeConflictError, GitWorktreeManager, renderBranchTemplate } from '../git/worktree.js';
|
|
7
|
-
import { GhCliIssueAdapter } from '../github/gh-issue-adapter.js';
|
|
8
|
-
import { GhCliPullRequestAdapter } from '../github/gh-pull-request-adapter.js';
|
|
9
|
-
import { defaultShellCommandExecutor } from '../process/command.js';
|
|
10
|
-
import { formatSessionTimestamp, readRunnerConfig, rereadRunnerConfigUnderFence, runConfiguredChecks, } from './command-utils.js';
|
|
11
|
-
import { buildChildBlockedReport, buildChildReviewReport, buildIssueTreePullRequestBody, buildIssueTreeReviewReport, buildParentBlockedReport, } from './handoff-evidence.js';
|
|
12
|
-
import { writeDurableRunSummary } from './durable-run-summary.js';
|
|
13
|
-
import { runFreshContextReviewIfEnabled } from './fresh-context-review.js';
|
|
14
|
-
import { writeContextSnapshot } from './context-snapshot.js';
|
|
15
|
-
import { readPlanAutoCompletionReport, } from './completion-report.js';
|
|
16
|
-
import { claimIssue, discoverIssueWork } from './issue-state-machine.js';
|
|
17
|
-
import { collectExecutableChildBatches, persistAutonomousChildNode, readAutonomousChildNodes, topologicalPlanNodes, } from './issue-tree.js';
|
|
18
|
-
import { RunnerLifecycleEventStore } from './lifecycle-events.js';
|
|
19
|
-
import { RunnerStateStore } from './local-state.js';
|
|
20
|
-
import { classifyPlanAutoBlockedChildRecovery, classifyPlanAutoCompletedChildRecovery, classifyPlanAutoParentRecovery, } from './plan-auto-recovery.js';
|
|
21
|
-
import { buildIssueTreeChildPrompt, buildPlanAutoPrompt, sessionPromptPath, sessionReportPath, writeDurablePrompt, } from './prompt.js';
|
|
22
|
-
import { runAgentAttemptLoop } from './agent-attempt.js';
|
|
23
|
-
import { evaluateParentRiskRoutingGate } from './review-gates.js';
|
|
24
|
-
import { buildBlockedHandoffEvidence, buildPromotionAsBlockedHandoffEvidence, buildReviewReadyHandoffEvidence, } from './runner-handoff-decision.js';
|
|
25
|
-
import { sessionLogPath } from './run-log.js';
|
|
26
|
-
import { cleanupSessionCodexHome, sessionCodexHomePath } from './session-home.js';
|
|
27
|
-
import { finishBlockedTerminalOutcome, finishReviewReadyCommentTerminalOutcome, finishReviewReadyTerminalOutcome, } from './terminal-outcome.js';
|
|
28
|
-
import { acquireTargetActivityFence } from './target-activity-fence.js';
|
|
29
|
-
class ChildExecutionBlockedError extends Error {
|
|
30
|
-
durableRunSummary;
|
|
31
|
-
freshContextReview;
|
|
32
|
-
acceptanceProof;
|
|
33
|
-
reworkAttempts;
|
|
34
|
-
constructor(message, durableRunSummary, freshContextReview, acceptanceProof, reworkAttempts) {
|
|
35
|
-
super(message);
|
|
36
|
-
this.durableRunSummary = durableRunSummary;
|
|
37
|
-
this.freshContextReview = freshContextReview;
|
|
38
|
-
this.acceptanceProof = acceptanceProof;
|
|
39
|
-
this.reworkAttempts = reworkAttempts;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
export async function runPlanAutoCommand(options) {
|
|
43
|
-
const targetRoot = resolve(options.targetRoot);
|
|
44
|
-
const config = await readRunnerConfig(targetRoot);
|
|
45
|
-
const lease = await acquireTargetActivityFence({
|
|
46
|
-
targetRoot,
|
|
47
|
-
stateDir: config.runner.stateDir,
|
|
48
|
-
mode: 'shared',
|
|
49
|
-
purpose: 'claim',
|
|
50
|
-
});
|
|
51
|
-
try {
|
|
52
|
-
await rereadRunnerConfigUnderFence(targetRoot, config.runner.stateDir);
|
|
53
|
-
return await runPlanAutoCommandFenced(options);
|
|
54
|
-
}
|
|
55
|
-
finally {
|
|
56
|
-
await lease.release();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async function runPlanAutoCommandFenced(options) {
|
|
60
|
-
const targetRoot = resolve(options.targetRoot);
|
|
61
|
-
const now = options.now ?? new Date();
|
|
62
|
-
const config = await readRunnerConfig(targetRoot);
|
|
63
|
-
const issueAdapter = options.issueAdapter ?? new GhCliIssueAdapter(config.github.owner, config.github.repo);
|
|
64
|
-
const pullRequestAdapter = options.pullRequestAdapter ?? new GhCliPullRequestAdapter(config.github.owner, config.github.repo);
|
|
65
|
-
const git = options.git ?? new GitWorktreeManager();
|
|
66
|
-
const shellExecutor = options.shellExecutor ?? defaultShellCommandExecutor;
|
|
67
|
-
const codexAdapter = options.codexAdapter ?? new CodexCommandAdapter(config);
|
|
68
|
-
const resolvedBase = await resolveBaseBranch({ targetRoot, base: config.branches.base });
|
|
69
|
-
const parentIssue = await issueAdapter.getIssue(options.issueNumber);
|
|
70
|
-
if (!parentIssue) {
|
|
71
|
-
throw new Error(`Issue #${options.issueNumber} was not found`);
|
|
72
|
-
}
|
|
73
|
-
const branchName = renderBranchTemplate(config.branches.issueTree, { parentIssueNumber: options.issueNumber });
|
|
74
|
-
const worktreePath = join(targetRoot, config.runner.workspaceRoot, `tree-${options.issueNumber}`);
|
|
75
|
-
const store = new RunnerStateStore(targetRoot, config);
|
|
76
|
-
const parentRecovery = await classifyPlanAutoParentRecovery({
|
|
77
|
-
targetRoot,
|
|
78
|
-
config,
|
|
79
|
-
parentIssue,
|
|
80
|
-
branchName,
|
|
81
|
-
worktreePath,
|
|
82
|
-
baseSha: resolvedBase.sha,
|
|
83
|
-
state: await store.load(),
|
|
84
|
-
git,
|
|
85
|
-
now,
|
|
86
|
-
hostname: options.hostname,
|
|
87
|
-
processProbe: options.processProbe,
|
|
88
|
-
});
|
|
89
|
-
const decision = discoverIssueWork([parentIssue], config)[0];
|
|
90
|
-
const parentLabels = new Set(parentIssue.labels.map((label) => label.name));
|
|
91
|
-
const alreadyRunningPlanParent = decision?.kind === 'skipped'
|
|
92
|
-
&& decision.reasonCode === 'already-running'
|
|
93
|
-
&& parentIssue.state === 'OPEN'
|
|
94
|
-
&& parentLabels.has(config.github.labels.planAuto.name)
|
|
95
|
-
&& !parentLabels.has(config.github.labels.child.name);
|
|
96
|
-
if (!decision || !((decision.kind === 'eligible' && decision.mode === 'plan-parent') || alreadyRunningPlanParent)) {
|
|
97
|
-
const reason = decision?.kind === 'skipped' ? decision.reason : 'not agent:plan-auto';
|
|
98
|
-
throw new Error(`Issue #${options.issueNumber} is not eligible for agent:plan-auto planning: ${reason}`);
|
|
99
|
-
}
|
|
100
|
-
const workflowPrompts = await readPlanWorkflowPrompts(targetRoot, config);
|
|
101
|
-
const issueTreeWorkflowPrompt = await readIssueTreeWorkflowPrompt(targetRoot, config);
|
|
102
|
-
const acceptanceProofWorkflowPrompt = await readAcceptanceProofWorkflowPrompt(targetRoot, config);
|
|
103
|
-
let promptPath = '';
|
|
104
|
-
let reportPath = '';
|
|
105
|
-
let logPath = '';
|
|
106
|
-
let sessionId = '';
|
|
107
|
-
let parentSnapshotPath = '';
|
|
108
|
-
const childIssues = [];
|
|
109
|
-
let pullRequest;
|
|
110
|
-
const executionResults = [];
|
|
111
|
-
const events = new RunnerLifecycleEventStore(targetRoot, config);
|
|
112
|
-
const buildBase = () => baseResult(options.issueNumber, branchName, worktreePath, promptPath, reportPath, logPath, childIssues, sessionId, parentSnapshotPath);
|
|
113
|
-
if (parentRecovery.kind === 'hard-block') {
|
|
114
|
-
return finishPlanBlocked(issueAdapter, config, events, buildBase(), [parentRecovery.reason], childIssues, parentRecovery.marker);
|
|
115
|
-
}
|
|
116
|
-
if (alreadyRunningPlanParent && parentRecovery.kind !== 'resume-parent') {
|
|
117
|
-
return finishPlanBlocked(issueAdapter, config, events, buildBase(), ['parent recovery requires runner-owned metadata for running parent'], childIssues, `plan-auto-recovery-blocked parent=${options.issueNumber} reason=missing-runner-owned-metadata`);
|
|
118
|
-
}
|
|
119
|
-
if (!alreadyRunningPlanParent) {
|
|
120
|
-
await claimIssue(issueAdapter, config, options.issueNumber, 'plan-parent', now);
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
if (parentRecovery.kind === 'resume-parent') {
|
|
124
|
-
await git.ensureIssueWorktree({
|
|
125
|
-
targetRoot,
|
|
126
|
-
workspacePath: worktreePath,
|
|
127
|
-
branchName,
|
|
128
|
-
baseBranch: resolvedBase.sha,
|
|
129
|
-
requiredBaseSha: resolvedBase.sha,
|
|
130
|
-
allowResume: true,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
await git.createIssueWorktree({
|
|
135
|
-
targetRoot,
|
|
136
|
-
workspacePath: worktreePath,
|
|
137
|
-
branchName,
|
|
138
|
-
baseBranch: resolvedBase.sha,
|
|
139
|
-
requiredBaseSha: resolvedBase.sha,
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
sessionId = `plan-${options.issueNumber}-${formatSessionTimestamp(now)}`;
|
|
143
|
-
promptPath = sessionPromptPath({ targetRoot, config, issueNumber: options.issueNumber, sessionId });
|
|
144
|
-
reportPath = sessionReportPath({ targetRoot, config, issueNumber: options.issueNumber, sessionId });
|
|
145
|
-
logPath = sessionLogPath({ targetRoot, config, issueNumber: options.issueNumber, sessionId });
|
|
146
|
-
const isolatedHomePath = sessionCodexHomePath({ targetRoot, sessionId });
|
|
147
|
-
await mkdir(dirname(reportPath), { recursive: true });
|
|
148
|
-
await mkdir(isolatedHomePath, { recursive: true });
|
|
149
|
-
const promptText = buildPlanAutoPrompt({
|
|
150
|
-
parentIssue,
|
|
151
|
-
config,
|
|
152
|
-
prompts: workflowPrompts,
|
|
153
|
-
promptPath,
|
|
154
|
-
reportPath,
|
|
155
|
-
branchName,
|
|
156
|
-
worktreePath,
|
|
157
|
-
});
|
|
158
|
-
await writeDurablePrompt({
|
|
159
|
-
targetRoot,
|
|
160
|
-
config,
|
|
161
|
-
issueNumber: options.issueNumber,
|
|
162
|
-
sessionId,
|
|
163
|
-
promptText,
|
|
164
|
-
});
|
|
165
|
-
const snapshot = await writeContextSnapshot({
|
|
166
|
-
targetRoot,
|
|
167
|
-
config,
|
|
168
|
-
issue: parentIssue,
|
|
169
|
-
mode: 'plan-parent',
|
|
170
|
-
phase: 'plan-parent',
|
|
171
|
-
decision: 'parent planning session',
|
|
172
|
-
sessionId,
|
|
173
|
-
worktreePath,
|
|
174
|
-
promptPath,
|
|
175
|
-
reportPath,
|
|
176
|
-
logPath,
|
|
177
|
-
branchName,
|
|
178
|
-
baseBranch: resolvedBase.prBaseBranch,
|
|
179
|
-
base: resolvedBase,
|
|
180
|
-
createdAt: now,
|
|
181
|
-
});
|
|
182
|
-
parentSnapshotPath = snapshot.path;
|
|
183
|
-
await safeAppendEvent(events, {
|
|
184
|
-
timestamp: now,
|
|
185
|
-
issueNumber: options.issueNumber,
|
|
186
|
-
mode: 'plan-parent',
|
|
187
|
-
sessionId,
|
|
188
|
-
phase: 'plan-parent',
|
|
189
|
-
status: 'started',
|
|
190
|
-
summary: 'Starting parent planning Codex session.',
|
|
191
|
-
artifacts: sessionArtifacts(promptPath, reportPath, logPath, snapshot.path),
|
|
192
|
-
});
|
|
193
|
-
await store.upsertRun({
|
|
194
|
-
issueNumber: options.issueNumber,
|
|
195
|
-
mode: 'plan-parent',
|
|
196
|
-
workspacePath: worktreePath,
|
|
197
|
-
sessionId,
|
|
198
|
-
branchName,
|
|
199
|
-
promptPath,
|
|
200
|
-
reportPath,
|
|
201
|
-
logPath,
|
|
202
|
-
retryCount: 0,
|
|
203
|
-
createdAt: now.toISOString(),
|
|
204
|
-
updatedAt: now.toISOString(),
|
|
205
|
-
ownerPid: process.pid,
|
|
206
|
-
host: (options.hostname ?? osHostname)(),
|
|
207
|
-
leaseUpdatedAt: now.toISOString(),
|
|
208
|
-
baseSha: resolvedBase.sha,
|
|
209
|
-
});
|
|
210
|
-
const beforeHead = await git.getHead(worktreePath);
|
|
211
|
-
let codexResult;
|
|
212
|
-
try {
|
|
213
|
-
codexResult = await codexAdapter.run({
|
|
214
|
-
targetRoot,
|
|
215
|
-
config,
|
|
216
|
-
worktreePath,
|
|
217
|
-
promptPath,
|
|
218
|
-
promptText,
|
|
219
|
-
reportPath,
|
|
220
|
-
isolatedHomePath,
|
|
221
|
-
issueNumber: options.issueNumber,
|
|
222
|
-
sessionId,
|
|
223
|
-
branchName,
|
|
224
|
-
phase: 'plan-parent',
|
|
225
|
-
logPath,
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
finally {
|
|
229
|
-
await cleanupSessionCodexHome(isolatedHomePath);
|
|
230
|
-
}
|
|
231
|
-
const afterHead = await git.getHead(worktreePath);
|
|
232
|
-
const base = buildBase();
|
|
233
|
-
if (beforeHead !== afterHead) {
|
|
234
|
-
return finishPlanBlocked(issueAdapter, config, events, base, ['Planning session changed git HEAD; planning must not commit.'], []);
|
|
235
|
-
}
|
|
236
|
-
const changedFiles = await git.listChangedFiles(worktreePath);
|
|
237
|
-
if (changedFiles.length > 0) {
|
|
238
|
-
return finishPlanBlocked(issueAdapter, config, events, base, ['Planning session changed repository files; planning must return structured output only.'], []);
|
|
239
|
-
}
|
|
240
|
-
if (codexResult.exitCode !== 0) {
|
|
241
|
-
return finishPlanBlocked(issueAdapter, config, events, base, [`Codex exited with code ${codexResult.exitCode}: ${codexResult.stderr || codexResult.stdout}`], []);
|
|
242
|
-
}
|
|
243
|
-
const reportRead = await readPlanReport(reportPath);
|
|
244
|
-
if (reportRead.kind === 'missing') {
|
|
245
|
-
return finishPlanBlocked(issueAdapter, config, events, base, ['Codex did not write CODEX_ORCHESTRATOR_REPORT_FILE; runner cannot prove planning graph.'], []);
|
|
246
|
-
}
|
|
247
|
-
const report = reportRead.report;
|
|
248
|
-
const parentRiskRouting = evaluateParentRiskRoutingGate({ config, report });
|
|
249
|
-
const riskRoutingWarnings = parentRiskRouting.warnings;
|
|
250
|
-
if (!parentRiskRouting.ok) {
|
|
251
|
-
return finishPlanBlocked(issueAdapter, config, events, base, parentRiskRouting.reasons, []);
|
|
252
|
-
}
|
|
253
|
-
await issueAdapter.updateIssue(options.issueNumber, {
|
|
254
|
-
title: report.parent.title,
|
|
255
|
-
body: report.parent.body,
|
|
256
|
-
});
|
|
257
|
-
for (const node of topologicalPlanNodes(report.graph)) {
|
|
258
|
-
const persisted = await persistAutonomousChildNode(issueAdapter, config, options.issueNumber, node);
|
|
259
|
-
childIssues.push(persisted);
|
|
260
|
-
}
|
|
261
|
-
const childNodes = await readAutonomousChildNodes(issueAdapter, config, options.issueNumber, childIssues);
|
|
262
|
-
const childRecoveryState = await store.load();
|
|
263
|
-
const childRecoveryDecisions = await Promise.all(childNodes.map(async (child) => {
|
|
264
|
-
const completed = await classifyPlanAutoCompletedChildRecovery({
|
|
265
|
-
targetRoot,
|
|
266
|
-
config,
|
|
267
|
-
parentIssueNumber: options.issueNumber,
|
|
268
|
-
parentBranchName: branchName,
|
|
269
|
-
child,
|
|
270
|
-
state: childRecoveryState,
|
|
271
|
-
git,
|
|
272
|
-
});
|
|
273
|
-
return completed.kind === 'execute-child'
|
|
274
|
-
? classifyPlanAutoBlockedChildRecovery({
|
|
275
|
-
targetRoot,
|
|
276
|
-
config,
|
|
277
|
-
parentIssueNumber: options.issueNumber,
|
|
278
|
-
child,
|
|
279
|
-
state: childRecoveryState,
|
|
280
|
-
git,
|
|
281
|
-
})
|
|
282
|
-
: completed;
|
|
283
|
-
}));
|
|
284
|
-
const recoveredStableIds = [];
|
|
285
|
-
const resumableBlockedStableIds = [];
|
|
286
|
-
const childRecoveryByStableId = new Map();
|
|
287
|
-
for (const decision of childRecoveryDecisions) {
|
|
288
|
-
if (decision.kind === 'hard-block') {
|
|
289
|
-
return finishPlanBlocked(issueAdapter, config, events, buildBase(), [decision.reason], childIssues, decision.marker);
|
|
290
|
-
}
|
|
291
|
-
if (decision.kind === 'recovered-completed-child') {
|
|
292
|
-
recoveredStableIds.push(decision.child.metadata.stableId);
|
|
293
|
-
executionResults.push({
|
|
294
|
-
child: decision.child,
|
|
295
|
-
branchName: decision.branchName,
|
|
296
|
-
worktreePath: decision.worktreePath,
|
|
297
|
-
promptPath: decision.promptPath,
|
|
298
|
-
reportPath: decision.reportPath,
|
|
299
|
-
logPath: decision.logPath,
|
|
300
|
-
changedFiles: decision.changedFiles,
|
|
301
|
-
validation: decision.validation,
|
|
302
|
-
artifacts: [],
|
|
303
|
-
commits: [],
|
|
304
|
-
skippedChecks: decision.skippedChecks,
|
|
305
|
-
residualRisks: decision.residualRisks,
|
|
306
|
-
durableRunSummary: decision.durableRunSummary,
|
|
307
|
-
recovered: true,
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
else if (decision.kind === 'resume-child-rework') {
|
|
311
|
-
resumableBlockedStableIds.push(decision.child.metadata.stableId);
|
|
312
|
-
childRecoveryByStableId.set(decision.child.metadata.stableId, decision);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
const batches = collectExecutableChildBatches(childNodes, config, recoveredStableIds, resumableBlockedStableIds);
|
|
316
|
-
if (!batches.ok) {
|
|
317
|
-
return finishPlanBlocked(issueAdapter, config, events, base, batches.errors, childIssues);
|
|
318
|
-
}
|
|
319
|
-
for (const batch of batches.batches) {
|
|
320
|
-
const settled = await Promise.allSettled(batch.map((child) => executeChild({
|
|
321
|
-
targetRoot,
|
|
322
|
-
config,
|
|
323
|
-
parentIssue,
|
|
324
|
-
child,
|
|
325
|
-
dependencyIssues: dependencyIssuesFor(child, childNodes),
|
|
326
|
-
parentBranchName: branchName,
|
|
327
|
-
issueAdapter,
|
|
328
|
-
git,
|
|
329
|
-
codexAdapter,
|
|
330
|
-
shellExecutor,
|
|
331
|
-
issueTreeWorkflowPrompt,
|
|
332
|
-
acceptanceProofWorkflowPrompt,
|
|
333
|
-
now,
|
|
334
|
-
events,
|
|
335
|
-
recovery: childRecoveryByStableId.get(child.metadata.stableId),
|
|
336
|
-
})));
|
|
337
|
-
const failures = [];
|
|
338
|
-
for (const [index, result] of settled.entries()) {
|
|
339
|
-
if (result.status === 'fulfilled') {
|
|
340
|
-
continue;
|
|
341
|
-
}
|
|
342
|
-
failures.push({
|
|
343
|
-
child: batch[index],
|
|
344
|
-
message: result.reason instanceof Error ? result.reason.message : 'child execution failed',
|
|
345
|
-
durableRunSummary: result.reason instanceof ChildExecutionBlockedError ? result.reason.durableRunSummary : undefined,
|
|
346
|
-
freshContextReview: result.reason instanceof ChildExecutionBlockedError ? result.reason.freshContextReview : undefined,
|
|
347
|
-
acceptanceProof: result.reason instanceof ChildExecutionBlockedError ? result.reason.acceptanceProof : undefined,
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
if (failures.length > 0) {
|
|
351
|
-
const successful = settled.flatMap((result) => result.status === 'fulfilled' ? [result.value] : []);
|
|
352
|
-
await blockFailedBatch(issueAdapter, config, options.issueNumber, failures, successful);
|
|
353
|
-
await blockCompletedChildren(issueAdapter, config, store, options.issueNumber, executionResults, 'A later child batch failed before parent publication.', worktreePath);
|
|
354
|
-
return finishPlanBlocked(issueAdapter, config, events, buildBase(), [
|
|
355
|
-
'Child batch failed before merge; no child from the failed batch was merged, pushed, or published.',
|
|
356
|
-
...failures.map((failure) => failure.child ? `#${failure.child.issue.number}: ${failure.message}` : failure.message),
|
|
357
|
-
], childIssues);
|
|
358
|
-
}
|
|
359
|
-
const batchResults = settled.flatMap((result) => result.status === 'fulfilled' ? [result.value] : []);
|
|
360
|
-
const orderedBatchResults = batchResults.sort((left, right) => left.child.issue.number - right.child.issue.number);
|
|
361
|
-
for (const childResult of orderedBatchResults) {
|
|
362
|
-
try {
|
|
363
|
-
await git.mergeBranch({
|
|
364
|
-
worktreePath,
|
|
365
|
-
branchName: childResult.branchName,
|
|
366
|
-
message: `Codex: merge issue #${childResult.child.issue.number} into parent #${options.issueNumber}`,
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
catch (error) {
|
|
370
|
-
if (error instanceof GitMergeConflictError) {
|
|
371
|
-
await handleMergeConflict(git, issueAdapter, config, options.issueNumber, error, childResult, orderedBatchResults);
|
|
372
|
-
await blockCompletedChildren(issueAdapter, config, store, options.issueNumber, executionResults, `A later merge conflict stopped parent publication before ${branchName} was pushed.`, worktreePath);
|
|
373
|
-
return finishPlanBlocked(issueAdapter, config, events, buildBase(), [
|
|
374
|
-
`Merge conflict while merging #${childResult.child.issue.number} from ${childResult.branchName}.`,
|
|
375
|
-
error.stderr || error.stdout,
|
|
376
|
-
], childIssues);
|
|
377
|
-
}
|
|
378
|
-
throw error;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
for (const childResult of orderedBatchResults) {
|
|
382
|
-
await git.removeWorktree({ targetRoot, worktreePath: childResult.worktreePath });
|
|
383
|
-
executionResults.push(childResult);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
const finalValidation = await runConfiguredChecks(config, worktreePath, shellExecutor, [], { phase: 'parent-integration' });
|
|
387
|
-
const failedFinalValidation = finalValidation.filter((line) => line.status === 'failed');
|
|
388
|
-
if (failedFinalValidation.length > 0) {
|
|
389
|
-
await blockCompletedChildren(issueAdapter, config, store, options.issueNumber, executionResults, 'Parent integration configured checks failed before publication.', worktreePath);
|
|
390
|
-
return finishPlanBlocked(issueAdapter, config, events, buildBase(), [
|
|
391
|
-
'One or more configured checks failed.',
|
|
392
|
-
...failedFinalValidation.map((line) => `${line.command}: ${line.status} - ${line.summary}`),
|
|
393
|
-
], childIssues);
|
|
394
|
-
}
|
|
395
|
-
const handoff = await finishReviewReadyTerminalOutcome({
|
|
396
|
-
issueNumber: options.issueNumber,
|
|
397
|
-
config,
|
|
398
|
-
branchName,
|
|
399
|
-
baseBranch: resolvedBase.prBaseBranch,
|
|
400
|
-
worktreePath,
|
|
401
|
-
git,
|
|
402
|
-
pullRequestAdapter,
|
|
403
|
-
issueAdapter,
|
|
404
|
-
pullRequest: {
|
|
405
|
-
title: renderParentTemplate(config.pullRequests.issueTreeTitle, options.issueNumber),
|
|
406
|
-
body: buildIssueTreePullRequestBody({
|
|
407
|
-
parentIssueNumber: options.issueNumber,
|
|
408
|
-
childIssues,
|
|
409
|
-
childResults: executionResults,
|
|
410
|
-
finalValidation,
|
|
411
|
-
sizeRisk: report.sizeRisk,
|
|
412
|
-
parentReviewHandoff: report.parentReviewHandoff,
|
|
413
|
-
riskRoutingWarnings,
|
|
414
|
-
}),
|
|
415
|
-
},
|
|
416
|
-
findExistingPullRequest: false,
|
|
417
|
-
reportComment: (verifiedPullRequest) => buildIssueTreeReviewReport({
|
|
418
|
-
parentIssueNumber: options.issueNumber,
|
|
419
|
-
pullRequest: verifiedPullRequest,
|
|
420
|
-
batches: batches.batches,
|
|
421
|
-
childResults: executionResults,
|
|
422
|
-
finalValidation,
|
|
423
|
-
sizeRisk: report.sizeRisk,
|
|
424
|
-
parentReviewHandoff: report.parentReviewHandoff,
|
|
425
|
-
riskRoutingWarnings,
|
|
426
|
-
}),
|
|
427
|
-
onPullRequestReady: (verifiedPullRequest) => {
|
|
428
|
-
pullRequest = verifiedPullRequest;
|
|
429
|
-
},
|
|
430
|
-
beforeIssueMutation: () => markCompletedChildrenReviewReady(issueAdapter, config, store, options.issueNumber, executionResults),
|
|
431
|
-
afterComment: () => store.removeRun(options.issueNumber),
|
|
432
|
-
});
|
|
433
|
-
await safeAppendEvent(events, {
|
|
434
|
-
issueNumber: options.issueNumber,
|
|
435
|
-
mode: 'plan-parent',
|
|
436
|
-
sessionId,
|
|
437
|
-
phase: 'plan-parent',
|
|
438
|
-
status: 'completed',
|
|
439
|
-
summary: 'Issue-tree execution completed draft PR handoff.',
|
|
440
|
-
artifacts: [
|
|
441
|
-
...sessionArtifacts(promptPath, reportPath, logPath, parentSnapshotPath),
|
|
442
|
-
{ kind: 'pr', url: handoff.pullRequest.url, description: 'Draft pull request' },
|
|
443
|
-
],
|
|
444
|
-
});
|
|
445
|
-
return {
|
|
446
|
-
...buildBase(),
|
|
447
|
-
status: 'review-ready',
|
|
448
|
-
pullRequest: handoff.pullRequest,
|
|
449
|
-
reportComment: handoff.reportComment,
|
|
450
|
-
riskRoutingWarnings,
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
catch (error) {
|
|
454
|
-
const message = error instanceof Error ? error.message : 'plan-auto planning failed';
|
|
455
|
-
if (pullRequest) {
|
|
456
|
-
throw new Error(`Issue-tree execution failed after draft PR creation (${pullRequest.url}); not marking parent blocked: ${message}`);
|
|
457
|
-
}
|
|
458
|
-
if (executionResults.length > 0) {
|
|
459
|
-
await blockCompletedChildren(issueAdapter, config, store, options.issueNumber, executionResults, `Parent publication failed before review handoff: ${message}`, worktreePath);
|
|
460
|
-
}
|
|
461
|
-
return finishPlanBlocked(issueAdapter, config, events, buildBase(), [message], childIssues);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
async function readPlanReport(reportPath) {
|
|
465
|
-
try {
|
|
466
|
-
return await readPlanAutoCompletionReport(reportPath);
|
|
467
|
-
}
|
|
468
|
-
catch (error) {
|
|
469
|
-
const message = error instanceof Error ? error.message : 'Invalid plan-auto completion report';
|
|
470
|
-
throw new Error(message);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
async function readPlanWorkflowPrompts(targetRoot, config) {
|
|
474
|
-
return {
|
|
475
|
-
prd: await readPlanWorkflowPrompt(targetRoot, config.workflows.prd.promptPath),
|
|
476
|
-
issueBreakdown: await readPlanWorkflowPrompt(targetRoot, config.workflows.issueBreakdown.promptPath),
|
|
477
|
-
breakdownReview: await readPlanWorkflowPrompt(targetRoot, config.workflows.breakdownReview.promptPath),
|
|
478
|
-
triage: await readPlanWorkflowPrompt(targetRoot, config.workflows.triage.promptPath),
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
async function readPlanWorkflowPrompt(targetRoot, promptPath) {
|
|
482
|
-
return readWorkflowPrompt(targetRoot, promptPath, 'Plan-auto workflow prompt');
|
|
483
|
-
}
|
|
484
|
-
async function readIssueTreeWorkflowPrompt(targetRoot, config) {
|
|
485
|
-
return readWorkflowPrompt(targetRoot, config.workflows.issueTreeOrchestration.promptPath, 'Issue-tree orchestration workflow prompt');
|
|
486
|
-
}
|
|
487
|
-
async function readAcceptanceProofWorkflowPrompt(targetRoot, config) {
|
|
488
|
-
return readWorkflowPrompt(targetRoot, config.workflows.acceptanceProof.promptPath, 'Acceptance proof workflow prompt');
|
|
489
|
-
}
|
|
490
|
-
async function readWorkflowPrompt(targetRoot, promptPath, promptName) {
|
|
491
|
-
const absolutePath = promptPath ? join(targetRoot, promptPath) : 'undefined';
|
|
492
|
-
try {
|
|
493
|
-
return await readFile(absolutePath, 'utf8');
|
|
494
|
-
}
|
|
495
|
-
catch (error) {
|
|
496
|
-
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
|
497
|
-
throw new Error(`${promptName} not found at ${absolutePath}`);
|
|
498
|
-
}
|
|
499
|
-
throw error;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
async function executeChild(input) {
|
|
503
|
-
const childIssueNumber = input.child.issue.number;
|
|
504
|
-
const branchName = `codex/tree-${input.parentIssue.number}-issue-${childIssueNumber}`;
|
|
505
|
-
const worktreePath = join(input.targetRoot, input.config.runner.workspaceRoot, `tree-${input.parentIssue.number}-issue-${childIssueNumber}`);
|
|
506
|
-
let sessionId = '';
|
|
507
|
-
let promptPath = '';
|
|
508
|
-
let reportPath = '';
|
|
509
|
-
let logPath = '';
|
|
510
|
-
let snapshotPath = '';
|
|
511
|
-
if (input.recovery) {
|
|
512
|
-
await input.git.ensureIssueWorktree({
|
|
513
|
-
targetRoot: input.targetRoot,
|
|
514
|
-
workspacePath: worktreePath,
|
|
515
|
-
branchName,
|
|
516
|
-
baseBranch: input.parentBranchName,
|
|
517
|
-
allowResume: true,
|
|
518
|
-
});
|
|
519
|
-
await input.issueAdapter.removeLabels(childIssueNumber, [input.config.github.labels.blocked.name]);
|
|
520
|
-
await input.issueAdapter.addLabels(childIssueNumber, [input.config.github.labels.running.name]);
|
|
521
|
-
}
|
|
522
|
-
else {
|
|
523
|
-
await input.git.createIssueWorktree({
|
|
524
|
-
targetRoot: input.targetRoot,
|
|
525
|
-
workspacePath: worktreePath,
|
|
526
|
-
branchName,
|
|
527
|
-
baseBranch: input.parentBranchName,
|
|
528
|
-
});
|
|
529
|
-
await input.issueAdapter.addLabels(childIssueNumber, [input.config.github.labels.running.name]);
|
|
530
|
-
await input.issueAdapter.postComment(childIssueNumber, `codex-orchestrator: claimed #${childIssueNumber} for tree-child autonomous work under #${input.parentIssue.number} at ${input.now.toISOString()}.`);
|
|
531
|
-
}
|
|
532
|
-
const attemptLoop = await runAgentAttemptLoop({
|
|
533
|
-
targetRoot: input.targetRoot,
|
|
534
|
-
config: input.config,
|
|
535
|
-
issue: input.child.issue,
|
|
536
|
-
issueNumber: childIssueNumber,
|
|
537
|
-
parentIssueNumber: input.parentIssue.number,
|
|
538
|
-
mode: 'tree-child',
|
|
539
|
-
phase: 'tree-child',
|
|
540
|
-
branchName,
|
|
541
|
-
worktreePath,
|
|
542
|
-
baseBranch: input.parentBranchName,
|
|
543
|
-
createdAt: input.now,
|
|
544
|
-
firstAttempt: input.recovery ? input.recovery.rework.attempt : 0,
|
|
545
|
-
initialRework: input.recovery?.rework,
|
|
546
|
-
buildSessionId: ({ attempt, attemptNow }) => `tree-${input.parentIssue.number}-issue-${childIssueNumber}-${formatSessionTimestamp(attemptNow)}${attempt === 0 ? '' : `-attempt-${attempt}`}`,
|
|
547
|
-
buildPrompt: ({ promptPath: attemptPromptPath, reportPath: attemptReportPath, rework }) => {
|
|
548
|
-
const promptText = buildIssueTreeChildPrompt({
|
|
549
|
-
parentIssue: input.parentIssue,
|
|
550
|
-
childIssue: input.child.issue,
|
|
551
|
-
config: input.config,
|
|
552
|
-
workflowPromptText: input.issueTreeWorkflowPrompt,
|
|
553
|
-
childMetadata: input.child.metadata,
|
|
554
|
-
dependencyIssues: input.dependencyIssues,
|
|
555
|
-
promptPath: attemptPromptPath,
|
|
556
|
-
reportPath: attemptReportPath,
|
|
557
|
-
branchName,
|
|
558
|
-
worktreePath,
|
|
559
|
-
});
|
|
560
|
-
return rework
|
|
561
|
-
? `${promptText}\n\n## Rework Request\nThis is an automatic rework attempt (#${rework.attempt}). Continue from the current worktree state; do not start over.\nThe previous attempt was blocked for these reasons:\n${rework.blockedReasons.map((reason) => `- ${reason}`).join('\n')}\n${rework.disableOptionalFigmaMcp ? 'Optional Figma MCP failed in the previous attempt. Continue without optional Figma MCP access unless the issue explicitly requires Figma.\n' : ''}Address the blockers, then produce a fresh completion report JSON for the runner.`
|
|
562
|
-
: promptText;
|
|
563
|
-
},
|
|
564
|
-
buildSnapshotDecision: ({ rework }) => rework
|
|
565
|
-
? `tree-child rework attempt #${rework.attempt} under parent #${input.parentIssue.number}`
|
|
566
|
-
: `child issue execution under parent #${input.parentIssue.number}`,
|
|
567
|
-
startedSummary: ({ rework }) => rework ? `Starting tree-child rework attempt #${rework.attempt}.` : 'Starting tree-child Codex session.',
|
|
568
|
-
reworkScheduledSummary: ({ nextAttempt }) => `Runner scheduled tree-child rework attempt #${nextAttempt}.`,
|
|
569
|
-
missingPublishabilityMessage: 'Runner internal error: missing child publishability result',
|
|
570
|
-
codexAdapter: input.codexAdapter,
|
|
571
|
-
git: input.git,
|
|
572
|
-
shellExecutor: input.shellExecutor,
|
|
573
|
-
commitMessage: `Codex: implement issue #${childIssueNumber} for parent #${input.parentIssue.number}`,
|
|
574
|
-
events: input.events,
|
|
575
|
-
acceptanceProof: {
|
|
576
|
-
targetRoot: input.targetRoot,
|
|
577
|
-
workflowPromptText: input.acceptanceProofWorkflowPrompt,
|
|
578
|
-
codexAdapter: input.codexAdapter,
|
|
579
|
-
},
|
|
580
|
-
onAcceptanceProofAttemptEvent: ({ sessionId: attemptSessionId, event }) => appendAcceptanceProofEvent({
|
|
581
|
-
events: input.events,
|
|
582
|
-
issueNumber: childIssueNumber,
|
|
583
|
-
parentIssueNumber: input.parentIssue.number,
|
|
584
|
-
sessionId: attemptSessionId,
|
|
585
|
-
event,
|
|
586
|
-
}),
|
|
587
|
-
});
|
|
588
|
-
const publishability = attemptLoop.publishability;
|
|
589
|
-
sessionId = attemptLoop.sessionId;
|
|
590
|
-
promptPath = attemptLoop.promptPath;
|
|
591
|
-
reportPath = attemptLoop.reportPath;
|
|
592
|
-
logPath = attemptLoop.logPath;
|
|
593
|
-
snapshotPath = attemptLoop.snapshotPath;
|
|
594
|
-
const reworkAttempts = attemptLoop.reworkAttempts;
|
|
595
|
-
if (publishability.status === 'promotion-requested') {
|
|
596
|
-
const promotion = publishability.report.promotion;
|
|
597
|
-
const evidence = buildPromotionAsBlockedHandoffEvidence({
|
|
598
|
-
publishability,
|
|
599
|
-
fallbackReason: 'Child requested promotion instead of completing issue-tree work.',
|
|
600
|
-
nextAction: 'Parent issue-tree execution is blocked until this child is resolved.',
|
|
601
|
-
});
|
|
602
|
-
const durableRunSummary = await writeDurableRunSummary({
|
|
603
|
-
targetRoot: input.targetRoot,
|
|
604
|
-
config: input.config,
|
|
605
|
-
issueNumber: childIssueNumber,
|
|
606
|
-
sessionId,
|
|
607
|
-
outcome: evidence.outcome,
|
|
608
|
-
changedFiles: evidence.changedFiles,
|
|
609
|
-
validation: evidence.validation,
|
|
610
|
-
blockers: evidence.blockers,
|
|
611
|
-
skippedChecks: evidence.skippedChecks,
|
|
612
|
-
residualRisks: evidence.residualRisks,
|
|
613
|
-
nextAction: evidence.nextAction,
|
|
614
|
-
logPath,
|
|
615
|
-
reportPath,
|
|
616
|
-
acceptanceProof: evidence.acceptanceProof,
|
|
617
|
-
reworkAttempts,
|
|
618
|
-
});
|
|
619
|
-
const message = [
|
|
620
|
-
'Child requested promotion instead of completing issue-tree work.',
|
|
621
|
-
promotion ? `Reason: ${promotion.reason}` : undefined,
|
|
622
|
-
promotion ? `Evidence: ${promotion.evidence.join(', ')}` : undefined,
|
|
623
|
-
].filter(Boolean).join(' ');
|
|
624
|
-
throw new ChildExecutionBlockedError(message, durableRunSummary, undefined, evidence.acceptanceProof, reworkAttempts);
|
|
625
|
-
}
|
|
626
|
-
if (publishability.status === 'blocked') {
|
|
627
|
-
const evidence = buildBlockedHandoffEvidence({
|
|
628
|
-
publishability,
|
|
629
|
-
nextAction: 'Parent issue-tree execution is blocked until this child is resolved.',
|
|
630
|
-
});
|
|
631
|
-
const durableRunSummary = await writeDurableRunSummary({
|
|
632
|
-
targetRoot: input.targetRoot,
|
|
633
|
-
config: input.config,
|
|
634
|
-
issueNumber: childIssueNumber,
|
|
635
|
-
sessionId,
|
|
636
|
-
outcome: evidence.outcome,
|
|
637
|
-
changedFiles: evidence.changedFiles,
|
|
638
|
-
validation: evidence.validation,
|
|
639
|
-
blockers: evidence.blockers,
|
|
640
|
-
skippedChecks: evidence.skippedChecks,
|
|
641
|
-
residualRisks: evidence.residualRisks,
|
|
642
|
-
nextAction: evidence.nextAction,
|
|
643
|
-
logPath,
|
|
644
|
-
reportPath,
|
|
645
|
-
acceptanceProof: evidence.acceptanceProof,
|
|
646
|
-
reworkAttempts,
|
|
647
|
-
});
|
|
648
|
-
throw new ChildExecutionBlockedError(evidence.blockers.join('; '), durableRunSummary, undefined, evidence.acceptanceProof, reworkAttempts);
|
|
649
|
-
}
|
|
650
|
-
const freshContextReview = await runFreshContextReviewIfEnabled({
|
|
651
|
-
targetRoot: input.targetRoot,
|
|
652
|
-
config: input.config,
|
|
653
|
-
issue: input.child.issue,
|
|
654
|
-
codexAdapter: input.codexAdapter,
|
|
655
|
-
worktreePath,
|
|
656
|
-
isolatedSessionId: `${sessionId}-fresh-review`,
|
|
657
|
-
branchName,
|
|
658
|
-
publishability,
|
|
659
|
-
});
|
|
660
|
-
if (freshContextReview?.status === 'blocked') {
|
|
661
|
-
const evidence = buildBlockedHandoffEvidence({
|
|
662
|
-
publishability,
|
|
663
|
-
freshContextReview,
|
|
664
|
-
nextAction: 'Parent issue-tree execution is blocked until this child review finding is resolved.',
|
|
665
|
-
});
|
|
666
|
-
const durableRunSummary = await writeDurableRunSummary({
|
|
667
|
-
targetRoot: input.targetRoot,
|
|
668
|
-
config: input.config,
|
|
669
|
-
issueNumber: childIssueNumber,
|
|
670
|
-
sessionId,
|
|
671
|
-
outcome: evidence.outcome,
|
|
672
|
-
changedFiles: evidence.changedFiles,
|
|
673
|
-
validation: evidence.validation,
|
|
674
|
-
blockers: evidence.blockers,
|
|
675
|
-
skippedChecks: evidence.skippedChecks,
|
|
676
|
-
residualRisks: evidence.residualRisks,
|
|
677
|
-
suggestionEvidence: evidence.suggestionEvidence,
|
|
678
|
-
nextAction: evidence.nextAction,
|
|
679
|
-
logPath,
|
|
680
|
-
reportPath,
|
|
681
|
-
acceptanceProof: evidence.acceptanceProof,
|
|
682
|
-
reworkAttempts,
|
|
683
|
-
});
|
|
684
|
-
throw new ChildExecutionBlockedError(evidence.blockers.join('; '), durableRunSummary, freshContextReview, evidence.acceptanceProof, reworkAttempts);
|
|
685
|
-
}
|
|
686
|
-
const evidence = buildReviewReadyHandoffEvidence({
|
|
687
|
-
publishability,
|
|
688
|
-
freshContextReview,
|
|
689
|
-
nextAction: 'Parent issue-tree integration should merge this child branch.',
|
|
690
|
-
});
|
|
691
|
-
const durableRunSummary = await writeDurableRunSummary({
|
|
692
|
-
targetRoot: input.targetRoot,
|
|
693
|
-
config: input.config,
|
|
694
|
-
issueNumber: childIssueNumber,
|
|
695
|
-
sessionId,
|
|
696
|
-
outcome: evidence.outcome,
|
|
697
|
-
changedFiles: evidence.changedFiles,
|
|
698
|
-
validation: evidence.validation,
|
|
699
|
-
blockers: evidence.blockers,
|
|
700
|
-
skippedChecks: evidence.skippedChecks,
|
|
701
|
-
residualRisks: evidence.residualRisks,
|
|
702
|
-
suggestionEvidence: evidence.suggestionEvidence,
|
|
703
|
-
nextAction: evidence.nextAction,
|
|
704
|
-
logPath,
|
|
705
|
-
reportPath,
|
|
706
|
-
acceptanceProof: evidence.acceptanceProof,
|
|
707
|
-
reworkAttempts,
|
|
708
|
-
});
|
|
709
|
-
return {
|
|
710
|
-
child: input.child,
|
|
711
|
-
branchName,
|
|
712
|
-
worktreePath,
|
|
713
|
-
promptPath,
|
|
714
|
-
reportPath,
|
|
715
|
-
logPath,
|
|
716
|
-
changedFiles: publishability.changedFiles,
|
|
717
|
-
validation: publishability.validation,
|
|
718
|
-
artifacts: publishability.artifacts,
|
|
719
|
-
commits: publishability.commits,
|
|
720
|
-
skippedChecks: publishability.skippedChecks,
|
|
721
|
-
residualRisks: evidence.residualRisks,
|
|
722
|
-
reviewHandoff: publishability.report.reviewHandoff,
|
|
723
|
-
freshContextReview,
|
|
724
|
-
durableRunSummary,
|
|
725
|
-
acceptanceProof: publishability.acceptanceProofAttempt,
|
|
726
|
-
};
|
|
727
|
-
}
|
|
728
|
-
async function blockFailedBatch(issueAdapter, config, parentIssueNumber, failures, successfulUnmerged) {
|
|
729
|
-
for (const failure of failures) {
|
|
730
|
-
if (!failure.child) {
|
|
731
|
-
continue;
|
|
732
|
-
}
|
|
733
|
-
await finishBlockedTerminalOutcome({
|
|
734
|
-
issueNumber: failure.child.issue.number,
|
|
735
|
-
config,
|
|
736
|
-
issueAdapter,
|
|
737
|
-
reportComment: buildChildBlockedReport({
|
|
738
|
-
parentIssueNumber,
|
|
739
|
-
childIssueNumber: failure.child.issue.number,
|
|
740
|
-
reasons: [failure.message],
|
|
741
|
-
details: ['Worktree preserved for maintainer inspection.'],
|
|
742
|
-
freshContextReview: failure.freshContextReview,
|
|
743
|
-
durableRunSummary: failure.durableRunSummary,
|
|
744
|
-
reworkAttempts: failure.reworkAttempts,
|
|
745
|
-
acceptanceProof: failure.acceptanceProof,
|
|
746
|
-
}),
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
|
-
for (const result of successfulUnmerged) {
|
|
750
|
-
await finishBlockedTerminalOutcome({
|
|
751
|
-
issueNumber: result.child.issue.number,
|
|
752
|
-
config,
|
|
753
|
-
issueAdapter,
|
|
754
|
-
reportComment: buildChildBlockedReport({
|
|
755
|
-
parentIssueNumber,
|
|
756
|
-
childIssueNumber: result.child.issue.number,
|
|
757
|
-
reasons: ['A sibling child failed before the batch merge; this child branch was not merged.'],
|
|
758
|
-
branchName: result.branchName,
|
|
759
|
-
worktreePath: result.worktreePath,
|
|
760
|
-
durableRunSummary: result.durableRunSummary,
|
|
761
|
-
acceptanceProof: result.acceptanceProof,
|
|
762
|
-
}),
|
|
763
|
-
});
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
async function handleMergeConflict(git, issueAdapter, config, parentIssueNumber, error, childResult, batchResults) {
|
|
767
|
-
let abortMessage = '';
|
|
768
|
-
try {
|
|
769
|
-
await git.abortMerge(error.worktreePath);
|
|
770
|
-
}
|
|
771
|
-
catch (abortError) {
|
|
772
|
-
abortMessage = abortError instanceof Error ? abortError.message : 'merge abort failed';
|
|
773
|
-
}
|
|
774
|
-
for (const result of batchResults) {
|
|
775
|
-
await finishBlockedTerminalOutcome({
|
|
776
|
-
issueNumber: result.child.issue.number,
|
|
777
|
-
config,
|
|
778
|
-
issueAdapter,
|
|
779
|
-
reportComment: buildChildBlockedReport({
|
|
780
|
-
parentIssueNumber,
|
|
781
|
-
childIssueNumber: result.child.issue.number,
|
|
782
|
-
reasons: [
|
|
783
|
-
result.child.issue.number === childResult.child.issue.number
|
|
784
|
-
? `Merge conflict from branch ${childResult.branchName}`
|
|
785
|
-
: `A sibling merge conflict stopped the batch before publication: ${childResult.branchName}`,
|
|
786
|
-
],
|
|
787
|
-
details: [
|
|
788
|
-
`- Parent worktree: ${error.worktreePath}`,
|
|
789
|
-
`- Child worktree: ${result.worktreePath}`,
|
|
790
|
-
`- Child branch preserved: ${result.branchName}`,
|
|
791
|
-
abortMessage ? `- Merge abort also failed: ${abortMessage}` : '- Merge abort completed.',
|
|
792
|
-
],
|
|
793
|
-
batchChildren: batchResults.map((batchResult) => ({
|
|
794
|
-
issueNumber: batchResult.child.issue.number,
|
|
795
|
-
branchName: batchResult.branchName,
|
|
796
|
-
})),
|
|
797
|
-
gitOutput: error.stderr || error.stdout || 'no git output',
|
|
798
|
-
durableRunSummary: result.durableRunSummary,
|
|
799
|
-
acceptanceProof: result.acceptanceProof,
|
|
800
|
-
}),
|
|
801
|
-
});
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
async function markCompletedChildrenReviewReady(issueAdapter, config, store, parentIssueNumber, childResults) {
|
|
805
|
-
for (const childResult of childResults) {
|
|
806
|
-
if (childResult.recovered) {
|
|
807
|
-
await store.removeRun(childResult.child.issue.number);
|
|
808
|
-
continue;
|
|
809
|
-
}
|
|
810
|
-
await finishReviewReadyCommentTerminalOutcome({
|
|
811
|
-
issueNumber: childResult.child.issue.number,
|
|
812
|
-
config,
|
|
813
|
-
issueAdapter,
|
|
814
|
-
reportComment: buildChildReviewReport({ parentIssueNumber, result: childResult }),
|
|
815
|
-
afterTerminalMutation: () => store.removeRun(childResult.child.issue.number),
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
async function blockCompletedChildren(issueAdapter, config, store, parentIssueNumber, childResults, reason, parentWorktreePath) {
|
|
820
|
-
for (const result of childResults) {
|
|
821
|
-
if (result.recovered) {
|
|
822
|
-
continue;
|
|
823
|
-
}
|
|
824
|
-
await finishBlockedTerminalOutcome({
|
|
825
|
-
issueNumber: result.child.issue.number,
|
|
826
|
-
config,
|
|
827
|
-
issueAdapter,
|
|
828
|
-
reportComment: buildChildBlockedReport({
|
|
829
|
-
parentIssueNumber,
|
|
830
|
-
childIssueNumber: result.child.issue.number,
|
|
831
|
-
reasons: [reason],
|
|
832
|
-
details: [
|
|
833
|
-
`- Merged child branch was not published: ${result.branchName}`,
|
|
834
|
-
`- Parent worktree preserved: ${parentWorktreePath}`,
|
|
835
|
-
],
|
|
836
|
-
durableRunSummary: result.durableRunSummary,
|
|
837
|
-
acceptanceProof: result.acceptanceProof,
|
|
838
|
-
}),
|
|
839
|
-
afterTerminalMutation: () => store.removeRun(result.child.issue.number),
|
|
840
|
-
});
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
async function finishPlanBlocked(issueAdapter, config, events, result, reasons, mutatedChildren, commentMarker) {
|
|
844
|
-
const reportBody = buildParentBlockedReport({
|
|
845
|
-
parentIssueNumber: result.parentIssueNumber,
|
|
846
|
-
reasons,
|
|
847
|
-
logPath: result.logPath,
|
|
848
|
-
mutatedChildren,
|
|
849
|
-
});
|
|
850
|
-
const reportComment = commentMarker ? `<!-- codex-orchestrator:${commentMarker} -->\n${reportBody}` : reportBody;
|
|
851
|
-
await finishBlockedTerminalOutcome({
|
|
852
|
-
issueNumber: result.parentIssueNumber,
|
|
853
|
-
config,
|
|
854
|
-
issueAdapter,
|
|
855
|
-
reportComment,
|
|
856
|
-
skipCommentIfIncludes: commentMarker,
|
|
857
|
-
});
|
|
858
|
-
await safeAppendEvent(events, {
|
|
859
|
-
issueNumber: result.parentIssueNumber,
|
|
860
|
-
mode: 'plan-parent',
|
|
861
|
-
sessionId: result.sessionId,
|
|
862
|
-
phase: 'plan-parent',
|
|
863
|
-
status: 'blocked',
|
|
864
|
-
summary: `Issue-tree execution blocked: ${reasons[0] ?? 'blocked'}`,
|
|
865
|
-
artifacts: sessionArtifacts(result.promptPath, result.reportPath, result.logPath, result.snapshotPath),
|
|
866
|
-
});
|
|
867
|
-
return { ...result, status: 'blocked', reportComment, riskRoutingWarnings: [] };
|
|
868
|
-
}
|
|
869
|
-
function dependencyIssuesFor(child, allChildren) {
|
|
870
|
-
const issuesByStableId = new Map(allChildren.map((node) => [node.metadata.stableId, node.issue]));
|
|
871
|
-
return child.metadata.dependsOn.flatMap((stableId) => {
|
|
872
|
-
const issue = issuesByStableId.get(stableId);
|
|
873
|
-
return issue ? [issue] : [];
|
|
874
|
-
});
|
|
875
|
-
}
|
|
876
|
-
function renderParentTemplate(template, parentIssueNumber) {
|
|
877
|
-
return template.replaceAll('${parentIssueNumber}', String(parentIssueNumber));
|
|
878
|
-
}
|
|
879
|
-
function sessionArtifacts(promptPath, reportPath, logPath, snapshotPath) {
|
|
880
|
-
const artifacts = [
|
|
881
|
-
snapshotPath ? { kind: 'snapshot', path: snapshotPath, description: 'Context snapshot' } : undefined,
|
|
882
|
-
promptPath ? { kind: 'prompt', path: promptPath, description: 'Session prompt path' } : undefined,
|
|
883
|
-
reportPath ? { kind: 'report', path: reportPath, description: 'Session report path' } : undefined,
|
|
884
|
-
logPath ? { kind: 'log', path: logPath, description: 'Session log path' } : undefined,
|
|
885
|
-
];
|
|
886
|
-
return artifacts.filter((artifact) => Boolean(artifact));
|
|
887
|
-
}
|
|
888
|
-
async function safeAppendEvent(store, input) {
|
|
889
|
-
try {
|
|
890
|
-
await store.append(input);
|
|
891
|
-
}
|
|
892
|
-
catch {
|
|
893
|
-
// Diagnostics evidence must not alter the runner publication outcome.
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
async function appendAcceptanceProofEvent(input) {
|
|
897
|
-
const evidence = input.event.evidence;
|
|
898
|
-
await safeAppendEvent(input.events, {
|
|
899
|
-
issueNumber: input.issueNumber,
|
|
900
|
-
parentIssueNumber: input.parentIssueNumber,
|
|
901
|
-
mode: 'tree-child',
|
|
902
|
-
sessionId: input.sessionId,
|
|
903
|
-
phase: 'acceptance-proof',
|
|
904
|
-
status: input.event.status === 'passed' ? 'completed' : input.event.status,
|
|
905
|
-
summary: input.event.status === 'started'
|
|
906
|
-
? 'Starting tree-child Adaptive Proof Agent session.'
|
|
907
|
-
: `Tree-child Adaptive Proof Agent finished with ${input.event.status}.`,
|
|
908
|
-
artifacts: evidence ? [
|
|
909
|
-
{ kind: 'prompt', path: evidence.promptPath, description: 'Acceptance proof prompt path' },
|
|
910
|
-
{ kind: 'report', path: evidence.reportPath, description: 'Acceptance proof report path' },
|
|
911
|
-
...evidence.artifactPaths.map((path) => ({ kind: 'other', path, description: 'Acceptance proof artifact' })),
|
|
912
|
-
] : undefined,
|
|
913
|
-
});
|
|
914
|
-
}
|
|
915
|
-
function baseResult(parentIssueNumber, branchName, worktreePath, promptPath, reportPath, logPath, childIssues, sessionId, snapshotPath) {
|
|
916
|
-
return { parentIssueNumber, branchName, worktreePath, promptPath, reportPath, logPath, childIssues, sessionId, snapshotPath };
|
|
917
|
-
}
|
|
918
|
-
//# sourceMappingURL=plan-auto-command.js.map
|