summaryrefslogtreecommitdiff
path: root/Omni/Agent/Worker.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-11-27 14:14:40 -0500
committerBen Sima <ben@bensima.com>2025-11-27 14:14:40 -0500
commitbe32ee30dacc65406c1e949765786446345f37b2 (patch)
treedcb489bbbaee9aba21cb07ecacef2475be26e2dd /Omni/Agent/Worker.hs
parentaad0175d6bb2b90d2c78a4a73844ae30ea6cefac (diff)
Add human notes field for intervention tasks
All tests pass. Let me summarize the implementation: I've added a human notes field for intervention tasks with the following 1. **Omni/Task/Core.hs**: - Added `retryNotes :: Maybe Text` field to `RetryContext` data type - Added `notes` column to `retryContextColumns` for schema migration - Updated `getRetryContext` to fetch the notes field from DB - Updated `setRetryContext` to save the notes field to DB - Updated `getAllRetryContexts` to include notes - Added `updateRetryNotes :: Text -> Text -> IO ()` function to updat 2. **Omni/Jr/Web.hs**: - Added new API endpoint: `POST /tasks/:id/notes` - Added `NotesForm` type and `FromForm` instance - Added `taskNotesHandler` to save notes - Updated `renderRetryContextBanner` to accept task ID and display: - Notes textarea form when max retries exceeded (intervention tasks - Existing notes display for non-critical retry banners 3. **Omni/Agent/Worker.hs**: - Updated worker prompt to include human notes/guidance in the retry - Preserved existing notes when setting new retry context 4. **Omni/Jr.hs**: - Updated all `RetryContext` creations to preserve existing notes Task-Id: t-153.5
Diffstat (limited to 'Omni/Agent/Worker.hs')
-rw-r--r--Omni/Agent/Worker.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Omni/Agent/Worker.hs b/Omni/Agent/Worker.hs
index eef31f4..3edfbca 100644
--- a/Omni/Agent/Worker.hs
+++ b/Omni/Agent/Worker.hs
@@ -131,7 +131,8 @@ processTask worker task = do
TaskCore.retryOriginalCommit = "",
TaskCore.retryConflictFiles = [],
TaskCore.retryAttempt = attempt,
- TaskCore.retryReason = "commit_failed: " <> commitErr
+ TaskCore.retryReason = "commit_failed: " <> commitErr,
+ TaskCore.retryNotes = maybeCtx +> TaskCore.retryNotes
}
TaskCore.logActivity tid TaskCore.Retrying (Just (toMetadata [("attempt", tshow attempt)]))
TaskCore.updateTaskStatus tid TaskCore.Open []
@@ -245,6 +246,7 @@ runAmp repo task = do
<> "Original commit: "
<> TaskCore.retryOriginalCommit ctx
<> "\n\n"
+ <> maybe "" (\notes -> "## HUMAN NOTES/GUIDANCE\n\n" <> notes <> "\n\n") (TaskCore.retryNotes ctx)
<> "INSTRUCTIONS FOR RETRY:\n"
<> "- The codebase has changed since your last attempt\n"
<> "- Re-implement this task on top of the CURRENT codebase\n"