Skip to content

Commit 6deafed

Browse files
himattmclaude
andcommitted
Update READMEs for raw log files, per-task tabs, and stale task cleanup
Project README: - Document both .log and .raw.log output files with version info - Add command= to success/failure output examples - Add command and server_id to database schema table - Clarify cleanup is per-task (not per-file) Plugin README: - Describe per-task closeable output tabs instead of single Output tab - Document click-to-reopen, stale task detection, optimistic cancel - Document OutputStreamer raw log preference with .log fallback - Add OpenSettingsAction to project structure Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 06e076e commit 6deafed

2 files changed

Lines changed: 23 additions & 11 deletions

File tree

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,9 @@ The queue state is stored in SQLite at `/tmp/agent-task-queue/queue.db`:
348348
| `id` | INTEGER | Auto-incrementing primary key |
349349
| `queue_name` | TEXT | Queue identifier (e.g., "global", "android") |
350350
| `status` | TEXT | Task state: "waiting" or "running" |
351+
| `command` | TEXT | Shell command being executed |
351352
| `pid` | INTEGER | MCP server process ID (for liveness check) |
353+
| `server_id` | TEXT | Server instance UUID (for orphan detection across PID reuse) |
352354
| `child_pid` | INTEGER | Subprocess ID (for orphan cleanup) |
353355
| `created_at` | TIMESTAMP | When task was queued |
354356
| `updated_at` | TIMESTAMP | Last status change |
@@ -387,23 +389,29 @@ To reduce token usage, full command output is written to files instead of return
387389

388390
```
389391
/tmp/agent-task-queue/output/
390-
├── task_1.log
392+
├── task_1.log # Formatted log with metadata and section markers
393+
├── task_1.raw.log # Raw stdout+stderr only (for plugin streaming)
391394
├── task_2.log
395+
├── task_2.raw.log
392396
└── ...
393397
```
394398

399+
Each task produces two output files:
400+
- **`task_<id>.log`** — Formatted log with headers (`COMMAND:`, `WORKING DIR:`), section markers (`--- STDOUT ---`, `--- STDERR ---`, `--- SUMMARY ---`), and exit code. Used by the IntelliJ plugin notifier and the "View Output" action.
401+
- **`task_<id>.raw.log`** — Raw stdout+stderr only, no metadata. Used by the IntelliJ plugin for clean streaming output in tabs. Added in MCP server v0.4.0.
402+
395403
**On success**, the tool returns a single line:
396404
```
397-
SUCCESS exit=0 31.2s output=/tmp/agent-task-queue/output/task_8.log
405+
SUCCESS exit=0 31.2s command=./gradlew build output=/tmp/agent-task-queue/output/task_8.log
398406
```
399407

400408
**On failure**, the last 50 lines of output are included:
401409
```
402-
FAILED exit=1 12.5s output=/tmp/agent-task-queue/output/task_9.log
410+
FAILED exit=1 12.5s command=./gradlew build output=/tmp/agent-task-queue/output/task_9.log
403411
[error output here]
404412
```
405413

406-
**Automatic cleanup**: Old files are deleted when count exceeds 50 (configurable via `MAX_OUTPUT_FILES`).
414+
**Automatic cleanup**: Old files are deleted when count exceeds 50 tasks (configurable via `--max-output-files`).
407415

408416
**Manual cleanup**: Use the `clear_task_logs` tool to delete all output files.
409417

intellij-plugin/README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ Click the widget to open the tool window. Configure the display mode in **Settin
1919

2020
### Tool Window
2121

22-
Two tabs:
23-
24-
- **Queue** — Table of all tasks with ID, status, queue name, command, and relative time. Toolbar actions for refresh, cancel, clear, and view output.
25-
- **Output** — Live streaming console view of the currently running task's output. Automatically switches when a new task starts running.
22+
- **Queue** tab — Table of all tasks with ID, status, queue name, command, and relative time. Toolbar actions for refresh, cancel, clear, view output, and settings. Click a running task row to open its output tab.
23+
- **Output** tabs — Per-task closeable tabs with live streaming console output. Automatically opened when a task starts running. Tabs can be closed and reopened by clicking the running task in the queue table.
2624

