@nbardy/oompa 0.4.9 → 0.5.1

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.
@@ -225,14 +225,16 @@
225
225
  (defn- run-reviewer!
226
226
  "Run reviewer on worktree changes.
227
227
  Returns {:verdict :approved|:needs-changes|:rejected, :comments [...]}"
228
- [{:keys [review-harness review-model]} worktree-path]
228
+ [{:keys [id swarm-id review-harness review-model]} worktree-path]
229
229
  (let [;; Get diff for context
230
230
  diff-result (process/sh ["git" "diff" "main" "--stat"]
231
231
  {:dir worktree-path :out :string :err :string})
232
232
  diff-summary (:out diff-result)
233
233
 
234
- ;; Build review prompt
235
- review-prompt (str "Review the changes in this worktree.\n\n"
234
+ ;; Build review prompt (tagged for claude-web-view worker detection)
235
+ swarm-id* (or swarm-id "unknown")
236
+ review-prompt (str "[oompa:" swarm-id* ":" id "] "
237
+ "Review the changes in this worktree.\n\n"
236
238
  "Diff summary:\n" diff-summary "\n\n"
237
239
  "Check for:\n"
238
240
  "- Code correctness\n"
@@ -277,8 +279,10 @@
277
279
  (defn- run-fix!
278
280
  "Ask worker to fix issues based on reviewer feedback.
279
281
  Returns {:output string, :exit int}"
280
- [{:keys [harness model]} worktree-path feedback]
281
- (let [fix-prompt (str "The reviewer found issues with your changes:\n\n"
282
+ [{:keys [id swarm-id harness model]} worktree-path feedback]
283
+ (let [swarm-id* (or swarm-id "unknown")
284
+ fix-prompt (str "[oompa:" swarm-id* ":" id "] "
285
+ "The reviewer found issues with your changes:\n\n"
282
286
  feedback "\n\n"
283
287
  "Please fix these issues in the worktree.")
284
288
 
@@ -304,13 +308,19 @@
304
308
  {:output (:out result)
305
309
  :exit (:exit result)}))
306
310
 
311
+ (defn- worktree-has-changes?
312
+ "Check if worktree has any uncommitted changes (new/modified/deleted files)."
313
+ [wt-path]
314
+ (let [result (process/sh ["git" "status" "--porcelain"] {:dir wt-path :out :string :err :string})]
315
+ (not (str/blank? (:out result)))))
316
+
307
317
  (defn- merge-to-main!
308
318
  "Merge worktree changes to main branch"
309
319
  [wt-path wt-id worker-id project-root]
310
320
  (println (format "[%s] Merging changes to main" worker-id))
311
321
  (let [;; Commit in worktree if needed
312
322
  _ (process/sh ["git" "add" "-A"] {:dir wt-path})
313
- _ (process/sh ["git" "commit" "-m" (str "Work from " wt-id) "--allow-empty"]
323
+ _ (process/sh ["git" "commit" "-m" (str "Work from " wt-id)]
314
324
  {:dir wt-path})
315
325
  ;; Checkout main and merge (in project root, not worktree)
316
326
  checkout-result (process/sh ["git" "checkout" "main"]
@@ -394,19 +404,32 @@
394
404
  {:keys [output exit done?]} (run-agent! worker wt-path context)]
395
405
 
396
406
  (cond
397
- ;; Agent signaled done
398
- done?
407
+ ;; Agent signaled done — only honor for can_plan workers.
408
+ ;; Executors (can_plan: false) can't decide work is done.
409
+ (and done? (:can-plan worker))
399
410
  (do
400
411
  (println (format "[%s] Received __DONE__ signal" worker-id))
401
412
  {:status :done})
402
413
 
414
+ ;; can_plan: false worker said __DONE__ — ignore it, treat as success
415
+ (and done? (not (:can-plan worker)))
416
+ (do
417
+ (println (format "[%s] Ignoring __DONE__ (executor cannot signal done)" worker-id))
418
+ {:status :continue})
419
+
403
420
  ;; Agent errored
404
421
  (not (zero? exit))
405
422
  (do
406
423
  (println (format "[%s] Agent error (exit %d): %s" worker-id exit (subs (or output "") 0 (min 200 (count (or output ""))))))
407
424
  {:status :error :exit exit})
408
425
 
409
- ;; Success - run review loop before merge
426
+ ;; Agent produced no file changes wasted iteration
427
+ (not (worktree-has-changes? wt-path))
428
+ (do
429
+ (println (format "[%s] No changes produced, skipping review" worker-id))
430
+ {:status :no-changes})
431
+
432
+ ;; Success with changes - run review loop before merge
410
433
  :else
411
434
  (let [{:keys [approved?]} (review-loop! worker wt-path worker-id)]
412
435
  (if approved?
@@ -492,6 +515,9 @@
492
515
  id iter iterations errors max-consecutive-errors))
493
516
  (recur (inc iter) completed errors))))
494
517
 
518
+ :no-changes
519
+ (recur (inc iter) completed consec-errors)
520
+
495
521
  :continue
496
522
  (recur (inc iter) (inc completed) 0)))))))
497
523
 
@@ -35,13 +35,22 @@ cat > ../tasks/pending/task-NNN.edn << 'EOF'
35
35
  EOF
36
36
  ```
37
37
 
38
+ ### Planning vs Executing
39
+
40
+ **WHEN PLANNING** (task queue is empty or nearly empty):
41
+ - Your FIRST priority is creating tasks for other workers. They are waiting.
42
+ - Read the project spec, identify gaps, and create 5-10 focused, well-detailed tasks.
43
+ - Do NOT execute tasks in the same iteration you create them.
44
+ - Commit the task files and finish your iteration so others can claim them immediately.
45
+
46
+ **WHEN EXECUTING** (tasks exist in pending):
47
+ - Claim one task, execute it end-to-end, complete it.
48
+ - If work emerges during execution, create new tasks in `../tasks/pending/`.
49
+
38
50
  ### Rules
39
51
 
40
52
  - Before starting work: read the project spec and all tasks to understand scope.
41
- - **If `../tasks/pending/` is empty or nearly empty: your FIRST priority is to create tasks.** Read the project spec, identify gaps, and write 3-5 focused tasks before doing anything else. Other workers are waiting for work.
42
53
  - Claim your task by moving it to `../tasks/current/`.
43
54
  - If the `mv` fails (another worker claimed it first), pick a different task.
44
55
  - One task per commit (or a small, tightly-related set with overlapping files).
45
- - If tasks are missing or underspecified: stop and write tasks before coding.
46
- - If work emerges during execution: create new tasks in `../tasks/pending/`.
47
- - Only output __DONE__ if you have completed work AND no more tasks can be derived from the spec. Never __DONE__ on your first action — always create or execute at least one task first.
56
+ - Only output __DONE__ if you have completed work AND no more tasks can be derived from the spec. Never __DONE__ on your first action.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nbardy/oompa",
3
- "version": "0.4.9",
3
+ "version": "0.5.1",
4
4
  "description": "Git-worktree multi-agent swarm orchestrator for Codex and Claude",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",