@open-agent-toolkit/cli 0.0.52 → 0.0.53

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.
@@ -1,6 +1,6 @@
1
1
  {
2
- "cli": "0.0.52",
3
- "docs-config": "0.0.52",
4
- "docs-theme": "0.0.52",
5
- "docs-transforms": "0.0.52"
2
+ "cli": "0.0.53",
3
+ "docs-config": "0.0.53",
4
+ "docs-theme": "0.0.53",
5
+ "docs-transforms": "0.0.53"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oat-project-implement
3
- version: 2.0.5
3
+ version: 2.0.6
4
4
  description: Use when plan.md is ready for execution. Dispatches phase-level subagents with bounded fix loops; supports plan-declared parallel phase groups with worktree-isolated execution and ordered fan-in.
5
5
  argument-hint: '[--retry-limit <N>] [--dry-run]'
6
6
  disable-model-invocation: true
@@ -525,13 +525,17 @@ When the current schedule entry is a multi-phase group, execute as follows.
525
525
  **Tier 1 parallel execution:**
526
526
 
527
527
  1. **Bootstrap worktrees:** for each phase in the group, invoke `oat-worktree-bootstrap-auto` with branch name `{project-name}/{pNN}` and base = orchestration branch.
528
+
529
+ > ⚠️ **CRITICAL — DO NOT substitute host-native worktree primitives.** Bootstrap MUST go through `oat-worktree-bootstrap-auto` with an explicit `--base` set to the current orchestration branch HEAD (capture `EXPECTED_HEAD=$(git rev-parse HEAD)` from the orchestration cwd before dispatching). Do not use Claude Code's `Agent({ isolation: "worktree" })`, Cursor's equivalent, or any other host-native isolation primitive in lieu of this skill — those mechanisms may use the primary repo's checkout (often `main`) as the base regardless of the orchestrator's current branch, silently producing a worktree that cannot see prior phase commits and forcing the entire group to degrade to sequential.
528
530
  - If **any** bootstrap fails, cancel any worktrees that bootstrapped successfully for this group and degrade the whole group to sequential inline execution. Log the degradation reason to `implementation.md` Outstanding Items.
529
531
 
530
- 2. **Concurrent dispatch:** for each successfully bootstrapped worktree, dispatch `oat-phase-implementer` (with the worktree as working directory) concurrently. Each dispatch runs the per-phase loop internally (implementer reviewer → fix-loop).
532
+ 2. **Verify worktree HEAD before dispatch (base-mismatch gate):** After bootstrap, verify each worktree is at the expected orchestration HEAD. From the orchestration cwd, capture `EXPECTED_HEAD=$(git rev-parse HEAD)` _before_ invoking bootstrap. After bootstrap, for each new worktree path, run `git -C {worktree-path} rev-parse HEAD` and confirm it matches `EXPECTED_HEAD`, or run `git -C {worktree-path} merge-base --is-ancestor "$EXPECTED_HEAD" HEAD` and confirm it succeeds (exit 0). If either check fails for any phase, treat the bootstrap as failed for that phase, cancel any successful sibling worktrees in this group, and degrade the entire group to sequential inline execution — same mechanism as a primary bootstrap failure. Log the mismatch to `implementation.md` Outstanding Items, including the observed and expected SHAs (`expected={EXPECTED_HEAD}, observed={observed-head-sha}, phase={pNN}, worktree={path}`).
533
+
534
+ 3. **Concurrent dispatch:** for each successfully bootstrapped worktree (passing the base-mismatch gate above), dispatch `oat-phase-implementer` (with the worktree as working directory) concurrently. Each dispatch runs the per-phase loop internally (implementer → reviewer → fix-loop).
531
535
 
532
- 3. **Wait for all phases:** do not proceed until every phase in the group reports a terminal verdict (pass or excluded).
536
+ 4. **Wait for all phases:** do not proceed until every phase in the group reports a terminal verdict (pass or excluded).
533
537
 
534
- 4. **Fan-in reconciliation (merge back in plan order):**
538
+ 5. **Fan-in reconciliation (merge back in plan order):**
535
539
 
536
540
  For each phase in the group, in plan order (p02 before p03, etc.), if its verdict is pass:
537
541
 
@@ -570,23 +574,23 @@ When the current schedule entry is a multi-phase group, execute as follows.
570
574
  commit: <sha if RESOLVED, else null>
571
575
  ```
572
576
 
573
- d. Parse the subagent's return status: - `RESOLVED` → subagent has committed the merge; orchestrator proceeds to integration verification (Step 5) and the next phase in the group. - `UNRESOLVABLE` or `VERIFICATION_FAILED` → STOP the run. Surface to user with phase ID, conflicting files, worktree path, subagent's reasoning summary. Do not merge remaining phases.
577
+ d. Parse the subagent's return status: - `RESOLVED` → subagent has committed the merge; orchestrator proceeds to integration verification (Step 6) and the next phase in the group. - `UNRESOLVABLE` or `VERIFICATION_FAILED` → STOP the run. Surface to user with phase ID, conflicting files, worktree path, subagent's reasoning summary. Do not merge remaining phases.
574
578
 
575
579
  **Tier 2 (inline) exception:** In Tier 2 runs, parallel groups already degrade to sequential, so fan-in conflicts don't arise from this code path. If a conflict ever surfaces in Tier 2 (e.g., from another operation), the orchestrator resolves inline since the whole run is already inline — consistent with Tier 2 semantics.
576
580
 
577
- 5. **Integration verification after each merge:**
581
+ 6. **Integration verification after each merge:**
578
582
 
579
583
  After each successful merge, run project verification (tests, lint, type-check). If verification fails:
580
584
  - Attempt a tractable fix (missing import, trivial type error). If the fix succeeds and verification passes, commit the fix.
581
585
  - If the fix is not tractable → revert the merge, STOP the run. Surface to user.
582
586
 
583
- 6. **Worktree cleanup:**
587
+ 7. **Worktree cleanup:**
584
588
 
585
589
  For phases that merged successfully and passed integration verification, clean up the worktree using the existing worktree cleanup mechanism (e.g., `git worktree remove`).
586
590
 
587
591
  For phases that were excluded (fix-loop exhausted), preserve the worktree and log its path in `implementation.md` Outstanding Items.
588
592
 
589
- 7. **Bookkeeping commit** after the group completes. Then HiLL checkpoint check.
593
+ 8. **Bookkeeping commit** after the group completes. Then HiLL checkpoint check.
590
594
 
591
595
  ### Step 7: Artifact Updates After Each Phase (or Group)
592
596
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oat-worktree-bootstrap-auto
3
- version: 1.2.1
3
+ version: 1.2.2
4
4
  description: Use when an orchestrator/subagent needs autonomous worktree bootstrap. Non-interactive companion to oat-worktree-bootstrap.
5
5
  argument-hint: '<branch-name> [--base <ref>] [--path <root>] [--baseline-policy <strict|allow-failing>]'
6
6
  disable-model-invocation: true
@@ -12,6 +12,8 @@ allowed-tools: Read, Write, Bash, Glob, Grep
12
12
 
13
13
  Non-interactive worktree bootstrap for orchestrator and subagent execution flows. Creates or reuses a worktree, runs baseline checks, and reports structured status — all without user prompts.
14
14
 
15
+ > ⚠️ **When not to substitute.** This skill is the **only** supported mechanism for orchestrator-driven worktree creation in OAT skills. Host-native isolation primitives — Claude Code's `Agent({ isolation: "worktree" })`, Cursor's worktree-isolated agent invocations, and equivalents in other hosts — are **not** substitutes. They may use the primary repo's checkout (often `main`) as the base regardless of the caller's current branch, silently producing a worktree at the wrong base. OAT orchestrators dispatching mid-run from a feature branch MUST go through this skill with an explicit `--base` so the resulting worktree contains the orchestrator's prior commits.
16
+
15
17
  ## Relationship to oat-worktree-bootstrap
16
18
 
17
19
  This skill is the **autonomous companion** to `oat-worktree-bootstrap`. Key differences:
@@ -37,11 +39,12 @@ When this skill is executed, provide concise status updates:
37
39
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
38
40
 
39
41
  - Before major phases, print compact indicators, for example:
40
- - `[1/5] Resolving worktree root…`
41
- - `[2/5] Creating/reusing worktree…`
42
- - `[3/5] Running baseline checks…`
43
- - `[4/5] Syncing provider directories…`
44
- - `[5/5] Returning structured status…`
42
+ - `[1/6] Resolving worktree root…`
43
+ - `[2/6] Creating/reusing worktree…`
44
+ - `[3/6] Verifying resolved base in worktree HEAD…`
45
+ - `[4/6] Running baseline checks…`
46
+ - `[5/6] Syncing provider directories…`
47
+ - `[6/6] Returning structured status…`
45
48
 
46
49
  ## Inputs
47
50
 
@@ -51,11 +54,11 @@ When this skill is executed, provide concise status updates:
51
54
 
52
55
  ### Optional
53
56
 
54
- | Parameter | Default | Description |
55
- | ---------------------------- | ----------------------- | ------------------------------- |
56
- | `--base <ref>` | `origin/main` | Base ref to branch from |
57
- | `--path <root>` | Resolved via precedence | Explicit worktree root override |
58
- | `--baseline-policy <policy>` | `strict` | Baseline check failure policy |
57
+ | Parameter | Default | Description |
58
+ | ---------------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
59
+ | `--base <ref>` | `origin/main` | Base ref to branch from. **Callers running inside a worktree-on-a-feature-branch (e.g., an `oat-project-implement` orchestrator dispatching mid-run) MUST pass `--base` explicitly** — either the orchestrator's current branch name or the resolved current HEAD SHA. The default `origin/main` is the **wrong** choice for orchestrators dispatching mid-run; using it will land the worktree at `main`. |
60
+ | `--path <root>` | Resolved via precedence | Explicit worktree root override |
61
+ | `--baseline-policy <policy>` | `strict` | Baseline check failure policy |
59
62
 
60
63
  ### Baseline Policy
61
64
 
@@ -117,6 +120,36 @@ oat local sync "$TARGET_PATH" 2>/dev/null || true
117
120
  - Copies configured `localPaths` (e.g., `.oat/ideas/`, `.oat/projects/local/`) into the worktree.
118
121
  - Non-blocking: if sync fails or no `localPaths` are configured, bootstrap continues.
119
122
 
123
+ ### Step 2.7: Verify Resolved Base in Worktree HEAD
124
+
125
+ Before any baseline checks run, verify the worktree actually branched from the resolved base. This catches host-native or git-internal misbehavior that would otherwise silently land the worktree at the wrong base.
126
+
127
+ 1. Resolve the base SHA:
128
+
129
+ ```bash
130
+ RESOLVED_BASE_SHA=$(git -C "$REPO_ROOT" rev-parse "$BASE_REF")
131
+ ```
132
+
133
+ 2. Capture the worktree HEAD:
134
+
135
+ ```bash
136
+ OBSERVED_HEAD_SHA=$(git -C "$TARGET_PATH" rev-parse HEAD)
137
+ ```
138
+
139
+ 3. Confirm the resolved base is reachable from the worktree HEAD:
140
+
141
+ ```bash
142
+ git -C "$TARGET_PATH" merge-base --is-ancestor "$RESOLVED_BASE_SHA" "$OBSERVED_HEAD_SHA"
143
+ ```
144
+
145
+ - Exit `0` → base is contained in the worktree HEAD; continue to Step 3.
146
+ - Non-zero exit → base mismatch.
147
+
148
+ **On base mismatch:** treat as a bootstrap failure. Do **not** silently land at the wrong base, do **not** proceed to baseline checks. Apply the configured baseline policy to the failure:
149
+
150
+ - `strict` → return immediately with `status: failed`, `reason: base-mismatch`, populated `expected_base_sha` and `observed_head_sha`, and the worktree path. The orchestrator is expected to cancel the dispatch and degrade.
151
+ - `allow-failing` → emit a structured warning (`reason: base-mismatch`, with `expected_base_sha` and `observed_head_sha`), append a base-mismatch entry to `implementation.md` if an active project exists, and continue to Step 3 only if the caller has explicitly opted into a degraded outcome. In all other cases prefer fail-fast — base mismatch is rarely recoverable.
152
+
120
153
  ### Step 3: Run Baseline Checks
121
154
 
122
155
  Execute in the target worktree directory:
@@ -162,10 +195,12 @@ oat sync --scope all
162
195
  Return a structured status object (for orchestrator consumption):
163
196
 
164
197
  ```yaml
165
- status: success | error | warning
198
+ status: success | error | warning | failed
166
199
  worktree_path: '{absolute-path}'
167
200
  branch: '{branch-name}'
168
201
  base_ref: '{base-ref}'
202
+ resolved_base_sha: '{sha resolved from base-ref}'
203
+ observed_head_sha: '{sha of worktree HEAD after add}'
169
204
  checks:
170
205
  worktree_init: pass | fail | skip
171
206
  project_status: pass | fail | skip
@@ -174,25 +209,32 @@ checks:
174
209
  provider_sync: pass | fail | skip
175
210
  warnings: [] # List of warning messages (allow-failing mode)
176
211
  error: null # Error message (strict mode failure)
212
+ reason: null # Structured reason on failure (e.g., base-mismatch)
213
+ expected_base_sha: null # Populated when reason is base-mismatch
177
214
  baseline_policy: strict | allow-failing
178
215
  ```
179
216
 
217
+ `resolved_base_sha` and `observed_head_sha` are populated on **every** terminal status (success, warning, error, failed) so callers can perform belt-and-suspenders post-verification on the success path as well as diagnose the failure path.
218
+
180
219
  **Status determination:**
181
220
 
182
- - `success`: All checks passed.
183
- - `warning`: Some checks failed under `allow-failing` policy.
184
- - `error`: A check failed under `strict` policy, or worktree creation failed.
221
+ - `success`: All checks passed and Step 2.7 base-resolution verification passed.
222
+ - `warning`: Some checks failed under `allow-failing` policy (Step 2.7 still passed).
223
+ - `error`: A baseline check failed under `strict` policy, or worktree creation failed.
224
+ - `failed` (with `reason: base-mismatch`): Step 2.7 base-resolution verification failed. Callers should treat this distinctly from a generic baseline error — it is a contract violation, not a flaky check.
185
225
 
186
226
  ## Error Handling
187
227
 
188
- | Scenario | Behavior |
189
- | ------------------------------------ | ----------------------------------------------- |
190
- | Worktree creation fails | Return error status with git error message |
191
- | Branch already checked out elsewhere | Return error with worktree location info |
192
- | Baseline check fails (strict) | Return error with check name and failure output |
193
- | Baseline check fails (allow-failing) | Add to warnings, continue, log to artifacts |
194
- | No active project | Skip artifact logging, use console only |
195
- | Invalid branch name | Return error before attempting creation |
228
+ | Scenario | Behavior |
229
+ | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
230
+ | Worktree creation fails | Return error status with git error message |
231
+ | Branch already checked out elsewhere | Return error with worktree location info |
232
+ | Base mismatch (Step 2.7 fails, strict) | Return `status: failed`, `reason: base-mismatch`, with `expected_base_sha` and `observed_head_sha`. Do not run baselines. |
233
+ | Base mismatch (Step 2.7 fails, allow-fail) | Emit structured warning with `reason: base-mismatch`, log to artifacts, prefer fail-fast unless caller opted into degrade. |
234
+ | Baseline check fails (strict) | Return error with check name and failure output |
235
+ | Baseline check fails (allow-failing) | Add to warnings, continue, log to artifacts |
236
+ | No active project | Skip artifact logging, use console only |
237
+ | Invalid branch name | Return error before attempting creation |
196
238
 
197
239
  ## Artifact Logging
198
240
 
@@ -211,6 +253,18 @@ Append to `implementation.md` under `## Implementation Log`:
211
253
  - {check_name}: {failure summary}
212
254
  ```
213
255
 
256
+ When a base mismatch is detected (Step 2.7) and an active project exists, append a distinct entry regardless of baseline policy so post-mortems can find it:
257
+
258
+ ```markdown
259
+ ### {YYYY-MM-DD} — Base Mismatch (autonomous bootstrap)
260
+
261
+ **Worktree:** {path}
262
+ **Branch:** {branch-name}
263
+ **Expected base SHA:** {expected_base_sha}
264
+ **Observed HEAD SHA:** {observed_head_sha}
265
+ **Base ref:** {base-ref}
266
+ ```
267
+
214
268
  ## Policy Flags
215
269
 
216
270
  | Flag | Type | Default | Description |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-agent-toolkit/cli",
3
- "version": "0.0.52",
3
+ "version": "0.0.53",
4
4
  "private": false,
5
5
  "description": "Open Agent Toolkit CLI",
6
6
  "homepage": "https://github.com/voxmedia/open-agent-toolkit/tree/main/packages/cli",
@@ -33,7 +33,7 @@
33
33
  "ora": "^9.0.0",
34
34
  "yaml": "2.8.2",
35
35
  "zod": "^3.25.76",
36
- "@open-agent-toolkit/control-plane": "0.0.52"
36
+ "@open-agent-toolkit/control-plane": "0.0.53"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^22.10.0",