2725
### Notifications
2826

@@ -34,7 +32,7 @@ Balloon notifications for queue events (can be disabled in settings):
3432
| Task finishes (exit 0) | Info balloon | "Finished: `./gradlew build`" |
3533
| Task fails (exit != 0) | Error balloon (sticky) | "Failed: `./gradlew build`" + View Output action |
3634

37-
Failure detection works by reading the `EXIT CODE` from the task's output log after it disappears from the queue.
35+
Failure detection works by reading the `EXIT CODE` from the formatted task log (`task_<id>.log`) after it disappears from the queue.
3836

3937
## Architecture
4038

@@ -57,12 +55,15 @@ Two independent polling loops, each active only when needed:
5755
- 1s interval when tasks exist (active)
5856
- 3s interval when queue is empty (idle)
5957
- Supports manual refresh via a conflated coroutine channel
58+
- Detects stale tasks by checking if the server PID is still alive (`kill -0`), and removes them from the DB
6059

61-
**Output file tailer** (`OutputStreamer`) — Tails the running task's log file:
60+
**Output file tailer** (`OutputStreamer`) — Tails the running task's output file:
6261
- Only active while a task is running (no coroutine exists otherwise)
6362
- 50ms interval when new data was just read (active streaming)
6463
- 200ms interval when no new data (waiting for output)
6564
- Uses `RandomAccessFile` with byte offset tracking to read only new content
65+
- Prefers `task_<id>.raw.log` (MCP server v0.4.0+) for clean output with no filtering
66+
- Falls back to `task_<id>.log` with header skipping and marker filtering for MCP server v0.3.x and earlier
6667

6768
We chose polling over `java.nio.file.WatchService` because WatchService on macOS falls back to internal polling at 2-10s intervals (no native kqueue support for file modifications in Java), which would actually be slower.
6869

@@ -87,6 +88,8 @@ All UI components subscribe to `TaskQueueModel.TOPIC` on the IntelliJ message bu
8788

8889
Task cancellation sends SIGTERM to the process group (negative PID), waits 500ms, then sends SIGKILL if still alive. The Python task runner uses `start_new_session=True` when spawning subprocesses, which creates a dedicated process group — this ensures `kill -TERM -<pgid>` cleanly terminates the entire process tree.
8990

91+
The UI is updated optimistically — the task is removed from the model immediately so the table responds instantly, before the background process kill and DB cleanup complete. The poller reconciles with the DB on subsequent polls.
92+
9093
## Database Schema
9194

9295
The plugin reads from the `queue` table:
@@ -102,7 +105,7 @@ The plugin reads from the `queue` table:
102105
| `created_at` | TIMESTAMP | When task was queued |
103106
| `updated_at` | TIMESTAMP | Last status change |
104107

105-
Output logs are at `<data_dir>/output/task_<id>.log`.
108+
Output logs are at `<data_dir>/output/task_<id>.log` (formatted) and `<data_dir>/output/task_<id>.raw.log` (raw output, MCP server v0.4.0+).
106109

107110
## Building
108111

@@ -142,6 +145,7 @@ src/main/kotlin/com/block/agenttaskqueue/
142145
│ ├── CancelTaskAction.kt # Cancel selected task
143146
│ ├── ClearQueueAction.kt # Clear all tasks
144147
│ ├── OpenOutputLogAction.kt # Open log file in editor
148+
│ ├── OpenSettingsAction.kt # Open settings page
145149
│ ├── RefreshQueueAction.kt # Manual refresh
146150
│ └── TaskQueueDataKeys.kt # DataKey for selected task
147151
├── data/

0 commit comments

Comments
 (0)