summaryrefslogtreecommitdiff
path: root/Omni/Agent
diff options
context:
space:
mode:
Diffstat (limited to 'Omni/Agent')
-rw-r--r--Omni/Agent/Worker.hs72
1 files changed, 3 insertions, 69 deletions
diff --git a/Omni/Agent/Worker.hs b/Omni/Agent/Worker.hs
index a3e1188..638c72f 100644
--- a/Omni/Agent/Worker.hs
+++ b/Omni/Agent/Worker.hs
@@ -7,7 +7,6 @@ import Alpha
import qualified Data.Text as Text
import qualified Data.Text.IO as TIO
import qualified Omni.Agent.Core as Core
-import qualified Omni.Agent.Git as Git
import qualified Omni.Agent.Log as AgentLog
import qualified Omni.Task.Core as TaskCore
import qualified System.Directory as Directory
@@ -24,21 +23,6 @@ start worker maybeTaskId = do
runOnce :: Core.Worker -> Maybe Text -> IO ()
runOnce worker maybeTaskId = do
- let repo = Core.workerPath worker
-
- AgentLog.updateActivity "Syncing tasks..."
- -- Sync with live first to get latest code and tasks
- -- We ignore errors here to keep the loop alive, but syncWithLive panics on conflict.
- -- Ideally we should catch exceptions, but for now let it fail and restart (via supervisor or manual).
- Git.syncWithLive repo
-
- -- Sync tasks database (import from live)
- -- Since we rebased, .tasks/tasks.jsonl should be up to date with live.
- -- But we might need to consolidate if there are merge artifacts (not likely with rebase).
- -- The bash script calls ./Omni/Agent/sync-tasks.sh which calls 'task import'.
- -- Here we rely on 'task loadTasks' reading the file.
- -- But 'syncWithLive' already updated the file from git.
-
-- Find work
targetTask <- case maybeTaskId of
Just tid -> do
@@ -72,31 +56,6 @@ processTask worker task = do
-- Claim task
TaskCore.updateTaskStatus tid TaskCore.InProgress []
- -- Commit claim locally
- Git.commit repo ("task: claim " <> tid)
-
- -- Prepare branch
- let taskBranch = "task/" <> tid
- currentBranch <- Git.getCurrentBranch repo
- if currentBranch == taskBranch
- then AgentLog.log ("Resuming branch " <> taskBranch)
- else do
- exists <- Git.branchExists repo taskBranch
- if exists
- then do
- AgentLog.log ("Switching to existing branch " <> taskBranch)
- Git.checkout repo taskBranch
- else do
- -- Determine base branch from dependencies
- baseBranch <- findBaseBranch repo task
- if baseBranch /= "live"
- then do
- AgentLog.log ("Basing " <> taskBranch <> " on " <> baseBranch)
- Git.checkout repo baseBranch
- else AgentLog.log ("Basing " <> taskBranch <> " on live")
-
- Git.createBranch repo taskBranch
-
-- Run Amp
AgentLog.updateActivity "Running Amp agent..."
exitCode <- runAmp repo task
@@ -105,15 +64,11 @@ processTask worker task = do
Exit.ExitSuccess -> do
AgentLog.log "Agent finished successfully"
- -- Update status to Review (bundled with feature commit)
+ -- Update status to Review
TaskCore.updateTaskStatus tid TaskCore.Review []
- -- Commit changes
- -- We should check if there are changes, but 'git add .' is safe.
- Git.commit repo ("feat: implement " <> tid)
-
-- Submit for review
- AgentLog.updateActivity "Submitting for review..."
+ AgentLog.updateActivity "Task completed"
AgentLog.log ("[✓] Task " <> tid <> " completed")
AgentLog.update (\s -> s {AgentLog.statusTask = Nothing})
@@ -133,7 +88,7 @@ runAmp repo task = do
<> "2. Implement the changes by editing files.\n"
<> "3. Run tests to verify your work (e.g., 'bild --test Omni/Namespace').\n"
<> "4. Fix any errors found during testing.\n"
- <> "5. Do NOT update the task status or manage git branches (the system handles that).\n"
+ <> "5. Do NOT update the task status or manage git branches.\n"
<> "6. When finished and tested, exit.\n\n"
<> "Context:\n"
<> "- You are working in '"
@@ -236,24 +191,3 @@ waitForFile path = do
else do
threadDelay 100000
waitForFile path
-
-findBaseBranch :: FilePath -> TaskCore.Task -> IO Text
-findBaseBranch repo task = do
- let deps = TaskCore.taskDependencies task
- -- Filter for blocking dependencies
- let blockingDeps = filter (\d -> TaskCore.depType d == TaskCore.Blocks || TaskCore.depType d == TaskCore.ParentChild) deps
-
- -- Check if any have unmerged branches
- candidates <-
- flip filterM blockingDeps <| \dep -> do
- let branch = "task/" <> TaskCore.depId dep
- exists <- Git.branchExists repo branch
- if exists
- then do
- merged <- Git.isMerged repo branch "live"
- pure (not merged)
- else pure False
-
- case candidates of
- (candidate : _) -> pure ("task/" <> TaskCore.depId candidate)
- [] -> pure "live"