diff --git a/agentydragon/README.md b/agentydragon/README.md index 5dea20ef97..f75221ef47 100644 --- a/agentydragon/README.md +++ b/agentydragon/README.md @@ -68,7 +68,7 @@ Tasks live under `agentydragon/tasks/` as individual Markdown files. Please upda agentydragon/tasks/launch-commit-agent.sh [...] ``` -After the Developer agent finishes and updates the task file, the Commit agent will emit the commit message on stdout. An external orchestrator will then stage files, run pre-commit hooks, and perform the actual `git commit`. You do not need to run `git commit` manually. +After the Developer agent finishes and updates the task file, the Commit agent will write the commit message to a temporary file and then commit using that file (`git commit -F`). An external orchestrator can then stage files and run pre-commit hooks as usual. You do not need to run `git commit` manually. --- diff --git a/agentydragon/tasks/launch-commit-agent.sh b/agentydragon/tasks/launch-commit-agent.sh index c0dd63f8fa..3cd58e823c 100755 --- a/agentydragon/tasks/launch-commit-agent.sh +++ b/agentydragon/tasks/launch-commit-agent.sh @@ -5,10 +5,13 @@ # Launch the non-interactive Codex Commit agent for a given task worktree, # using the prompt in prompts/commit.md and the task's Markdown file. # -# Usage: launch-commit-agent.sh - +# Usage: launch-commit-agent.sh [...] set -euo pipefail +# Allocate a temporary file to capture the agent's commit message +last_message_file="$(mktemp)" +trap 'rm -f "$last_message_file"' EXIT + # Usage: one or more task IDs or slugs if [ "$#" -lt 1 ]; then echo "Usage: $0 [...]" >&2 @@ -57,9 +60,10 @@ for input in "$@"; do # Perform commit in the task worktree echo "--- Processing task $task_slug ---" cd "$worktree_path" - cmd=(codex --full-auto exec) + cmd=(codex --full-auto exec --output-last-message "$last_message_file") echo "Running: ${cmd[*]}" - message=$("${cmd[@]}" "$(<"$prompt_file")"$'\n\n'"$(<"$task_file")") + # Write the agent's final message to file, then commit using that file + "${cmd[@]}" "$(<"$prompt_file")"$'\n\n'"$(<"$task_file")" git add -u - git commit -m "$message" + git commit -F "$last_message_file" done