diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-03-15 03:39:49 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-03-15 03:39:49 +0000 |
| commit | 6ff67a57d72317360cacd4b41560395ded117d20 (patch) | |
| tree | 39fdc413f3c985dcf13424bbca01eb152d80e3c5 /test | |
| parent | 43440200facf9f7c51ba4f4638e69e7d651dd50d (diff) | |
feat: fix task failures via sandbox improvements and display commits in Web UI
- Fix ephemeral sandbox deletion issue by passing $CLAUDOMATOR_PROJECT_DIR to agents and using it for subtask project_dir.
- Implement sandbox autocommit in teardown to prevent task failures from uncommitted work.
- Track git commits created during executions and persist them in the DB.
- Display git commits and changestats badges in the Web UI execution history.
- Add badge counts to Web UI tabs for Interrupted, Ready, and Running states.
- Improve scripts/next-task to handle QUEUED tasks and configurable DB path.
Diffstat (limited to 'test')
| -rw-r--r-- | test/next-task.test.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/next-task.test.sh b/test/next-task.test.sh new file mode 100644 index 0000000..3304efa --- /dev/null +++ b/test/next-task.test.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# test/next-task.test.sh + +set -euo pipefail + +# Create a temporary database +TEST_DB=$(mktemp) +sqlite3 "$TEST_DB" <<EOF +CREATE TABLE tasks ( + id TEXT PRIMARY KEY, + state TEXT NOT NULL, + parent_task_id TEXT, + created_at DATETIME DEFAULT CURRENT_TIMESTAMP, + updated_at DATETIME DEFAULT CURRENT_TIMESTAMP, + priority TEXT DEFAULT 'normal' +); +EOF + +# Insert a COMPLETED task that will not have a PENDING child or sibling, +# to ensure the fallback logic is triggered. +sqlite3 "$TEST_DB" "INSERT INTO tasks (id, state, created_at) VALUES ('completed-no-children', 'COMPLETED', '2023-01-01 12:00:00');" + +# Inject a QUEUED task (should be picked by fallback) +sqlite3 "$TEST_DB" "INSERT INTO tasks (id, state, priority, created_at) VALUES ('queued-task-id', 'QUEUED', 'high', '2023-01-01 10:00:00');" + +# Inject a PENDING task (lower priority, should not be picked first by fallback) +sqlite3 "$TEST_DB" "INSERT INTO tasks (id, state, priority, created_at) VALUES ('pending-task-id', 'PENDING', 'normal', '2023-01-01 11:00:00');" + +# Run the next-task script with the temporary database path +export DB_PATH="$TEST_DB" # Override DB_PATH for the test +SCRIPT_DIR="$(dirname "$(dirname "$0")")/scripts" +NEXT_TASK_ID=$("$SCRIPT_DIR/next-task") + +# Assert that the QUEUED task is returned +if [[ "$NEXT_TASK_ID" == "queued-task-id" ]]; then + echo "Test passed: QUEUED task was selected by fallback." +else + echo "Test failed: Expected 'queued-task-id', got '$NEXT_TASK_ID'" + exit 1 +fi + +# Clean up +rm "$TEST_DB" |
