Commit Graph
162 Commits
Author SHA1 Message Date
ZacharyZhang-NY 0a0b2fdce4 fix: prevent onboarding page scrollbar by constraining to viewport height
Change outer container from min-h-[100dvh] to h-[100dvh] and hero panel
from overflow-y-auto to overflow-hidden to prevent unwanted scrollbar
caused by ASCII animation background content.
2026-03-27 22:34:38 -04:00
ZacharyZhang-NY 2106ee1feb fix(11-02): repair broken text strings from mass CSS variable replacement
The mass find-and-replace incorrectly replaced the word 'surface' in
human-readable text strings and type literals, not just CSS class contexts.
Fixed: App.tsx control surface text, DocumentCenter knowledge base text,
i18n en.ts, and Panel tone prop type literal.
2026-03-27 22:24:43 -04:00
ZacharyZhang-NYandClaude Opus 4.6 17cebc277a fix(11-03): add missing @tailwindcss/typography dependency and verify design token migration
- Install @tailwindcss/typography required by styles.css @plugin directive
- All 9 automated verification checks pass: zero old variables, zero old border radius, zero data-theme, 70 OKLCH tokens, key tokens present, status-colors exports verified, no fontsource packages
- Zero renderer type errors, build succeeds

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 22:18:32 -04:00
ZacharyZhang-NY 06ea4c6aec feat(11-02): replace 1113 old CSS variable references with Paperclip design tokens
- Replace all bg-[color:var(--old)] with bg-background/bg-card/bg-muted/bg-primary etc.
- Replace all text-[color:var(--old)] with text-foreground/text-muted-foreground/text-primary etc.
- Replace all border-[color:var(--line)] with border-border
- Replace all inline var(--old) with var(--new) equivalents
- Replace all rounded-[6px]/rounded-[8px] with rounded-lg
- Replace .surface class with bg-card border border-border shadow-sm
- Replace .focus-ring class with focus-visible Tailwind utilities
- Replace .mono class with font-mono
- Replace data-theme attribute with class-based dark mode
- 99 files updated, ~1265 lines changed, zero old references remaining
2026-03-27 22:12:00 -04:00
ZacharyZhang-NY 2ed5dd3388 chore: merge wave 1 (plan 11-01) with conflict resolution 2026-03-27 22:08:16 -04:00
ZacharyZhang-NY 22314876b3 feat(11-01): create status-colors.ts module and remove font packages
- Add status-colors.ts with Paperclip semantic status color mappings
- Export statusBadge, issueStatusIcon, issueStatusText, agentStatusDot, priorityColor
- Remove @fontsource-variable/inter, @fontsource-variable/jetbrains-mono, @fontsource/instrument-serif
2026-03-27 22:06:02 -04:00
ZacharyZhang-NY 02426bc861 feat(11-01): replace hex CSS vars with Paperclip OKLCH design tokens
- Replace entire styles.css with OKLCH token system (light + dark modes)
- Switch dark mode from data-theme attribute to .dark CSS class
- Update App.tsx theme toggle to use classList.toggle with system preference detection
- Switch fonts from Inter/JetBrains Mono to Maple Mono/Maple Mono NF CN
- Add chart tokens, sidebar tokens, 0px border radius
- Preserve sidebar-drag, ascii-scroll-track, reduced-motion support
- Remove fontsource font imports from main.tsx
2026-03-27 22:05:10 -04:00
ZacharyZhang-NY 047b09eae4 test(10-01): add cross-subsystem pipeline integration tests
- 6 tests exercising full 5-subsystem pipeline (D-04)
- Quality gate -> CAS checkout -> budget gate -> session -> completion
- Budget exhaustion blocks subsequent runs correctly
- Session token accumulation across multiple runs verified
- CAS double-checkout prevention in pipeline context
- Uses real AppDatabase, budget enforcement, session management services
2026-03-27 20:32:54 -04:00
ZacharyZhang-NY c395dbe8bf test(10-02): session rotation during execution edge case tests (D-05.3)
- Rotation triggered when run count exceeds maxRuns threshold
- Rotation triggered when token count exceeds maxTokens threshold
- Handoff markdown generated with task title and run history
- New session after rotation has clean counters (0 runs, 0 tokens)
- Claude connector exempt from rotation (nativeContextManagement)
- Codex connector exempt from rotation (nativeContextManagement)
- Handoff markdown available for next run context after rotation
2026-03-27 20:32:45 -04:00
ZacharyZhang-NY 2f80c319f9 test(10-02): budget exhaustion mid-run edge case tests (D-05.2)
- In-flight run completes normally when budget exhausted by another run
- Budget gate blocks next run after exhaustion
- BlockedBy returns detailed policy/scope/spent/limit info
- Agent-scope exhaustion blocks even when company budget has room
- Budget gate transitions from allowed to blocked after spending
- Cost entry recorded even when budget would be exceeded
2026-03-27 20:31:44 -04:00
ZacharyZhang-NY 4f5a14671d test(10-01): add process recovery integration tests
- 10 tests covering worker crash detection, lock release, agent reset
- Session handoff markdown generation with real DB
- Context preservation (D-02): agent assignment retained after crash
- DB consistency verification: no running runs/agents, no orphaned locks
- Multiple concurrent runs all interrupted on crash
- Uses real AppDatabase with temp dirs, gemini_local connector
2026-03-27 20:31:17 -04:00
ZacharyZhang-NY e14964ade3 test(10-02): concurrent checkout edge case tests (D-05.1)
- CAS rejects second claimer when two agents attempt same task
- Losing agent can checkout a different task
- In-progress status guard blocks new checkouts
- Lock release clears fields but CAS still checks status
- Stale lock recovery frees locks and resets status to todo
- Recovered task can be re-checked-out by another agent
- STALE_LOCK_TIMEOUT_MS validated at 15 minutes
2026-03-27 20:30:34 -04:00
ZacharyZhang-NYandClaude Opus 4.6 41c5dccae4 feat(09-02): wire App.tsx granular event routing with batch handler
- Replace createEventBatcher with createDomainEventBatcher in App.tsx
- Add handleGranularBatch for task, run, approval, agent, and budget events
- Task/run/approval events trigger targeted IPC fetch and Zustand patch
- Run completion and budget changes trigger full refresh (cross-entity)
- Failed entity fetches fall back to removeTask or full refresh
- Unknown event types trigger full refresh (PERF-03 safety)
- Sidebar badges refresh after every successful granular batch
- Add 12 integration tests for handleGranularBatch in selective-ipc.test.ts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 19:49:55 -04:00
ZacharyZhang-NYandClaude Opus 4.6 ffab9888ed chore(09-02): merge main to get plan 01 infrastructure
- Resolve merge conflicts in worker-service.ts and ipc-core-work-graph-handlers.ts
- Keep granular emitEvent calls from plan 02 while preserving session management and task validation from main
- Fix duplicate createSkillService import in service-graph.ts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 19:47:33 -04:00
ZacharyZhang-NYandClaude Opus 4.6 5124209ddb feat(09-02): convert high-frequency callsites to granular emitEvent
- Replace publishDomainChanged() with granular events at 9 high-frequency callsites
- saveTask/deleteTask emit task-updated events in ipc-core-work-graph-handlers
- decideApproval emits approval-updated, addComment emits task-updated
- worker-service emits run-updated for status changes and completion
- worker-service emits agent-updated for budget hard-stop pause
- orchestration-service emits agent-updated for auto-pause, run-updated for dispatch
- Wire emitEvent dependency to orchestration-service via service-graph
- Keep publishDomainChanged for low-frequency and multi-entity paths

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 19:45:30 -04:00
ZacharyZhang-NY 039c1d117f Merge branch 'worktree-agent-a2f30682'
# Conflicts:
#	.planning/STATE.md
#	src/main/ipc-core-read-handlers.ts
#	src/shared/contracts.ts
2026-03-27 19:40:29 -04:00
ZacharyZhang-NYandClaude Opus 4.6 f172a3d9b3 feat(09-01): build enhanced event batcher with granular event coalescing
- Add createDomainEventBatcher with entity type+ID dedup within 50ms window
- Domain-changed overrides all granular events in same batch
- More than 10 unique entities triggers full refresh fallback
- Delete action preserved during coalescing (last-write-wins otherwise)
- Unknown event types trigger full refresh as safety fallback
- Legacy createEventBatcher preserved for backward compatibility
- Add 12 comprehensive tests for all coalescing behaviors

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 19:35:05 -04:00
ZacharyZhang-NYandClaude Opus 4.6 920a764856 feat(09-01): define granular event types, IPC channels, entity getters, and Zustand patch methods
- Add 5 granular event interfaces (TaskUpdated, RunUpdated, ApprovalUpdated, AgentUpdated, BudgetChanged) to DesktopEvent union
- Add 4 entity getter IPC channels (getTask, getAgent, getRun, getApproval) with Zod validation and company ownership checks
- Add getRun method to AppDatabase following existing getTask pattern
- Add 4 preload bridge methods for entity getters
- Add 8 patch/remove methods and refreshBadges to CompanySlice
- Add selective-ipc.test.ts with exhaustive union type tests
- Extend store.test.ts with 14 patch method tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 19:33:33 -04:00
ZacharyZhang-NY 76a69494a1 fix(08): use getBudgetStatus IPC for company/agent/project scope budget utilization 2026-03-27 18:45:32 -04:00
ZacharyZhang-NY 907a5dfe2f Merge branch 'worktree-agent-a5b08020'
# Conflicts:
#	.planning/STATE.md
#	package.json
#	pnpm-lock.yaml
2026-03-27 09:04:16 -04:00
ZacharyZhang-NYandClaude Opus 4.6 b6c5b2a9ee feat(08-02): create 5 dashboard chart components with ChartSection container
- Add RunActivityChart (area chart), SuccessRateChart (line chart), CostTrendChart (area chart), AgentWorkloadChart (bar chart) using Recharts
- Add BudgetUtilization with CSS progress bars, color thresholds (success/warn/danger), and empty state
- Create ChartSection container orchestrating all charts with Framer Motion entrance animation
- Integrate ChartSection into Dashboard.tsx between MetricsGrid and NeedsAttention
- Add companyId prop to DashboardProps and pass from App.tsx
- Include Plan 01 infrastructure: chart-utils.ts, ChartCard.tsx, ChartTooltip.tsx, recharts dependency
- All charts respect reduced motion via useReducedMotion hook
- 16 unit tests pass for aggregation functions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 08:59:59 -04:00
ZacharyZhang-NY 40b01f24e9 Merge branch 'worktree-agent-a1f54db6'
# Conflicts:
#	.planning/STATE.md
2026-03-27 08:51:34 -04:00
ZacharyZhang-NYandClaude Opus 4.6 31328d5a3b feat(08-01): create ChartCard wrapper and ChartTooltip components
- ChartCard: shared chart card with title, period badge, empty state, role="img" accessibility
- ChartTooltip: custom Recharts tooltip with design system tokens, color dots, mono font
- Both use CSS custom properties for automatic dark mode support
- TypeScript compiles cleanly with Recharts TooltipContentProps type

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 08:47:07 -04:00
ZacharyZhang-NYandClaude Opus 4.6 a45e6bc10c feat(08-01): install Recharts and create tested data aggregation functions
- Install recharts@3.8.1 as dependency
- Create chart-utils.ts with 4 exported pure functions: aggregateRunsByDay, aggregateCostsByDay, aggregateAgentWorkload, formatShortDate
- Create dashboard-charts.test.ts with 16 unit tests covering all aggregation behaviors
- All tests pass: 14-day bucketing with zero-fill, timed_out/interrupted as failed, null cost handling, top-8 + Others grouping, name truncation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 08:44:49 -04:00
ZacharyZhang-NY 2ffdfdc0b5 fix: remove extra closing brace from merge conflict resolution 2026-03-27 00:49:10 -04:00
ZacharyZhang-NY fd3f5accc1 Merge branch 'worktree-agent-a205edfb'
# Conflicts:
#	.planning/STATE.md
#	src/main/orchestration-service.ts
#	src/main/task-quality-gates.ts
#	tests/unit/task-quality-gates.test.ts
2026-03-27 00:47:58 -04:00
ZacharyZhang-NYandClaude Opus 4.6 c4eb4423db feat(07-02): wire sweepStaleReviews into heartbeat timer
- Import sweepStaleReviews, resolveApprovalDecision, dispatchAgentMessage
- Insert stale review sweep into per-company heartbeat loop after budget reset
- Sweep runs on every 15-second heartbeat cycle for each active company
- Local callback stubs for handleTaskStatusChange and handleApprovalResolved
- Error handling prevents sweep failures from crashing the heartbeat loop
- Fix test type casts to use as-unknown-as for vi.fn mock compatibility
- TypeScript compiles cleanly, 249/249 tests pass

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 00:43:08 -04:00
ZacharyZhang-NYandClaude Opus 4.6 0bfbdec09b feat(07-02): implement sweepStaleReviews with escalation chain
- sweepStaleReviews queries tasks in in_review status exceeding 30-min timeout
- Escalation dispatched to reviewer's manager (manager's manager in chain)
- When reviewer is CEO (no higher manager), desktop notification sent to human
- Pending approvals auto-approved with documented timeout note
- Task status advanced from in_review to done after escalation
- Race condition with manual approval handled via try-catch (Pitfall 3)
- Tasks without assigneeAgentId skipped gracefully
- Exports REVIEW_TIMEOUT_MS (1800000ms) and SweepStaleReviewsDeps interface
- 8 comprehensive unit tests covering all TASK-04 behaviors

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 00:39:41 -04:00
ZacharyZhang-NYandClaude Opus 4.6 e1f8a3c9ab test(07-02): add failing tests for sweepStaleReviews escalation
- 8 tests covering TASK-04 stale review escalation logic
- Escalation to manager's manager, CEO fallback notification
- Auto-approve pending approvals, race condition handling
- Task status advancement, no-assignee skip, timeout constant

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 00:38:57 -04:00
ZacharyZhang-NYandClaude Opus 4.6 4d1085fc04 chore(07-02): bring in plan 01 prerequisites
Cherry-pick plan 01 task quality gate validation module and its
integration into IPC, API server, and automation service.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 00:37:36 -04:00
ZacharyZhang-NY 8ef70259e0 Merge branch 'worktree-agent-a3712f2b'
# Conflicts:
#	.planning/STATE.md
2026-03-27 00:34:55 -04:00
ZacharyZhang-NY a9ce25e6dd feat(07-01): wire task quality gates into all creation paths
- Add SaveTaskResult type to contracts.ts (id + optional capabilityWarning)
- IPC handler: validate new tasks, reject with TASK_VALIDATION_FAILED, check capability match
- API server: validate POST /issues and meeting action items before db.saveTask
- Automation service: validate create_task action, skip with warning if invalid
- CapabilityMatchDb interface uses optional skill methods for graceful degradation
- TypeScript compiles cleanly across all process boundaries
- All 241 tests pass with zero regressions
2026-03-27 00:31:27 -04:00
ZacharyZhang-NY 025920bc12 feat(07-01): implement task quality gate validation module
- validateTaskCreation: min 50 char description, heartbeat bypass, acceptance criteria check
- checkAcceptanceCriteria: 12 keyword patterns for structured task definitions
- checkCapabilityMatch: word-overlap matching with skill fallback and graceful degradation
- All 25 unit tests passing across TASK-01, TASK-02, TASK-03 requirements
2026-03-27 00:27:06 -04:00
ZacharyZhang-NY d38b59255c test(07-01): add failing tests for task quality gate validation
- validateTaskCreation: description length, heartbeat bypass, acceptance criteria
- checkAcceptanceCriteria: keyword detection for 12 patterns
- checkCapabilityMatch: capability overlap, skill fallback, graceful degradation
2026-03-27 00:26:25 -04:00
ZacharyZhang-NYandClaude Opus 4.6 a1d361b947 feat(06-02): wire session handoff injection into prompt builder and orchestration dispatch
- Add sessionHandoff field to PromptContext interface and Session Handoff section in buildSystemPrompt
- Add getSessionHandoff dependency to orchestration service, load handoff before prompt build
- Update orchestration to prefer task_sessions table over legacy tasks.session_json (SESS-01)
- Wire getSessionHandoff through ServiceGraph into createOrchestrationService

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 23:05:16 -04:00
ZacharyZhang-NYandClaude Opus 4.6 5271f7ee5d feat(06-02): wire token usage tracking, session accumulation, and rotation into worker pipeline
- Add inputTokens/outputTokens fields to worker run-finished messages and workerMessageSchema
- Wire sessionService into WorkerServiceDependencies and ServiceGraph lazy slot
- Add token accumulation and rotation evaluation in run-finished handler
- Add 7 wiring integration tests verifying accumulation, rotation, and guard paths

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 23:03:23 -04:00
ZacharyZhang-NYandClaude Opus 4.6 e54c632fd6 feat(06-01): add session management service with rotation, thresholds, and delta tracking
- Create createSessionManagementService factory with accumulateTokenUsage,
  evaluateRotation (configurable thresholds per D-01), generateHandoff,
  rotateSession, getHandoffContext, snapshotUsage, getUsageDelta
