From aebb26fcf7ff9869b1039cdbac8811f83b346f9d Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 20 Nov 2025 21:40:04 -0500 Subject: docs: update Agent design with git robustness learnings --- .tasks/tasks.jsonl | 5 +++++ Omni/Agent/DESIGN.md | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.tasks/tasks.jsonl b/.tasks/tasks.jsonl index 1b287a0..75bf17c 100644 --- a/.tasks/tasks.jsonl +++ b/.tasks/tasks.jsonl @@ -147,3 +147,8 @@ {"taskCreatedAt":"2025-11-21T00:19:08.811498926Z","taskDependencies":[{"depId":"t-PpYZt2","depType":"DiscoveredFrom"}],"taskId":"t-1fKilH","taskNamespace":null,"taskParent":null,"taskPriority":"P2","taskStatus":"Open","taskTitle":"bild fails in agent environment due to CODEROOT mismatch","taskType":"WorkTask","taskUpdatedAt":"2025-11-21T00:19:08.811498926Z"} {"taskCreatedAt":"2025-11-21T00:19:08.829956304Z","taskDependencies":[{"depId":"t-PpYZt2","depType":"DiscoveredFrom"}],"taskId":"t-1fKn9o","taskNamespace":null,"taskParent":null,"taskPriority":"P2","taskStatus":"Open","taskTitle":"Race condition in generateChildId when concurrent tasks are created","taskType":"WorkTask","taskUpdatedAt":"2025-11-21T00:19:08.829956304Z"} {"taskCreatedAt":"2025-11-21T02:31:40.268267384Z","taskDependencies":[],"taskId":"t-9VRNuj","taskNamespace":"Omni/Task.hs","taskParent":null,"taskPriority":"P2","taskStatus":"Done","taskTitle":"Remove horizontal bars from task show output","taskType":"WorkTask","taskUpdatedAt":"2025-11-21T02:32:57.50736116Z"} +{"taskCreatedAt":"2025-11-21T02:39:47.740342035Z","taskDependencies":[],"taskId":"t-rWa5yilwM","taskNamespace":"Omni/Agent.hs","taskParent":null,"taskPriority":"P2","taskStatus":"Open","taskTitle":"Multi-Agent System 2.0 (Haskell Agent)","taskType":"Epic","taskUpdatedAt":"2025-11-21T02:39:47.740342035Z"} +{"taskCreatedAt":"2025-11-21T02:39:51.467615692Z","taskDependencies":[],"taskId":"t-rWa5yilwM.1","taskNamespace":"Omni/Agent.hs","taskParent":"t-rWa5yilwM","taskPriority":"P2","taskStatus":"Open","taskTitle":"Implement Omni.Agent.Git module with robust checkout","taskType":"WorkTask","taskUpdatedAt":"2025-11-21T02:39:51.467615692Z"} +{"taskCreatedAt":"2025-11-21T02:39:55.225849981Z","taskDependencies":[{"depId":"t-rWa5yilwM.1","depType":"Blocks"}],"taskId":"t-rWa5yilwM.2","taskNamespace":"Omni/Agent.hs","taskParent":"t-rWa5yilwM","taskPriority":"P2","taskStatus":"Open","taskTitle":"Implement Omni.Agent.Worker loop logic","taskType":"WorkTask","taskUpdatedAt":"2025-11-21T02:39:55.225849981Z"} +{"taskCreatedAt":"2025-11-21T02:39:58.185671478Z","taskDependencies":[],"taskId":"t-rWa5yilwM.3","taskNamespace":"Omni/Agent.hs","taskParent":"t-rWa5yilwM","taskPriority":"P2","taskStatus":"Open","taskTitle":"Implement Omni.Agent.Log module with Aeson parsing","taskType":"WorkTask","taskUpdatedAt":"2025-11-21T02:39:58.185671478Z"} +{"taskCreatedAt":"2025-11-21T02:40:01.165180998Z","taskDependencies":[{"depId":"t-rWa5yilwM.2","depType":"Blocks"}],"taskId":"t-rWa5yilwM.4","taskNamespace":"Omni/Agent.hs","taskParent":"t-rWa5yilwM","taskPriority":"P2","taskStatus":"Open","taskTitle":"Implement Omni.Agent.CLI entry point","taskType":"WorkTask","taskUpdatedAt":"2025-11-21T02:40:01.165180998Z"} diff --git a/Omni/Agent/DESIGN.md b/Omni/Agent/DESIGN.md index c3fa792..bbdbe15 100644 --- a/Omni/Agent/DESIGN.md +++ b/Omni/Agent/DESIGN.md @@ -52,12 +52,13 @@ The Haskell implementation should replicate the logic of `start-worker.sh` but w 1. **Setup**: Ensure worktree exists (or create it). 2. **Loop**: - - `Git.syncWithLive` + - `Git.syncWithLive` (Rebase-based to preserve local history) - `Task.sync` - `task <- Task.findReady` - If `task`: - `Task.claim task` - - `Git.checkoutTaskBranch task` + - `baseBranch <- Git.determineBaseBranch task` (Check dependencies) + - `Git.checkoutTaskBranch task baseBranch` (Force checkout to clean untracked files) - `Amp.execute prompt` - `Git.commit` - `Git.checkoutBase` @@ -79,6 +80,13 @@ The Haskell implementation should replicate the logic of `start-worker.sh` but w - For each worker, extract `.tasks/tasks.jsonl` via `git show`. - Run `Task.import`. +### 4.5 Git Robustness (Learnings) +- **Force Checkout**: The worker must use `git checkout -f` (or equivalent) when switching to task branches to ensure untracked files (like `.tasks/counters.jsonl`) don't block the switch. +- **Base Branch Logic**: + - If the task depends on another task that is *not* yet in `live` (e.g., in `Review`), the worker should branch off the dependency's branch (`task/`). + - Otherwise, branch off `live` (via the worker's base branch). +- **Clean State**: The worker should ensure the workspace is clean (no uncommitted changes) before starting a new loop iteration. + ## 5. Migration Strategy 1. **Parallel Existence**: Keep bash scripts while developing Haskell version. -- cgit v1.2.3