Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

- Remove the `task` tool's reminder to re-check the whole request when the last task is done; tasks are already verified on `complete`.
- Simplify the `code` agent's request-checking instructions: no literal reading of loose instructions, no final sweep, no handling of hypothetical edge cases.

## 0.170.5

- Fix releases since 0.170.2 shipping no binaries: build macOS arm64 on `macos-15` as GitHub retired `macos-14`, and target macOS 14+ for both macOS binaries. #691
Expand Down
4 changes: 2 additions & 2 deletions resources/prompts/code_agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ You are an agent - please keep going until the user's query is completely resolv

## Meeting the request

When the request states exact behavior (rules, edge cases, error messages, what must or must not happen), implement it as stated, even if a simpler or more conventional behavior seems close enough or unlikely to matter. If a requirement is ambiguous, follow its most literal reading and mention that in your final message.
When the request states exact behavior (e.g. rules, edge cases, error messages), implement it as stated rather than a simpler approximation. Beyond that, handle the edge cases the code will realistically meet, not hypothetical ones.

Before finishing a non-trivial change, go back through the request requirement by requirement: existing tests passing only shows that old behavior still works. When you can run code, write and run focused checks for each stated rule, including edge cases and failure paths (what happens to state and resources when an error is raised). Afterwards, delete scratch files you made only for checking (throwaway scripts, debug output), but don't undo or reset anything that is part of the requested result, and re-check whatever you change after verifying. In your final message, say what you verified and what you could not.
Check that stated requirements are met: passing existing tests only shows old behavior still works. Don't edit tests or special-case code just to make tests pass. After code changes, say briefly what you verified and what you didn't.

## Edit file instructions

Expand Down
1 change: 1 addition & 0 deletions resources/prompts/tools/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Task Schema:
Task Creation Guidance:
- Order tasks by expected execution flow. Put prerequisite tasks before tasks that depend on them, and use `blocked_by` to record those dependencies explicitly.
- Create tasks as independently executable units with concise, outcome-focused subjects. Keep steps separate if one can be completed before the next begins. If several planned steps will be carried out in the same unit of work, combine them into one task and put the substeps in the description.
- Include requirements the user stated (exact behaviors, specified edge cases) in the acceptance criteria of the task that implements them.

Workflow rules for this tool:
1. PLAN: Use 'plan' to create the task list with initial tasks. You MUST wait for the tool to return the generated task ids before doing anything else. Do NOT execute any work or call other tools in the same step as 'plan'.
Expand Down
8 changes: 1 addition & 7 deletions src/eca/features/tools/task.clj
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,6 @@
(assoc state :active-summary nil)
state))

(def ^:private all-done-reminder
(str "All tasks are done. Before your final answer, go back through the user's request requirement by requirement: "
"check that each one is implemented and verified, including edge cases and failure paths, and handle anything still missing."))

(defn ^:private op-complete [{:strs [ids]} {:keys [db* chat-id]}]
(let [result (mutate-task! db* chat-id
(fn [state]
Expand Down Expand Up @@ -456,9 +452,7 @@
(success state
(str (format "Completed task(s): %s" (str/join ", " (sort ids)))
(when (seq unblocked)
(format "\nUnblocked: %s" (str/join ", " unblocked)))
(when (all-tasks-done? state)
(str "\n" all-done-reminder))))))))
(format "\nUnblocked: %s" (str/join ", " unblocked)))))))))

(defn ^:private op-delete [{:strs [ids]} {:keys [db* chat-id]}]
(let [result (mutate-task! db* chat-id
Expand Down
15 changes: 0 additions & 15 deletions test/eca/features/tools/task_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -293,21 +293,6 @@
result (handler {"op" "complete" "ids" [1]} {:db* db* :chat-id "c1"})]
(is (match? {:contents [{:type :text :text #"Unblocked"}]} result))))

(testing "reminds to check the request once the last task is done"
(let [db* (atom {:chats {"c1" {:task {:tasks [{:id 1 :subject "T1" :description "D1" :status :done :priority :medium :blocked-by #{}}
{:id 2 :subject "T2" :description "D2" :status :in-progress :priority :medium :blocked-by #{}}]}}}})
result (handler {"op" "complete" "ids" [2]} {:db* db* :chat-id "c1"})]
(is (not (:error result)))
(is (match? {:contents [{:type :text :text #"All tasks are done\. Before your final answer, go back through the user's request"}]}
result))))

(testing "no reminder while tasks remain"
(let [db* (atom {:chats {"c1" {:task {:tasks [{:id 1 :subject "T1" :description "D1" :status :in-progress :priority :medium :blocked-by #{}}
{:id 2 :subject "T2" :description "D2" :status :pending :priority :medium :blocked-by #{}}]}}}})
result (handler {"op" "complete" "ids" [1]} {:db* db* :chat-id "c1"})]
(is (not (:error result)))
(is (not (re-find #"All tasks are done" (get-in result [:contents 0 :text]))))))

(testing "rejects blocked tasks for complete"
(let [db* (atom {:chats {"c1" {:task {:tasks [{:id 1 :subject "T1" :description "D1" :status :pending :priority :medium :blocked-by #{}}
{:id 2 :subject "T2" :description "D2" :status :pending :priority :medium :blocked-by #{1}}]}}}})
Expand Down
Loading