- Export DEFAULT_THRESHOLDS (maxRuns: 20, maxTokens: 500k, maxAgeHours: 72) and RotationThresholds type
- Adapter nativeContextManagement exemption skips rotation for Claude/Codex (D-04)
- Handoff markdown capped at 2000 chars with structured sections (D-06)
- Add 14 unit tests for service: rotation thresholds, adapter exemption, configurable
  thresholds, token accumulation, handoff generation, session rotation, usage delta

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 22:56:18 -04:00
ZacharyZhang-NYandClaude Opus 4.6 2c671d0011 feat(06-01): add task_sessions CRUD, nativeContextManagement flag, TaskSessionRecord type
- Add getActiveTaskSession, incrementSessionUsage, archiveSession, createNewSession,
  getRecentRunsForTask, getRecentActivityForTask methods to AppDatabase
- Add nativeContextManagement optional boolean to ServerAdapterModule interface
- Set nativeContextManagement: true for claude_local and codex_local, false for gemini_local
- Add TaskSessionRecord interface to shared types
- Add unit tests for task_sessions CRUD and adapter exemption flags

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 22:53:39 -04:00
ZacharyZhang-NY e55ddeffd8 docs(phase-05): complete phase execution 2026-03-26 21:28:02 -04:00
ZacharyZhang-NY 1c462d571c feat(05-03): policy-level BudgetSummary, incident-based BudgetAlertBanner, AgentEditor policy wiring
- BudgetSummary shows policy-level utilization bars when companyId provided, falls back to agent-level
- BudgetAlertBanner loads open incidents for policy-based alerts (warn_threshold/hard_stop), falls back to agent thresholds
- AgentEditor reads budget from budget_policies and writes budget as policy on save (D-11)
- Dashboard passes companyId through to BudgetAlertBanner
2026-03-26 21:17:02 -04:00
ZacharyZhang-NY 3a8e4c40ad feat(05-03): PolicyList, PolicyFormModal, IncidentList and costs tab navigation
- Create PolicyList with utilization bars, edit/delete, empty state
- Create PolicyFormModal with scope selector, dollar amount, warn/hard-stop toggles
- Create IncidentList with status filtering and manual resolve action
- Add tabbed navigation (Cost Entries | Policies | Incidents) to costs section
- Export new components from execution barrel file
2026-03-26 21:13:17 -04:00
ZacharyZhang-NY 4e5429929a feat(05-02): replace flat budget check with policy-based gate, wire incident checks into run completion and heartbeat
- Replace flat budgetMonthlyUsd check with evaluateBudgetGate in getRunEligibilityFailure
- Add projectId parameter to getRunEligibilityFailure for project-scope policy evaluation
- Update all 3 call sites to pass projectId where task context is available
- Wire checkAndCreateIncidents into worker-service run-finished handler for post-run incident creation
- Wire autoCloseExpiredIncidents into heartbeat for window rollover cleanup (D-06)
- Pass budgetService dependency to orchestration-service and worker-service via service-graph
- Mark autoPauseBudgetExceededAgent as deprecated (superseded by BudgetEnforcementService)
2026-03-26 21:02:12 -04:00
ZacharyZhang-NY feea5c1fe9 feat(05-02): IPC handlers, preload bridge, and ServiceGraph wiring for budget enforcement
- Create ipc-budget-handlers.ts with 6 budget channel handlers (save/delete/list policies, list/resolve incidents, get status)
- Add budgetService to RegisterDomainHandlersDependencies interface
- Register budget handlers in ipc-domain-handlers.ts composition
- Add BudgetEnforcementService lazy slot in service-graph.ts with getOrCreateBudgetEnforcementService
- Pass budgetService to domain handler registration in main-runtime-support.ts
- Fix preload bridge to pass {companyId} object for listBudgetPolicies and getBudgetStatus
- D-06: checkAutoResolve called on saveBudgetPolicy to auto-resolve incidents on limit increase
2026-03-26 20:57:52 -04:00
ZacharyZhang-NYandClaude Opus 4.6 72cb921069 feat(05-01): BudgetEnforcementService factory with policy evaluation and incident lifecycle
- evaluateBudgetGate: strictest-wins blocking (D-01), no-policy=unlimited (D-02)
- checkAndCreateIncidents: warn + hard-stop thresholds with dedup (D-07, D-08)
- checkAutoResolve: auto_resolved_limit_increase when limit increases (D-06)
- autoCloseExpiredIncidents: window rollover cleanup (D-06)
- getBudgetStatus: summary of all policies with current spend
- Notifications with budget_warning and budget_exhaustion batch keys
- Factory pattern matching createAutomationService convention

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 20:48:37 -04:00
ZacharyZhang-NYandClaude Opus 4.6 3a68cfa707 feat(05-01): budget enforcement types, schemas, IPC channels, and database CRUD
- Add BudgetPolicyRecord, BudgetIncidentRecord, BudgetStatusSummary types
- Add 6 IPC channels for budget operations in contracts.ts
- Add Zod schemas for all budget payloads
- Add DesktopApi entries for budget methods
- Add database CRUD: saveBudgetPolicy, deleteBudgetPolicy, listBudgetPolicies,
  getBudgetPolicy, getActivePoliciesForRun, getSpentInWindow (cents aggregation),
  upsertBudgetIncident (D-08 dedup), resolveIncidentsForPolicy,
  resolveWarnIncidentsForPolicy, autoCloseExpiredIncidents
