Commit Graph

170 Commits

Author SHA1 Message Date
Dustin Byrne
fc57042522 fix(HAI-092): use generateWorktreeName for fresh worktree directories
- Replace task ID with generateWorktreeName for worktree directory paths
- Worktrees now use human-friendly adjective-noun names (e.g. swift-falcon)
- Add tests for fresh worktree naming, task ID exclusion, and resumed task reuse
2026-03-26 01:16:41 -04:00
Dustin Byrne
2baa119969 feat(HAI-082): display tool call details in AgentLogViewer
- Extend AgentLogEntry type with optional detail field for tool metadata
- Thread tool args through engine executor callbacks to populate detail
- Render tool detail (name, args) in AgentLogViewer component
- Add unit tests for store, executor, and AgentLogViewer changes
2026-03-26 00:59:11 -04:00
Dustin Byrne
93a79a5bfa fix(HAI-086): handle ENOENT gracefully in specifyTask
- Move updateTask call inside try block so ENOENT from deleted tasks is caught
- Add ENOENT check in catch to log and skip instead of treating as a failure
- Preserve existing error handling for non-ENOENT errors
- Add resilience tests covering ENOENT scenarios in specifyTask
2026-03-26 00:57:49 -04:00
Dustin Byrne
5dea073d22 feat(HAI-078): add configurable task prefix to settings
- Add taskPrefix field to Settings type and use it in allocateId
- Update store listTasks and handleFsChange to support any task prefix
- Update triage duplicate regex to match configurable prefix
- Add Task Prefix input to dashboard SettingsModal UI
- Add tests for prefix-aware task allocation and settings modal
2026-03-26 00:48:38 -04:00
Dustin Byrne
40099be89e feat(HAI-075): add project commands to buildExecutionPrompt
- Inject test and build commands from settings into the execution prompt
- Add Project Commands section with testCommand and buildCommand when configured
- Hoist getSettings call above the isResume check so commands are always available
- Add unit tests for project command propagation in buildExecutionPrompt
- Update integration test assertions for the hoisted getSettings call
2026-03-26 00:42:28 -04:00
Dustin Byrne
af69220031 fix: merger uses HEAD not hardcoded main for diff/log context 2026-03-26 00:37:48 -04:00
Dustin Byrne
20264a854d feat(HAI-072): add agent log viewer with persistence, streaming, and UI
- Add agent log persistence layer with JSONL append/read and event emission in core store
- Add server-side SSE log streaming endpoint and REST route for fetching logs
- Create AgentLogViewer component and useAgentLogs hook for real-time log display
- Integrate log viewer into TaskDetailModal
- Fix pre-existing build and test errors
2026-03-26 00:36:48 -04:00
Dustin Byrne
96bacb5d65 fix(HAI-074): add missing imports in triage.ts and executor.test.ts
- Add Static type import from pi-ai in triage.ts
- Add aiMergeTask import from merger.js in executor.test.ts
- Add WorktreePool import from worktree-pool.js in executor.test.ts
2026-03-26 00:22:24 -04:00
Dustin Byrne
502c2398b4 fix(HAI-066): remove console.log for file overlap deferral in scheduler
- Remove console.log statement when deferring tasks due to file overlap
- Add test verifying no console.log is emitted on file overlap deferral
2026-03-26 00:11:46 -04:00
Dustin Byrne
cdb0ae5d41 feat(HAI-065): add file-scope overlap detection with blockedBy tracking
- Add blockedBy field to Task type and core store
- Update scheduler to set blockedBy when deferring tasks due to file-scope overlap
- Render file-scope overlap badge on TaskCard in dashboard
- Add tests for blockedBy store logic, scheduler deferral, and TaskCard badge
- Simplify and refactor existing executor, triage, and CLI command code
2026-03-26 00:09:42 -04:00
Dustin Byrne
123c481dfc feat(HAI-042): add file attachment support for tasks
- Expand MIME type support for text file uploads
- Add --attach flag to CLI task create command
- Surface attachments to triage agent with image content support
- Reference attachments in executor prompt for task execution context
- Add drag-and-drop file upload on dashboard task cards
2026-03-26 00:06:41 -04:00
Dustin Byrne
afcd074caa feat(HAI-061): make scheduler and triage processor read settings dynamically
- Update Scheduler to read settings dynamically from the store instead of using static config
- Make TriageProcessor poll interval dynamic so it responds to settings changes
- Update dashboard.ts wiring to pass dynamic settings through to engine components
- Add scheduler and triage processor tests for dynamic settings behavior
- Remove unused InlineCreateCard and stale test files
2026-03-26 00:04:50 -04:00
Dustin Byrne
be09b212d8 fix(HAI-062): add missing getSettings to mock store in merger.test.ts
- Add getSettings mock method to createMockStore using DEFAULT_SETTINGS
- Update @hai/core import to include DEFAULT_SETTINGS value export
2026-03-25 23:57:14 -04:00
Dustin Byrne
1bfeda5f9c feat(HAI-058): suppress repetitive worktree-limit log in scheduler
- Add wasWorktreeLimited flag to only log worktree limit on first occurrence
- Reset flag when worktrees free up so the message reappears on next saturation
- Add tests verifying single log on repeated maxed passes
- Add test verifying log reappears after slots free and re-saturate
2026-03-25 23:52:08 -04:00
Dustin Byrne
35177f448f feat(HAI-055): add failed task status handling with retry support
- Set task status to 'failed' on execution failure in engine executor
- Add failed indicator styling on TaskCard component
- Add POST /tasks/:id/retry API endpoint and client function
- Add retry button in TaskDetailModal for failed tasks
- Add tests for failed indicator, retry endpoint, and modal behavior
2026-03-25 23:50:11 -04:00
Dustin Byrne
95ec4bc4a1 feat(HAI-054): implement pool recycling in aiMergeTask cleanup step
- Release worktree back to pool when recycleWorktrees setting is enabled
- Skip worktree removal when released to pool, preserving it for reuse
- Fall through to force-remove behavior when pool is unavailable or recycling is disabled
2026-03-25 23:39:27 -04:00
Dustin Byrne
cd165cdb5d feat(HAI-052): deduplicate worktree name word lists and add uniqueness tests
- Remove duplicate entries from adjective and noun word lists in worktree-names.ts
- Add tests to verify all adjectives are unique
- Add tests to verify all nouns are unique
- Ensure generated worktree names remain distinct
2026-03-25 23:34:13 -04:00
Dustin Byrne
ae2f9cfaea fix(HAI-050): update merger mock to export aiMergeTask via importOriginal
- Refactor merger.js mock to use importOriginal and spread actual exports
- Preserve aiMergeTask export while still mocking findWorktreeUser
- Add missing listTasks mock to merger worktree pool integration test
2026-03-25 23:28:29 -04:00
Dustin Byrne
539c1c6af9 fix(HAI-047): resolve const reassignment and undeclared variable in executor.ts
- Change isResume from const to let to allow reassignment in fallback branch
- Remove reference to undeclared variable isReuse
2026-03-25 23:19:06 -04:00
Dustin Byrne
30f6e902cb feat(HAI-045): normalize queued status for file-scope-deferred tasks
- Set status to queued in scheduler for file-scope-deferred tasks
- Normalize queued badge display in TaskCard component
- Add TaskCard unit tests for queued status rendering
- Add scheduler tests for file-scope-deferred task queuing
- Move logo.svg to correct public directory
2026-03-25 23:17:00 -04:00
Dustin Byrne
3f7814e14b fix(HAI-044): type params in triage tool execute callbacks
- Import Static type utility from pi-ai
- Extract taskGetParams schema to a named constant
- Add explicit type annotations to task_get execute callback params
- Improve type safety for triage tool parameter handling
2026-03-25 23:12:06 -04:00
Dustin Byrne
c82f7f73cd feat(HAI-040): count specifying tasks toward maxConcurrent
- Count triage tasks with status 'specifying' as active agent slots in scheduler
- Rewrite scheduler tests to focus on concurrency slot accounting
- Add tests for specifying-only, mixed, and no-specifying scenarios
- Use direct schedule() invocation pattern to avoid timer complexity in tests
2026-03-25 23:09:43 -04:00
Dustin Byrne
b9d7c89905 feat(HAI-034): use humanized worktree names instead of task-ID-based directories
- Add worktree-names module with adjective-animal name generator (generateWorktreeName)
- Update executor to assign humanized random worktree names and support dependency worktree reuse
- Remove task-ID fallback paths from merger and store; add shared worktree cleanup via findWorktreeUser
- Remove worktree pool module and related scheduler/integration tests
- Update dashboard worktree label tests and add JSDoc documentation for worktree naming
2026-03-25 23:09:25 -04:00
Dustin Byrne
74379bdbce feat(HAI-037): add WorktreePool for recycling idle worktrees
- Add recycleWorktrees setting to control worktree pooling behavior
- Implement WorktreePool class with acquire/release/prepareForTask lifecycle
- Integrate pool into executor: acquire warm worktrees, skip init command for pooled entries
- Integrate pool into merger: release worktrees to pool instead of removing on task completion
- Add comprehensive unit and integration tests for pool, executor, and merger interactions
2026-03-25 23:08:04 -04:00
Dustin Byrne
bf37701775 fix(HAI-038): add re-entrance guard and improve overlap detection testability
- Add re-entrance guard to schedule() preventing concurrent passes from starting conflicting tasks
- Extract pathsOverlap() to module-level export for direct unit testing
- Add comprehensive scheduler test suite with overlap and concurrency coverage
- Add JSDoc explaining why the guard is needed and how inProgressScopes stays consistent
2026-03-25 23:03:56 -04:00
Dustin Byrne
f92c842fb3 test(HAI-035): add restart integration tests for engine recovery scenarios
- Create test infrastructure with mock helpers for executor, merger, and scheduler
- Add in-progress task resume tests covering worktree recovery and branch handling
- Add in-review merge handling tests for post-crash merge completion
- Add triage re-pick and scheduler restart tests
- Add crash scenario edge case tests for partial state recovery
2026-03-25 22:52:37 -04:00
Dustin Byrne
b41e215246 feat(HAI-033): add dependency-chain worktree reuse and conditional cleanup
- Add executor logic to resolve and reuse dependency worktrees for warm build caches
- Add reuseWorktree method that creates a new branch in an existing worktree
- Add findWorktreeUser helper to check if a worktree is shared across tasks
- Update executor and merger cleanup to skip worktree removal when still in use
- Add comprehensive tests for worktree reuse and conditional cleanup paths
2026-03-25 22:51:43 -04:00
Dustin Byrne
c51fa74732 fix: deps wait for done (merged) not in-review 2026-03-25 22:40:02 -04:00
Dustin Byrne
edd42c269d feat(HAI-027): add configurable test and build commands to settings
- Add testCommand and buildCommand optional fields to Settings type
- Inject configured commands into triage agent context for task specs
- Add test/build command input fields to the settings modal UI
- Remove legacy executor-level command handling in favor of triage injection
- Add triage tests covering command injection behavior
2026-03-25 22:19:47 -04:00
Dustin Byrne
289f865689 feat(HAI-027): complete Step 2 — inject commands into triage agent context 2026-03-25 22:17:44 -04:00
Dustin Byrne
8ae79a95de feat(HAI-026): complete Step 2 — execute worktreeInitCommand after worktree creation 2026-03-25 22:11:36 -04:00
Dustin Byrne
69ff2f7aa0 feat: squash merge for clean one-commit-per-task history
- git merge --squash replaces git merge --no-ff
- Merge agent prompt updated for squash flow
- Fallback detection uses staged changes instead of MERGE_HEAD
- Abort uses git reset --merge instead of git merge --abort
- Store fallback merge also squashes + commits
2026-03-25 22:02:33 -04:00
Dustin Byrne
a6d18e1b53 feat: replace .DONE file with task_done tool
- task_done() marks all remaining steps as done and signals completion
- No more filesystem side channel for completion detection
- Removes all .DONE references from executor and prompts
2026-03-25 21:51:34 -04:00
Dustin Byrne
b5da595f3b feat: triage agent gets task_list and task_get tools for duplicate detection
- task_list: returns all non-done tasks (ID, column, description, deps)
- task_get: returns full task detail including PROMPT.md content
- Agent calls task_list to scan for duplicates, task_get to verify
2026-03-25 21:48:33 -04:00
Dustin Byrne
f74a1f3597 feat(HAI-022): add duplicate task detection during triage
- Add duplicate check instructions to specification prompt
- Read existing tasks before writing spec to detect duplicates
- Agent outputs DUPLICATE: {id} instead of PROMPT.md when duplicate found
- Parse agent output for duplicate flag and auto-close duplicate tasks
- Log duplicate relationship before deleting the duplicate task
2026-03-25 21:48:22 -04:00
Dustin Byrne
285893d026 feat: triage agent checks for duplicate tasks before specifying
- Triage prompt instructs agent to read existing task.json files
- If duplicate found, agent writes DUPLICATE: HAI-XXX to PROMPT.md
- Triage processor detects this and deletes the duplicate task
- Avoids wasting tokens specifying work that's already tracked
2026-03-25 21:47:23 -04:00
Dustin Byrne
34fe3fe969 fix(HAI-019): add generic type parameters to tool definitions
- Extract tool parameter schemas to module-level constants for reuse
- Add Static<typeof schema> type annotations to tool execute callbacks
- Import Static type from @mariozechner/pi-ai
- Remove inline parameter schema definitions from tool objects
2026-03-25 21:45:43 -04:00
Dustin Byrne
e7d964f9d2 feat(HAI-013): add markdown rendering styles and TaskDetailModal tests
- Add markdown-body base styles in dashboard styles.css
- Remove backdrop and enable scroll on task detail prompt rendering
- Add TaskDetailModal unit tests with vitest jsdom environment
- Update vitest config with globals and jsdom support
- Clean up unused test files and legacy concurrency module
2026-03-25 21:45:05 -04:00
Dustin Byrne
99502e4e05 feat: resume orphaned in-progress tasks on engine restart 2026-03-25 21:42:47 -04:00
Dustin Byrne
9596430016 fix(HAI-019): complete Step 1 — add generic type parameters to tool definitions
Extract TypeBox schemas to module-level constants and use Static<typeof schema>
to explicitly type execute callback params, resolving all TS7006 implicit-any
errors in the four create*Tool methods.
2026-03-25 21:33:15 -04:00
Dustin Byrne
60be31927f feat(HAI-016): add shared AgentSemaphore for concurrent agent limiting
- Create AgentSemaphore class in engine/src/concurrency.ts with configurable maxConcurrent
- Integrate semaphore into TriageProcessor and TaskExecutor to gate agent spawning
- Wire semaphore into merge path and dashboard engine components
- Add comprehensive tests for concurrency, executor, and triage integration
- Update JSDoc and types for maxConcurrent configuration option
2026-03-25 21:27:29 -04:00
Dustin Byrne
0f80d4f2b2 feat(HAI-016): complete Step 5 — wire semaphore into dashboard engine components 2026-03-25 21:25:07 -04:00
Dustin Byrne
1ebde5701a feat: task_create tool accepts optional dependencies 2026-03-25 21:22:19 -04:00
Dustin Byrne
6a45531a79 feat(HAI-016): complete Step 4 — integrate semaphore into merge path 2026-03-25 21:21:42 -04:00
Dustin Byrne
d487ebee51 feat(HAI-016): complete Step 3 — integrate semaphore into TaskExecutor 2026-03-25 21:19:07 -04:00
Dustin Byrne
640c288832 feat(HAI-016): complete Step 2 — integrate semaphore into TriageProcessor 2026-03-25 21:17:31 -04:00
Dustin Byrne
6379008a88 feat(HAI-016): complete Step 1 — create shared AgentSemaphore 2026-03-25 21:14:13 -04:00
Dustin Byrne
b8d4853e85 feat: register task_update, task_log, task_create as agent tools
Replaces CLI-based progress reporting (hai task update/log/create)
with custom tools registered on the worker's pi session. No PATH
dependency, no shell overhead, works in any worktree.

- task_update(step, status) — update step lifecycle
- task_log(message) — log actions and decisions
- task_create(description) — create tasks for out-of-scope work
- review_step unchanged (already a tool)
- System prompt and execution prompt updated to reference tools
2026-03-25 21:04:20 -04:00
Dustin Byrne
64b28a012e feat(HAI-007): complete Step 1 — set specifying status during triage 2026-03-25 20:52:01 -04:00
Dustin Byrne
f6dc070bd8 feat(HAI-005): add auto-merge functionality for in-review tasks
- Add autoMerge boolean to Settings model with default false
- Add auto-merge toggle UI to the In Review column header
- Implement server-side auto-merge behavior in dashboard command
- Fix pre-existing build errors in types, executor, and dashboard server
- Update README with auto-merge documentation
2026-03-25 20:48:34 -04:00