Commit Graph

170 Commits

Author SHA1 Message Date
gsxdsm
c330a62165 feat(KB-082): complete Step 2 — Record failure error in executor 2026-03-29 21:41:51 -07:00
gsxdsm
287ce1d6d2 feat(KB-057): complete Step 2 — useTerminal hook with history, SSE streaming, and command execution 2026-03-29 20:57:18 -07:00
gsxdsm
0e26d1df30 feat(KB-052): refactor GitHub integration to use gh CLI
- Create gh-cli utility module with auth detection and command execution
- Refactor GitHubClient to use gh CLI commands with REST API fallback
- Refactor PR Monitor to use gh CLI for PR operations
- Add listIssues() and getIssue() methods to GitHubClient
- Remove in-app GitHubRateLimiter (gh CLI handles rate limiting)
- Update all tests for gh CLI implementation
- Update AGENTS.md and extension docs for gh CLI auth preference
2026-03-29 20:52:07 -07:00
gsxdsm
6f43bdcdf4 feat(KB-036): add worktreeNaming setting for configurable worktree directory names
- Add worktreeNaming setting type with 'random' | 'task-id' | 'task-title' options
- Update executor to generate worktree names based on setting value
- Create worktree-names.ts utility module with generateWorktreeName function
- Add comprehensive executor tests for all naming strategies
- Update AGENTS.md documentation with setting description and usage
- Include changeset for patch release
2026-03-29 20:48:50 -07:00
gsxdsm
0eb3315911 feat(KB-026): add ntfy.sh push notification support
- Add ntfy settings (ntfyEnabled, ntfyTopic) to core types and config storage
- Create NtfyNotifier service with event-based notifications for task completion/failure
- Add Notifications section to SettingsModal for configuring ntfy topic
- Wire up NtfyNotifier in engine to send notifications on task state changes
- Include ntfy topic in task templates for per-task notification override
- Add comprehensive tests for NtfyNotifier service
2026-03-29 19:46:35 -07:00
gsxdsm
a5393463d5 feat(KB-025): add per-task model overrides for executor and validator
- Add model override fields to Task type and TaskStore (modelProvider, modelId, validatorModelProvider, validatorModelId)

- Extend PATCH /api/tasks/:id endpoint with validation for model fields

- Create ModelSelectorTab component with provider/model dropdowns and tests

- Integrate Model tab into TaskDetailModal for per-task model configuration

- Update executor to use per-task model overrides when both provider and modelId are set

- Update reviewer to use per-task validator model overrides in reviewStep

- Document per-task model selection feature in AGENTS.md settings section
2026-03-29 19:36:15 -07:00
gsxdsm
335298a6a2 feat(KB-007): add manual plan approval setting
- Add requirePlanApproval setting to core types and dashboard config
- Add approve-plan and reject-plan API endpoints with handlers
- Add approve/reject UI buttons to TaskDetailModal for awaiting-approval tasks
- Update triage processor to check requirePlanApproval and set awaiting-approval status
- Add comprehensive tests for API endpoints, UI components, and triage logic
- Update AGENTS.md with documentation for the new setting
2026-03-29 19:23:30 -07:00
gsxdsm
5993264e25 feat(KB-023): add smart automatic merge conflict resolution
- Add conflict classification API: classifyConflict(), getConflictedFiles(), resolveWithOurs(), resolveWithTheirs(), resolveTrivialWhitespace()

- Auto-resolve lock files (ours), generated files (theirs), and trivial whitespace conflicts

- Add smartConflictResolution setting (alias for autoResolveConflicts)

- Track resolution path via resolutionMethod and autoResolvedCount in MergeResult

- Implement 3-attempt retry logic with escalating strategies in aiMergeTask

