Commit Graph
238 Commits
Author SHA1 Message Date
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 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 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 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-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 63ff0f2625 Merge branch 'worktree-agent-a1383b58'
# Conflicts:
#	.planning/STATE.md
#	src/main/database.ts
2026-03-26 19:07:13 -04:00
ZacharyZhang-NY 4d47712669 fix(04-01): resolve type errors and update integration tests for wakeup API
- Fix SQLInputValue type in listWakeupRequests params
- Fix leftover pendingWakes reference in worker-service.ts
- Fix RunStatus 'completed' -> 'succeeded' in atomic-checkout test
- Update autonomous-chain.spec.ts to use new wakeup lifecycle API
2026-03-26 19:00:51 -04:00
ZacharyZhang-NY f647a4fdf1 test(04-01): add wakeup lifecycle unit tests covering all CRUD operations
- 10 test cases: enqueue, coalesce (queued + deferred), claim, complete, defer, promote, merge, list with filters
- Validates D-06 trigger_detail JSON array coalescing
- Validates D-07 per-agent scope deduplication
- Validates full state machine: queued -> claimed -> completed, queued -> deferred -> queued
2026-03-26 18:58:18 -04:00
ZacharyZhang-NY 08935b3379 feat(04-01): implement CAS checkout, lock release, stale recovery, and migration 16
- Rewrite checkoutTask to use runId-based CAS with checkout_run_id IS NULL guard
- Add releaseTaskLock and recoverStaleLocks methods
- Add lock release in finishRun and cancelRunForDeletion exit paths
- Add migration 16: pending_wakes to wakeup_requests cutover with DROP TABLE
- Replace all pending_wakes references with wakeup_requests
- Add wakeup lifecycle CRUD: enqueue, claim, complete, defer, promote, list
- Update api-server, orchestration-service, worker-service callers
- Update existing database.test.ts for new checkoutTask signature
2026-03-26 18:56:54 -04:00
ZacharyZhang-NY 02e87dc06d test(04-01): add failing tests for CAS checkout, lock release, stale recovery
- 8 test cases covering CAS semantics, lock release on finishRun/deleteAgent, stale recovery
- Tests expect STALE_LOCK_TIMEOUT_MS export, checkout_run_id/execution_locked_at columns
- RED phase: 5 of 8 tests fail as expected before implementation
2026-03-26 18:51:46 -04:00
ZacharyZhang-NY 77480374fd test(02-01): add failing test for canonical key derivation
- Tests normalizeSkillSlug for edge cases (empty, null, special chars)
- Tests hashSkillValue determinism and 10-char hex output
- Tests deriveCanonicalSkillKey for all 5 source types
- Tests parseSkillImportSource for GitHub, skills.sh, URL, local paths
2026-03-26 00:26:56 -04:00
ZacharyZhang-NY 58d3f4a039 test(02-01): add failing test for SKILL.md format parser
- Tests parseFrontmatterMarkdown with frontmatter, no frontmatter, CRLF normalization
- Tests classifyInventoryKind for all file type classifications
- Tests deriveTrustLevel for script/asset/markdown-only derivation
- Tests estimateTokens for token estimation logic
2026-03-26 00:24:53 -04:00
ZacharyZhang-NY f16ddc44f9 test(02-01): add failing test for skill type definitions
- Tests TOKEN_BUDGETS constant values for 5 adapter types
- Tests type shapes for SkillRecord, RuntimeSkillEntry, ManagedSkillRef
- Tests SkillSourceType (5 members), TrustLevel (3 members), FileInventoryEntry (6 kinds)
2026-03-26 00:23:45 -04:00
ZacharyZhang-NYandClaude Opus 4.6 5b1fc8a105 fix(test): correct secret scoping test — literal fallback is expected behavior
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 23:45:01 -04:00
ZacharyZhang-NY 9d01a7acc4 feat(04-03): add platform launch E2E test with screenshot capture
- Add second test to desktop.smoke.spec.ts validating app launch, window dimensions, and screenshot capture
- Screenshot saved to build/screenshots/launch-{platform}.png for D-07 evidence
- Update playwright.config.ts with outputDir for test artifacts and join import
- Add xvfb-run note for headless Linux CI environments
2026-03-22 16:50:59 -04:00
ZacharyZhang-NYandClaude Opus 4.6 9ebb489644 feat(04-01): create notification service with batching, urgency, and GC protection
- Add createNotificationService with 10s batch window, urgency mapping, click-to-navigate
- Extend DesktopEvent union with NotificationClickEvent type
- Add 10 unit tests covering batching, urgency, NEVER_BATCH, GC protection, Linux urgency
- Platform-specific: silent flag, Windows timeoutType, Linux urgency level

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 16:30:49 -04:00
ZacharyZhang-NY 43cb97ac6d feat(03-02): add SocialDraftPreview component and ApprovalInspector integration
- Create SocialDraftPreview with platform icon, color, content, char count, media URLs, schedule display
- Integrate SocialDraftPreview into ApprovalInspector for social_post approvals
- Add schedule picker with immediate/scheduled radio group and datetime-local input
- Add social_post to type badge with accent styling
- Approve button shows 'Approve & Post' for social_post approvals
- Accessibility: role=region, aria-label, aria-live=polite, role=radiogroup
- Fix test type annotation for TS compatibility
2026-03-22 14:33:47 -04:00
ZacharyZhang-NY e0ee5bb5ad feat(03-02): implement social draft pipeline backend
- Add social_post to ApprovalType union in types.ts
- Add social_post to approvalInputSchema enum in contracts.ts
- Add POST /api/companies/:companyId/social/draft endpoint in api-server.ts
- Add social_post handling in handleApprovalResolved in automation-service.ts
- Browser action payloadJson includes scheduledAt for startup recovery (03-03 contract)
- Scheduled posts use setTimeout for deferred dispatch
- All 13 unit tests pass
2026-03-22 14:30:32 -04:00
ZacharyZhang-NY ce2c3be065 feat(03-01): add searchMessages backend with LIKE query, IPC channel, preload bridge, and tests
- Add searchMessages method to AppDatabase with LIKE query, wildcard escaping, channel scoping, ORDER BY created_at DESC with limit
- Add searchMessages IPC channel and searchMessagesSchema to contracts.ts
- Register IPC handler in ipc-agent-coordination-handlers.ts with Zod validation
- Wire searchMessages through preload bridge
- Add 8 unit tests covering body/subject search, wildcard escaping, channel scoping, empty results, limit, and ordering
2026-03-22 14:29:59 -04:00
ZacharyZhang-NY 14da6b5ede feat(03-03): add budget alert OS notifications and scheduled post recovery
- Add notify() calls at 80% budget threshold warning and 100% exhaustion auto-pause
- Compute percentage as Math.round(utilization * 100) for accurate display
- Add scheduled social post timer re-registration on app startup
- Add unit tests for budget threshold detection and notification logic
2026-03-22 14:29:43 -04:00
ZacharyZhang-NY 8558b113a2 test(03-02): add failing tests for social draft pipeline
- Social draft schema validation tests (valid input, defaults, rejections)
- social_post as valid ApprovalType test (currently fails - not yet added)
- payloadSummary truncation logic tests
- Approval resolution logic: immediate dispatch, deferred dispatch, rejected drafts
- Cross-plan contract: browser action payloadJson includes scheduledAt
2026-03-22 14:27:26 -04:00
ZacharyZhang-NY 64183428ec feat(02-03): crash recovery detection and user notification
- Enhance interruptStaleRuns to return count and mark tasks as blocked
- Add lastInterruptedCount property for bootstrap recovery check
- Add getInterruptedRunsForRecovery query method
- Add retryInterruptedTask, dismissInterruptedTask, markInterruptedTaskFailed actions
- Add recovery-needed IPC event emission in bootstrap between heartbeat and resume
- Create ipc-recovery-handlers.ts with retry/dismiss/fail IPC handlers
- Register recovery handlers in domain handler chain
- Expose recoveryRetry, recoveryDismiss, recoveryFail in preload API
- Add recovery method types to DesktopApi contract
- Create RecoveryBanner component with retry/cancel per interrupted task
- Integrate RecoveryBanner at top of Dashboard view
- Add crash recovery unit tests (9 tests)
2026-03-22 03:57:58 -04:00
ZacharyZhang-NY f3874568a2 feat(02-03): retry-aware failure escalation pipeline
- Add MAX_RETRY_ATTEMPTS (2) and RETRY_COOLDOWN_MS (30s) constants
- Replace immediate escalation with retry-then-escalate logic
- Escalation chain: retry same agent -> manager -> CEO -> user notification
- Reset retry count on successful task completion
- Update Reassign on run failure automation rule with afterRetryExhaustion condition
- Add comprehensive unit tests for escalation state machine (11 tests)
2026-03-22 03:53:18 -04:00
ZacharyZhang-NY 46dee6c66b test(02-02): add circuit breaker and deliverable enforcement tests
- Self-wake circuit breaker tests: trip after 5 wakes, reset on progress, per-agent isolation
- Non-code task deliverable tests: research/content require artifacts, code/general advance normally
2026-03-22 03:52:12 -04:00
ZacharyZhang-NY d09b7445e5 test(02-01): add failing tests for connector-matching heuristic
- 24 test cases covering matchConnector, inferTaskType, getConnectorStrengths
- Tests for preference mapping, fallback behavior, edge cases
- TDD RED phase: module does not exist yet
2026-03-22 03:41:41 -04:00
ZacharyZhang-NY d77486504d feat(01-04): add TanStack Virtual list virtualization and keyboard navigation hook
- Install @tanstack/react-virtual for virtualized list rendering
- Create useRovingTabIndex hook in src/renderer/lib/keyboard.ts for arrow-key navigation
- Add virtualization to 6 lists: TaskQueue, ApprovalList, ActivityList, CostList, AgentRoster, MessageList
- MessageList uses measureElement for variable-height message items with auto-scroll
- All 6 lists have role="listbox" with role="option" on rows for accessibility
- All 6 lists support ArrowDown/ArrowUp/j/k/Home/End keyboard navigation
- Add 8 unit tests for useRovingTabIndex covering all key bindings and edge cases
2026-03-22 02:08:43 -04:00
ZacharyZhang-NYandClaude Opus 4.6 5e9d36c058 feat(01-01): create Zustand store with 6 slices, IPC batcher, and unit tests
- Install zustand 5.x and immer 11.x dependencies
- Create 6 Zustand slices: navigation, company, selection, ui, communication, social
- Create combined store with devtools + immer middleware
- Create IPC event batcher with 50ms debounce window (schedule/flush/dispose)
- Create typed selector hooks for narrow state subscriptions
- Add 14 unit tests covering store initialization, slice behaviors, and batcher timing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 01:30:37 -04:00
ZacharyZhang-NY 53e0f03c0c update 2026-03-18 17:49:10 -04:00
ZacharyZhang-NY 0cd65521b8 update 2026-03-18 14:42:14 -04:00
ZacharyZhang-NY 1ba3147ed2 update 2026-03-18 01:15:58 -04:00
ZacharyZhang-NY 7a3db27ffa update 2026-03-17 12:31:06 -04:00
ZacharyZhang-NY 54bcc77ef7 update 2026-03-16 13:07:14 -04:00
ZacharyZhang-NY d067589276 update 2026-03-15 23:49:46 -04:00
ZacharyZhang-NY 2af82b6bb3 Initialize project and ignore local references 2026-03-15 22:17:07 -04:00