summaryrefslogtreecommitdiff
path: root/Omni
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-11-20 16:58:50 -0500
committerBen Sima <ben@bsima.me>2025-11-20 16:58:50 -0500
commit6a64d52b9cf932ead83b189e33bb9e19dceb6ef9 (patch)
tree80c92df578fb8823c2d1de8ce55e8dc1952fb303 /Omni
parentaa9119a9fc1ea347bdb75e7a54be144f51c838ea (diff)
feat: implement task harvesting logic
- Added Omni/Agent/harvest-tasks.sh for Planner to pull updates from workers - Updated WORKER_AGENT_GUIDE.md to instruct workers to commit status updates to their base branch
Diffstat (limited to 'Omni')
-rw-r--r--Omni/Agent/WORKER_AGENT_GUIDE.md59
-rwxr-xr-xOmni/Agent/harvest-tasks.sh55
2 files changed, 88 insertions, 26 deletions
diff --git a/Omni/Agent/WORKER_AGENT_GUIDE.md b/Omni/Agent/WORKER_AGENT_GUIDE.md
index f1f6f60..64a55f8 100644
--- a/Omni/Agent/WORKER_AGENT_GUIDE.md
+++ b/Omni/Agent/WORKER_AGENT_GUIDE.md
@@ -64,38 +64,45 @@ task update t-123 in-progress
### Step 5: Submit for Review
-```bash
-# 1. Mark for review
-task update t-123 review
+1. **Commit Implementation**:
+ ```bash
+ git add .
+ git commit -m "feat: implement t-123"
+ ```
-# 2. Commit implementation
-git add .
-git commit -m "feat: implement t-123"
+2. **Signal Review Readiness**:
+ The Planner checks the `omni-worker-X` branch for status updates. You must switch back and update the status there.
-# 3. Switch back to worker base branch to prepare for next loop
-# This detaches the worker from the task branch so the Planner can check it out
-git checkout omni-worker-1
-./Omni/Agent/sync-tasks.sh
-```
+ ```bash
+ # Switch to base branch
+ git checkout omni-worker-1
+
+ # Sync to get latest state (and any manual merges)
+ ./Omni/Agent/sync-tasks.sh
+
+ # Mark task for review
+ task update t-123 review
+
+ # Commit this status change to the worker branch
+ ./Omni/Agent/sync-tasks.sh --commit
+ ```
+
+ *Note: The Planner will now see 't-123' in 'Review' when it runs `harvest-tasks.sh`.*
## 3. Planner (Reviewer) Workflow
The Planner Agent (running in the main repo) will:
-1. See tasks in `Review` status (after checking out the worker's branch or waiting for them to be merged).
- * *Note: Since workers commit to local branches, you verify work by checking out their branch.*
-2. Check out the worker's branch: `git checkout task/t-123`.
-3. Review code and tests.
-4. Merge to `live`:
- ```bash
- git checkout live
- git merge task/t-123
- # Conflicts in tasks.jsonl are handled automatically by .gitattributes driver
- ```
-5. Mark Done:
- ```bash
- task update t-123 done
- git commit -am "task: t-123 done"
- ```
+1. **Harvest Updates**: Run `./Omni/Agent/harvest-tasks.sh` to pull "In Progress" and "Review" statuses from workers.
+2. **Find Reviews**: Run `task list --status=review`.
+3. **Review Code**:
+ * Check out the feature branch: `git checkout task/t-123`.
+ * Run tests and review code.
+4. **Merge**:
+ * `git checkout live`
+ * `git merge task/t-123`
+5. **Complete**:
+ * `task update t-123 done`
+ * `git commit -am "task: t-123 done"`
## Troubleshooting
diff --git a/Omni/Agent/harvest-tasks.sh b/Omni/Agent/harvest-tasks.sh
new file mode 100755
index 0000000..282beab
--- /dev/null
+++ b/Omni/Agent/harvest-tasks.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+set -e
+
+# Omni/Agent/harvest-tasks.sh
+# Imports task updates from all worker branches into the current branch (usually live).
+
+REPO_ROOT="$(git rev-parse --show-toplevel)"
+cd "$REPO_ROOT"
+
+echo "Harvesting task updates from workers..."
+
+# Find all worker branches (assuming naming convention omni-worker-*)
+# We filter for local branches
+WORKER_BRANCHES=$(git branch --list "omni-worker-*" --format="%(refname:short)")
+
+if [ -z "$WORKER_BRANCHES" ]; then
+ echo "No worker branches found."
+ exit 0
+fi
+
+UPDATED=0
+
+for branch in $WORKER_BRANCHES; do
+ echo "Checking $branch..."
+
+ # Extract tasks.jsonl from the worker branch
+ if git show "$branch:.tasks/tasks.jsonl" > .tasks/worker-tasks.jsonl 2>/dev/null; then
+ # Import into current DB
+ # The import command handles deduplication and timestamp conflict resolution
+ if "$REPO_ROOT/_/bin/task" import -i .tasks/worker-tasks.jsonl >/dev/null; then
+ echo " Imported tasks from $branch"
+ UPDATED=1
+ fi
+ else
+ echo " Warning: Could not read .tasks/tasks.jsonl from $branch"
+ fi
+done
+
+rm -f .tasks/worker-tasks.jsonl
+
+if [ "$UPDATED" -eq 1 ]; then
+ # Consolidate
+ "$REPO_ROOT/_/bin/task" export --flush
+
+ # Commit if there are changes
+ if [[ -n $(git status --porcelain .tasks/tasks.jsonl) ]]; then
+ git add .tasks/tasks.jsonl
+ git commit -m "task: harvest updates from workers"
+ echo "Success: Task database updated and committed."
+ else
+ echo "No effective changes found."
+ fi
+else
+ echo "No updates found."
+fi