- Update recordRunCompletion to include project_id in cost_entries INSERT
- Add migration 18: convert agent budgetMonthlyUsd to budget_policies rows
- Add preload bridge stubs for budget IPC channels

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 20:47:20 -04:00
ZacharyZhang-NYandClaude Opus 4.6 245eb4ccf3 test(05-01): add tests for budget policy evaluation and incident lifecycle
- Budget policy CRUD (save, update, delete)
- getActivePoliciesForRun with multi-scope matching
- getSpentInWindow with cents aggregation per scope (company/agent/project)
- evaluateBudgetGate strictest-wins logic (D-01)
- upsertBudgetIncident with deduplication (D-08)
- resolveIncidentsForPolicy and autoCloseExpiredIncidents (D-06)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 20:43:50 -04:00
ZacharyZhang-NY 2be909b67c fix(04): add active_session_id and project_id to ensureOptionalColumns
Migration 13 columns were skipped when ensureOptionalColumns added
checkout_run_id first, triggering 'duplicate column' catch that marked
the entire migration as applied without running remaining ALTERs.
2026-03-26 19:22:26 -04:00
ZacharyZhang-NY 930273ce87 feat(04-02): worker lock release, wake promotion, IPC wakeup channel, and preload bridge
- Add releaseTaskLock to worker crash recovery after finishRun (EXEC-02)
- Track affected agent company IDs for targeted wake promotion
- Replace listWakeupRequests+loop with promoteWakeupRequests+wakeAgentIfPossible in run completion
- Track hadDeferredWakes flag for circuit breaker self-wake decision
- Add listWakeupRequests IPC channel to IPC_CHANNELS
- Add wakeupQuerySchema with Zod validation and WakeupRequestRecord interface
- Add listWakeupRequests to DesktopApi type
- Add listWakeupRequests preload bridge method
- Add registerHandle for listWakeupRequests IPC handler with company validation
2026-03-26 19:16:17 -04:00
ZacharyZhang-NY 8a424822a5 feat(04-02): wire CAS checkout and stale recovery into orchestration-service
- Add randomUUID import for pre-generated runId in CAS checkout flow
- Replace task-level hasActiveRun checks with db.checkoutTask CAS in startAgentHeartbeatRun and queueTaskRun
- Pass pre-generated runId to createRun (database.ts accepts optional id field)
- Log execution.checkout_rejected activity on CAS failure (D-04)
- Return fail("CHECKOUT_RACE_LOST") in queueTaskRun on CAS failure
- Rewrite wakeAgentIfPossible with proper lifecycle tracking via enqueueWakeupRequest
- Add stale lock recovery sweep at startup (resumeQueuedRuns) and each heartbeat tick
- Log execution.lock_recovered activity entries for recovered stale locks
2026-03-26 19:13:09 -04:00
ZacharyZhang-NY 63ff0f2625 Merge branch 'worktree-agent-a1383b58'
# Conflicts:
#	.planning/STATE.md
#	src/main/database.ts
2026-03-26 19:07:13 -04:00