- Export pattern constants LOCKFILE_PATTERNS and GENERATED_PATTERNS
2026-03-29 18:46:57 -07:00
gsxdsm
e79e28e717 feat(KB-014): add spec editing and AI revision to dashboard
- Add SpecEditor component with view/edit modes and AI revision UI
- Add spec revision API endpoint with column transition validation
- Enhance TriageProcessor for re-specification with feedback support
- Integrate Spec tab in TaskDetailModal with full edit capabilities
- Add comprehensive tests for SpecEditor and revision workflows
2026-03-29 18:42:41 -07:00
gsxdsm
ddaf73554b feat(KB-010): add autoResolveConflicts setting with intelligent merge conflict resolution
- Add autoResolveConflicts setting to types and store (default: true)
- Implement smart conflict detection for lock files and generated files
- Add 3-attempt retry logic with escalating strategies to merger
- Auto-resolve lock files using 'ours', trivial whitespace conflicts
- Track mergeRetries per task for retry loop management
- Update AGENTS.md with conflict resolution documentation
- Add comprehensive merger tests for retry scenarios
2026-03-29 18:27:23 -07:00
gsxdsm
53e09ce581 feat(KB-004): add GitHub PR creation and comment monitoring
- Add PR fields (prInfo, prNumber, prUrl) to Task type and TaskStore with updatePrInfo method
- Add PR Management API endpoints: create, status, refresh with per-repo rate limiting
- Add GitHubClient for PR creation and status fetching with comment support
- Add PrSection component for PR status display and actions in dashboard
- Add PR comment monitoring engine with PrMonitor and PrCommentHandler
- Integrate PR monitoring into scheduler for automatic PR tracking
- Add comprehensive tests for PR features in all packages
2026-03-29 18:10:35 -07:00
gsxdsm
80abb826ee feat(KB-003): add task steering feature with UI and prompt injection
- Add SteeringComment type to core types for user steering input
- Add addSteeringComment method to TaskStore with persistence
- Add POST /api/tasks/:id/steer endpoint for adding steering comments
- Add frontend API client and SteeringTab UI component
- Inject steering comments into execution prompt for agent guidance
- Add comprehensive tests for store, API, UI, and executor components
- Include changeset for patch release
2026-03-29 17:40:42 -07:00
Dustin Byrne
2854553199 fix(KB-182): strengthen spec review post-session gate to require explicit APPROVE
- Change post-session gate from only blocking REVISE to requiring explicit APPROVE verdict
- Block tasks from reaching executor when review_spec was never called (null verdict)
- Block tasks on RETHINK, UNAVAILABLE, and reviewer-error paths
- Add tests for all non-APPROVE verdict paths: null, RETHINK, UNAVAILABLE, reviewer throw
- Update existing tests to invoke review_spec with APPROVE so they pass the stricter gate
2026-03-28 17:41:10 -04:00
Dustin Byrne
d2e2e50a15 feat(KB-176): make enginePaused a soft pause that lets running agents finish
- Remove agent termination listeners for enginePaused in executor and triage
- Update Settings.enginePaused JSDoc to document soft-pause semantics
- Update executor/triage/integration tests to assert sessions are NOT disposed on enginePaused
- Remove pause-abort tracking for enginePaused (only globalPause hard-stops agents)
- Add changeset for the behavioral change
2026-03-28 16:47:23 -04:00
Dustin Byrne
6fdd83dcca fix: triage agent now knows of the task_create tool 2026-03-28 16:30:23 -04:00
Dustin Byrne
0e0643a99e fix: skip merger agent when squash merge stages nothing 2026-03-28 16:30:23 -04:00
Dustin Byrne
00954f2bbc feat(KB-172): add spec review loop to triage agent
- Extend reviewer with 'spec' review type and spec review format template
- Add review_spec tool to triage agent for independent spec quality evaluation
- Implement APPROVE/REVISE/RETHINK loop with conversation rewind on RETHINK
- Add post-session gate to block tasks with unresolved REVISE verdicts from moving to todo
- Add tests for reviewer spec support and triage review loop (APPROVE, REVISE, RETHINK paths)
2026-03-28 16:30:23 -04:00
Dustin Byrne
ceb379d3c9 feat(KB-161): terminate active agent sessions on engine pause
- Add enginePaused agent termination to executor (kills sessions, moves tasks back to todo)
- Add enginePaused agent termination to triage processor (kills sessions, clears specifying status)
- Update enginePaused JSDoc to reflect new termination behavior vs old graceful drain
- Add unit tests for executor/triage pause termination and integration tests for restart flow
- Include changeset for engine pause behavior change
2026-03-28 16:30:23 -04:00
Dustin Byrne
cac10af5e1 feat(KB-157): add soft-pause (enginePaused) alongside hard-stop (globalPause)
- Add enginePaused field to Settings type with soft-pause semantics (drain queue, don't kill agents)
- Gate scheduler, triage, auto-merge, and periodic merge retry on enginePaused
- Add Pause and Stop buttons to dashboard Header replacing single toggle
- Wire enginePaused state through App with optimistic toggle and unpause resume logic
- Add tests for scheduler, triage, dashboard CLI, Header, and App covering pause behavior
2026-03-28 16:30:23 -04:00
Dustin Byrne
3dc741c56e fix(KB-153): detect exhausted-retry errors from pi-coding-agent sessions
- Add checkSessionError helper that re-raises errors stored on session.state.error after prompt() resolves silently when retries are exhausted
- Integrate checkSessionError in executor, triage, merger, and reviewer agents so existing catch blocks with isUsageLimitError can trigger UsageLimitPauser
- Add tests for checkSessionError and for each agent's error propagation path
- Add audit report documenting the error propagation gap
- Add changeset for the fix
2026-03-28 16:30:23 -04:00
Dustin Byrne
a2a12f94eb feat(KB-154): persist worktree pool across engine restarts
- Add rehydrate() method and scanIdleWorktrees() to restore idle worktrees from disk on startup
- Add cleanupOrphanedWorktrees() to remove stale worktrees when recycling is disabled
- Wire startup rehydrate/cleanup into dashboard command based on recycleWorktrees setting
- Export new functions from @kb/engine and update dashboard imports
- Add unit tests for rehydrate/scan/cleanup and integration tests for restart resilience
2026-03-28 16:30:23 -04:00
Dustin Byrne
5e3cafe05b feat(KB-152): make triage poll() dispatch specifyTask() calls concurrently
- Change poll() to fire specifyTask() with `void` instead of `await`, enabling concurrent task specification bounded by AgentSemaphore
- Add JSDoc to poll() documenting concurrent dispatch and re-entrance guard behavior
- Add tests for concurrent dispatch, semaphore limiting, polling flag reset, and overlapping poll discovery
- Update existing re-entrance guard test to block on listTasks (discovery) rather than specifyTask
- Fix existing paused-tasks and globalPause tests for non-blocking dispatch timing
2026-03-28 16:30:23 -04:00
Dustin Byrne
3aa2ec743d feat(KB-151): immediately resume agentic activity on global unpause
- Add settings:updated listener in Scheduler to trigger schedule() on globalPause true→false transition
- Add settings:updated listener in TriageProcessor to trigger poll() on globalPause true→false transition
- Add unpause handler in dashboard to resume orphaned executor tasks and sweep merge queue
- Guard all resume paths against no-op transitions (false→false, true→true) and stopped state
- Add tests for all three resume paths covering transition edge cases
2026-03-28 16:30:23 -04:00
Dustin Byrne
d32c9c031f feat(KB-150): kill active agent sessions on global pause
- Add settings:updated event to TaskStore with previous/new settings payload
- Kill all active executor agent sessions when globalPause transitions false→true
- Kill all active triage specification sessions on global pause with clean status reset
- Track and dispose active merger session on global pause via onSession callback
- Add JSDoc documenting global pause behavior on executor and triage constructors
2026-03-28 16:30:23 -04:00
Dustin Byrne
72a8953e4e fix(KB-148): fix triage concurrency and scheduler double-counting
- Add re-entrance guard to triage poll() to prevent overlapping poll cycles
- Move status update to 'specifying' inside semaphore callback so queued tasks don't appear active
- Fix scheduler double-counting specifying tasks when semaphore is present
- Add tests for poll re-entrance guard, semaphore-aware status transitions, and scheduler slot counting
- Add changeset for patch release
2026-03-28 16:30:23 -04:00
Dustin Byrne
90764b9657 feat(KB-147): auto-pause engine on API usage limit errors
- Add UsageLimitPauser class and isUsageLimitError detector for rate limits, overloaded, and quota errors
- Integrate usage limit detection into executor, triage, and merger error handlers
- Wire shared UsageLimitPauser instance in dashboard startup across all agents
- Export UsageLimitPauser and isUsageLimitError from @kb/engine public API
- Add comprehensive tests for detector patterns and agent integration
2026-03-28 16:30:23 -04:00
Dustin Byrne
50821fc820 feat(KB-145): add global pause button to halt all AI engine activity
- Add globalPause setting to core Settings type with default false
- Guard scheduler, triage, and auto-merge queue to skip work when globalPause is active
- Add pause/play toggle button in dashboard Header with optimistic UI and rollback on failure
- Add tests for scheduler, triage, Header, and App global pause behavior
- Include minor changeset for the new feature
2026-03-28 16:30:23 -04:00
Dustin Byrne
e0f33fb32c feat(KB-142): add confirm gate and abort flow to task_add_dep tool
- Add confirm parameter to task_add_dep requiring explicit opt-in before destructive action
- On confirm, abort execution, discard worktree/branch, and move task to triage
- Add triage as valid transition from in-progress for dependency-triggered re-specification
- Auto-move todo tasks to triage when dependencies are added
- Update EXECUTOR_SYSTEM_PROMPT with task_add_dep confirm behavior documentation
2026-03-28 16:30:23 -04:00
Dustin Byrne
43aada5ebf fix(KB-144): exclude in-review worktrees from maxWorktrees limit
- Change activeWorktrees filter to only count in-progress tasks, not in-review with worktree
- Update existing scheduler test to reflect in-progress-only counting
- Add 3 new tests covering in-review tasks not blocking scheduling
- Update maxWorktrees JSDoc to reflect new semantics
- Add changeset for patch release
2026-03-28 16:30:23 -04:00
Dustin Byrne
8fabee32ef fix: prompt agents to declare dependencies when creating related tasks 2026-03-28 16:30:23 -04:00
Dustin Byrne
f4a6fd3fc1 Revert "feat(KB-140): add task_add_dep tool to executor"
This reverts commit a9dae834a59b60701874ee09e0b1f86d0d98b3e2.
2026-03-28 16:30:23 -04:00
Dustin Byrne
5e4ee94424 feat(KB-139): parse dependencies, size, and review level from PROMPT.md after triage
- Add parseDependenciesFromPrompt to TaskStore to extract task IDs from ## Dependencies section
- Call dependency parser in specifyTask after PROMPT.md is written by triage agent
- Extract size (S/M/L) and review level from PROMPT.md front-matter into task metadata
- Extend updateTask to accept size and reviewLevel fields
- Add comprehensive tests for dependency parsing and triage integration
2026-03-28 16:30:23 -04:00
Dustin Byrne
1ae68ed25f feat(KB-140): add task_add_dep tool to executor
- Add task_add_dep tool allowing agents to declare dependencies mid-execution
- Validate against self-dependency, non-existent targets, and duplicates
- Append new dependency to existing array without overwriting
- Log dependency additions via store.logEntry
- Add 7 tests covering success, self-dep, missing target, duplicate, and append behavior
2026-03-28 16:30:23 -04:00
Dustin Byrne
6d9700bc24 feat(KB-141): add dependency awareness to triage system prompt and task_get tool
- Add 'Dependency awareness' section to TRIAGE_SYSTEM_PROMPT instructing agent to call task_get on dependencies before writing specs
- Update task_get tool description to mention reading dependency task specs
- Add test verifying system prompt contains dependency awareness instructions
- Add test verifying task_get tool description mentions dependency specs
2026-03-28 16:30:23 -04:00
Dustin Byrne
65b958581f feat(KB-138): add priority-based scheduling to AgentSemaphore
- Add priority levels (PRIORITY_MERGE=2, PRIORITY_EXECUTE=1, PRIORITY_SPECIFY=0) to AgentSemaphore
- Update acquire() and run() to accept a numeric priority parameter with FIFO ordering within same level
- Wire priority constants into executor (PRIORITY_EXECUTE) and triage (PRIORITY_SPECIFY) callers
- Add comprehensive tests for priority ordering, FIFO within same priority, and dynamic limit interaction
- Include changeset for the priority-based agent scheduling feature
2026-03-28 16:30:23 -04:00
Dustin Byrne
69dca3e11f feat(KB-130): allow dependent tasks to start from in-review dep branches
- Relax scheduler dep gate to treat in-review tasks as satisfied
- Add resolveBaseBranch() to detect in-review deps with unmerged worktrees
- Executor creates worktrees from dep branch instead of HEAD when baseBranch is set
- Extend file-overlap tracking to include in-review tasks with worktrees
- Add baseBranch field to Task type and store update logic
- Add scheduler and executor tests for in-review dependency handling
2026-03-27 02:15:20 -04:00
Dustin Byrne
46b5e3ccbe feat(KB-126): add RETHINK rewind for plan and code reviews with REVISE enforcement
- Differentiate RETHINK handling between plan reviews (session rewind only) and code reviews (git reset + session rewind)
- Update system prompt with detailed REVISE/RETHINK verdict descriptions for plan vs code review types
- Enforce code review REVISE verdict by blocking task_update(done) until re-review passes
- Capture pre-step session checkpoints in task_update for conversation rewind on RETHINK
- Add comprehensive tests for plan RETHINK, code RETHINK, and REVISE enforcement flows
2026-03-27 01:58:46 -04:00
Dustin Byrne
1f78c75ccb feat(KB-125): implement RETHINK verdict with git reset and session rewind
- Capture pre-step session checkpoint in task_update when status changes to in-progress
- Handle RETHINK verdict with git reset --hard to baseline SHA to revert code changes
- Rewind agent conversation to pre-step checkpoint via navigateTree with branchWithSummary fallback
- Update system prompt to describe RETHINK as automatic revert + rewind behavior
- Replace code review REVISE enforcement tests with comprehensive RETHINK rewind tests
2026-03-27 01:49:43 -04:00
Dustin Byrne
6ae05ade80 feat(KB-124): enforce code review REVISE verdict before step advancement
- Track per-step code review verdicts in executor via codeReviewVerdicts map
- Block task_update(status="done") when last code review returned REVISE
- Update system prompt with enforcement language distinguishing code vs plan reviews
- Add comprehensive tests for verdict tracking, blocking, clearing, and independence across steps
2026-03-27 01:25:06 -04:00
Dustin Byrne
82be575fc0 feat(KB-123): add agent role tracking and expanded logging to agent system
- Extend AgentLogEntry with agent field and new event types (thinking, tool_end)
- Expand AgentLogger with thinking, tool_end callbacks and agent role support
- Wire new logging callbacks in createKbAgent and all agent call-sites (executor, merger, reviewer, triage, pi)
- Update AgentLogViewer with agent role badges and rendering for new entry types
- Export AgentRole and AgentLogType from core package and add tests for new functionality
2026-03-27 01:19:42 -04:00
Dustin Byrne
dc821973fa feat(KB-119): add configurable thinking effort level
- Add defaultThinkingLevel to core Settings types and exports
- Thread thinking level through engine executor, merger, reviewer, triage, and pi
- Add effort dropdown to Model settings UI in SettingsModal
- Add tests for thinking effort dropdown in SettingsModal
2026-03-26 23:13:40 -04:00
Dustin Byrne
c802108a02 refactor(HAI-116): rename kb to hai across all packages, CLI, and docs
- Rename npm packages from @kb/* to @hai/* and update all workspace references
- Rename CLI binary from kb to hai and config directory from .kb to .hai
- Update dashboard UI branding, titles, and references from kb to hai
- Update all test files, CI workflows, and documentation to reflect new naming
- Run comprehensive grep verification to ensure no stale kb references remain
2026-03-26 22:44:11 -04:00
Dustin Byrne
1c5eb494db feat(HAI-113): add structured logger and replace console calls
- Create logger module with log levels and structured output (packages/engine/src/logger.ts)
- Replace console.log/warn/error calls with structured logger across engine modules
- Export logger from engine package index
- Add comprehensive tests for logger functionality
- Clean up CI/release workflows and update docs
2026-03-26 22:44:11 -04:00
Dustin Byrne
1a61f09379 feat(HAI-102): thread model settings through reviewer and merger
- Add defaultProvider and defaultModelId to ReviewOptions interface
- Forward model settings from store to createHaiAgent in reviewer
- Forward model settings from store to createHaiAgent in merger
- Pass settings from executor to reviewStep call
- Add tests for model settings threading in both reviewer and merger
2026-03-26 22:44:11 -04:00
Dustin Byrne
a8b767d6fc feat(HAI-098): add model selection and configuration support
- Extend Settings type with model provider and model name fields
- Add backend API endpoint to list available models
- Add frontend API client for fetching models
- Add model settings section to SettingsModal with provider/model dropdowns
- Update engine executor to use the selected model from settings
2026-03-26 22:44:11 -04:00
Dustin Byrne
615f31c777 feat(HAI-096): add task pause/unpause functionality
- Add paused field to Task data model and store with pauseTask method
- Update triage, scheduler, and executor to respect paused flag and terminate paused tasks
- Add REST API endpoints and CLI commands for pause/unpause operations
- Add dashboard UI visual indicator and toggle for paused state
- Update README with pause/unpause CLI command documentation
2026-03-26 22:44:11 -04:00
Dustin Byrne
9bb25a15ea feat(HAI-099): remove truncation from summarizeToolArgs
- Remove 80-char truncation from bash command summaries in summarizeToolArgs
- Remove length guard from fallback string-valued arg path
- Update agent-logger tests to expect full strings without truncation
- Add test case for long string-valued fallback args
- Update executor tests to match new non-truncating behavior
2026-03-26 19:33:56 -04:00
Dustin Byrne
30593e5f6b feat(HAI-094): add includeTaskIdInCommit setting to control commit scope
- Add includeTaskIdInCommit boolean to Settings type with default true
- Refactor merger to dynamically build system prompt based on setting
- Update fallback commit message to respect the toggle
- Add checkbox to Settings UI under Merge section
- Add unit tests for merger and SettingsModal behavior
2026-03-26 19:29:45 -04:00
Dustin Byrne
121b509686 refactor(HAI-093): extract AgentLogger abstraction and rewire agents
- Add AgentLogger class encapsulating log file management and structured logging
- Add comprehensive unit tests for AgentLogger
- Rewire executor, triage, and merger to use AgentLogger instead of inline logging
- Reduce duplication across agent modules
- Export AgentLogger from engine package index
2026-03-26 19:29:17 -04:00
Dustin Byrne
a8a7fd711b feat(HAI-091): add agent log persistence to triage and merger agents
- Add agent log persistence to triage agent with log capture and storage
- Add agent log persistence to merger agent with log capture and storage
- Add unit tests for triage agent log persistence
- Add unit tests for merger agent log persistence
2026-03-26 01:17:07 -04:00