diff options
| author | Omni Worker <bot@omni.agent> | 2025-11-22 07:47:37 -0500 |
|---|---|---|
| committer | Omni Worker <bot@omni.agent> | 2025-11-22 07:47:37 -0500 |
| commit | afcb454efe9be5843a454319042e792adafd210f (patch) | |
| tree | eba105eb8bc7b915437aaf9957b9edd682887cff /Omni | |
| parent | 0211cb43909af1704888bc142ec93bbbbff944a0 (diff) | |
feat: capture amp summary and forbid commit
Amp-Thread-ID:
https://ampcode.com/threads/T-ec034efc-0ef1-43df-8abe-b0cda0f9115b
Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'Omni')
| -rw-r--r-- | Omni/Agent/Worker.hs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Omni/Agent/Worker.hs b/Omni/Agent/Worker.hs index a861173..94a4e35 100644 --- a/Omni/Agent/Worker.hs +++ b/Omni/Agent/Worker.hs @@ -93,7 +93,7 @@ processTask worker task = do -- Run Amp AgentLog.updateActivity "Running Amp agent..." - exitCode <- runAmp repo task + (exitCode, output) <- runAmp repo task case exitCode of Exit.ExitSuccess -> do @@ -103,8 +103,10 @@ processTask worker task = do 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) + -- We use the agent's output as the extended commit description + let summary = Text.strip output + let commitMsg = "feat: implement " <> tid <> "\n\n" <> summary + Git.commit repo commitMsg -- Submit for review AgentLog.updateActivity "Submitting for review..." @@ -127,7 +129,7 @@ processTask worker task = do AgentLog.updateActivity "Agent failed, retrying..." threadDelay (10 * 1000000) -- Sleep 10s -runAmp :: FilePath -> TaskCore.Task -> IO Exit.ExitCode +runAmp :: FilePath -> TaskCore.Task -> IO (Exit.ExitCode, Text) runAmp repo task = do let prompt = "You are a Worker Agent.\n" @@ -139,7 +141,8 @@ runAmp repo task = do <> "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" - <> "6. When finished and tested, exit.\n\n" + <> "6. Do NOT run 'git commit'. The system will commit your changes automatically.\n" + <> "7. When finished and tested, exit.\n\n" <> "Context:\n" <> "- You are working in '" <> Text.pack repo @@ -176,14 +179,13 @@ runAmp repo task = do let args = ["--log-level", "debug", "--log-file", "_/llm/amp.log", "--dangerously-allow-all", "-x", Text.unpack fullPrompt] let cp = (Process.proc "amp" args) {Process.cwd = Just repo} - (_, _, _, ph) <- Process.createProcess cp - exitCode <- Process.waitForProcess ph + (exitCode, out, _err) <- Process.readCreateProcessWithExitCode cp "" -- Cleanup killThread tidTime killThread tidLog - pure exitCode + pure (exitCode, Text.pack out) formatTask :: TaskCore.Task -> Text formatTask t = |
