- Explicitly set gitSessionCountRef in the polling restart effect to
make the data-flow self-documenting (ref is already current from
render-phase assignment, but being explicit eliminates ambiguity)
- Expand EARLY_EXIT_EXACT_MATCH_THRESHOLD comment explaining why 50
was chosen (3x margin over MAX_SUGGESTION_RESULTS, exact matches
get +50 bonus in fuzzyMatchWithScore)
- Export getScaledPollInterval for direct unit testing
- Add test coverage for all new optimizations:
- File tree traversal cap (60k node tree capped at 50k)
- Empty filter fast path (skips fuzzy matching, returns sorted)
- Early exit behavior with exact substring matches
- Git polling interval scaling across all thresholds
- Custom interval bypass (user-configured intervals not scaled)
- Tab completion file tree cap
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Addresses input lag when many AI agents are active simultaneously
on repositories spanning 100k+ files by reducing unnecessary React re-renders,
capping file tree traversal, and scaling git polling with session count.
- Add anyChanged guard in useBatchedSessionUpdates flush to preserve
referential identity when no sessions were actually modified, avoiding
~7 unnecessary re-renders/sec during agent streaming
- Cap file tree traversal at 50k entries in useAtMentionCompletion and
useTabCompletion to prevent main thread blocking on huge repos
- Skip fuzzy matching entirely for empty @mention filter (just typed @),
and add early exit after 50 exact substring matches to avoid exhaustive
search through 100k+ files
- Scale git polling interval dynamically based on git session count
(30s for 1-3, 45s for 4-7, 60s for 8-12, 90s for 13+) to reduce
sustained CPU/IO load from parallel git status processes
Break the 1,870-line monolithic stats-db.ts into 13 focused modules under
src/main/stats/, following the same pattern used in the agents module refactor.
Key improvements:
- StatementCache for prepared statement reuse across CRUD operations
- DB guard accessor (get database()) replaces 18 repeated null checks
- Transaction-wrapped clearOldData for atomic multi-table cleanup
- _meta table replaces external file for vacuum timestamp storage
- Row mapper functions centralize snake_case-to-camelCase conversion
- runStatements() helper eliminates repeated split-by-semicolon patterns
- Migration functions accept db param instead of relying on class context
- CSV export adds isRemote column and RFC 4180 compliant escaping
- Statement caches properly cleared on database close
Split the 6,400-line monolithic test file into 8 focused test files under
src/__tests__/main/stats/ matching the source module structure.
Addresses code review suggestion to reduce repeated path patterns across
binary definitions by extracting shared builders (npmGlobal, localBin,
homebrew, wingetLinks, etc.) as closures within each platform function.
Type Safety (Medium Priority):
- Replace `any` types in AgentConfigOption with discriminated union
- Four specific types: CheckboxConfigOption, TextConfigOption,
NumberConfigOption, SelectConfigOption
- Update agent-args.ts to handle new types with proper assertions
Error Handling (Medium Priority):
- Add try/catch wrapper around runModelDiscovery to gracefully
handle exceptions and return empty array on failure
Performance (Medium Priority):
- Implement parallel path probing using Promise.allSettled
- Previously: sequential checks (6-10 paths, one after another)
- Now: all paths checked concurrently, first success returned
- Maintains priority order while reducing detection time
- Significant improvement on slow file systems/network drives
Configuration (Low Priority):
- Make model cache TTL configurable via constructor parameter
- Default remains 5 minutes, but can be customized for testing
Logging (Low Priority):
- Add debug logging for silent error swallowing in checkCustomPath
Documentation (Low Priority):
- Enhanced module-level JSDoc for detector.ts and path-prober.ts
- Document detection strategy and caching behavior
Testing:
- Add cache TTL expiration test using fake timers
- Add constructor TTL configuration test
- Extract LiveSessionManager (178 lines) for live session and AutoRun state tracking
- Extract CallbackRegistry (208 lines) for centralized callback management
- Reduce WebServer.ts from 778 to 582 lines (25% reduction)
- Add managers/ directory with proper exports
- Maintain consistent public API (no breaking changes)
- Move WebServer class to dedicated file and add module index
- Extract shared types to centralized types.ts
- Fix XSS vulnerability by sanitizing sessionId/tabId in URL parameters
- Fix IPC listener memory leak with proper cleanup on timeout
- Add autoRunStates cleanup when sessions go offline
- Refactor message handlers with send() and sendError() helpers
- Add XSS sanitization tests and e2e test configuration
- Add retry logic with exponential backoff for stats DB insertions
(100ms, 200ms, 400ms delays, max 3 attempts)
- Fix import order in types.ts (move constant after imports)
- Update stats-listener tests for async retry behavior
- Add new test for retry success on transient failure
Addresses review recommendations:
- High: Stats database error handling with retry logic
- Low: Import order consistency
- Extract agent:clearError and agent:retryAfterError handlers from
main/index.ts to dedicated handlers/agent-error.ts module
- Add comprehensive test coverage for agent error handlers (29 tests)
- Centralize GROUP_CHAT_PREFIX constant in process-listeners/types.ts
to eliminate duplication across 4 listener files
- Remove unused ipcMain import from main/index.ts (all IPC handlers
now registered through handlers module)
PR Review Fixes:
- Fix race condition in exit-listener by moving markAndMaybeSynthesize
to explicit code paths instead of finally() block
- Add buffer size limits (MAX_BUFFER_SIZE 10MB) with warning logs
- Add REGEX_BATCH_SESSION and REGEX_SYNOPSIS_SESSION for proper filtering
- Fix type safety using canonical ToolExecution and UsageStats imports
- Fix usage-listener indentation bug where safeSend was inside wrong block
Performance Optimizations:
- Add GROUP_CHAT_PREFIX constant for fast string prefix checks
- Skip expensive regex matching for non-group-chat sessions
- Eliminate redundant loadGroupChat calls by using updateParticipant
return value directly (DB caching)
- Add MSG_ID_RANDOM_LENGTH constant for web broadcast deduplication
Test Coverage:
- Add 4 new test files (exit, data, usage, session-id listeners)
- Total 93 tests covering edge cases, DB caching, and performance
- Verify exact participants data flow from updateParticipant
- Test optional emitter handling and empty participants arrays
- types.ts: ProcessListenerDependencies interface and type re-exports.
- data-listener.ts: Process output streaming with group chat buffering.
- exit-listener.ts: Process exit handling with routing, recovery, synthesis.
- session-id-listener.ts: Agent session ID tracking for group chat.
- usage-listener.ts: Token/cost statistics for participants and moderator.
- error-listener.ts: Agent error logging and forwarding.
- stats-listener.ts: Query-complete events for stats database.
- forwarding-listeners.ts: Simple IPC forwarding (slash-commands, etc.).
This reduces main/index.ts by ~600 lines (1270 → 670) and adds 15 new tests covering forwarding, error, and stats listeners.
## CHANGES
- Extract dev server port and URL into separate variables
- Add radix parameter to `parseInt` for proper number parsing
- Sync port configuration between Vite config and main process
- Use consistent port parsing with explicit base 10 radix
- Use module-level flag instead of try-catch for IPC handler registration
- Improve error logging to capture full context with stack traces
- Add race condition protection for quit confirmation flow
Extract app lifecycle functionality into dedicated modules with dependency
injection pattern for improved testability and maintainability:
- error-handlers.ts: Global uncaught exception and unhandled rejection handlers
- cli-watcher.ts: CLI activity file watcher with start/stop lifecycle
- window-manager.ts: Window creation with state persistence and auto-updater
- quit-handler.ts: Quit confirmation flow and cleanup orchestration
This reduces main/index.ts by ~200 lines and adds 48 new tests covering
all extracted functionality.
- Add MAX_GROUP_CHAT_BUFFER_SIZE (10MB) to prevent memory exhaustion
- Add buffer truncation with marker when exceeding limit
- Add isGroupChatBufferTruncated() to check truncation status
- Add debugLogLazy() for lazy evaluation of expensive string operations
- Use proper TypeScript types (StoredSession, Group) in web-server-factory
- Add 15 new tests for buffer limits and lazy logging
1 - Pure function extractions:
- constants.ts: Add regex patterns and debugLog for group chat
- group-chat/session-parser.ts: parseParticipantSessionId
- group-chat/output-parser.ts: Text extraction from agent JSONL output
- group-chat/output-buffer.ts: Streaming output buffer management
2 - Dependency injection factories:
- utils/safe-send.ts: createSafeSend for safe IPC messaging
- web-server/web-server-factory.ts: createWebServerFactory for web server
Added 133 new unit tests across 6 test files for full coverage of
extracted modules.
* docs: add git hash display and configurable dev server port
## CHANGES
- Add `VITE_PORT` env variable to configure dev server port
- Display git commit hash in About modal next to version
- Add `__GIT_HASH__` build-time constant to both Vite configs
- Document running multiple Maestro instances with git worktrees
- Update CONTRIBUTING.md with parallel development instructions
* feat: add configurable ports for dev servers
- Allow VITE_PORT to configure main dev server port
- Update main window to load from configurable port
- Enable VITE_WEB_PORT for web interface dev server
- Add note in CONTRIBUTING.md about port configuration
- Log port usage in development mode
* docs: update CONTRIBUTING.md section and fix React DevTools script initialization
## CHANGES
- Rename "Linting" section to "Linting & Pre-commit Hooks" in table of contents
- Move script variable declaration outside conditional block
- Fix React DevTools script initialization order in index.html
* chore: update `.vscode/settings.json` with new markdownlint config
* fix: disable biome linting. Project uses ESLint
* chore: Update baseline-browser-mapping (>2 months old, warning message on "npm run build:web")
* chore: add .vscode/ to gitignore
* chore: fix gitignore to ignore .cscode/* files properly
* fix
* chore: stop tracking .vscode/ files, respect gitignore
Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
- Add merged manifest lookup for local playbook imports
- Read local manifest and merge with official during import
- Display "Local" badge for custom playbooks in marketplace UI
- Add source badge in playbook detail view sidebar
- Support filesystem paths (absolute and tilde) for local playbooks
- Add comprehensive tests for local playbook import scenarios
- Add tests for merged manifest lookup and source tagging
- Fix mock file reads to handle local manifest ENOENT cases
- Agent Usage chart now tracks Maestro sessions, not providers 🎯
- Map session IDs to friendly names in charts and legends 🏷️
- Limit Agent Usage chart to top 10 sessions by queries 🔟
- Toggle Agent Usage chart between query counts and time metrics ⏱️
- Auto Run queries now record stats with accurate `source: auto` 🤖
- Interactive queries detect Auto Run state to tag stats correctly 🧠
- Smarter cumulative token normalization avoids inflated first-event context % 🛡️
- About modal shows dev commit hash alongside app version 🔍
- Group chat history summaries now strip markdown for cleaner reading 🧹
- Replace any[] with proper types in settings.ts (StoredSession, Group).
- Replace console.log with logger service in process.ts.
- Add consistent debug logging across remote IPC handlers.
- Remove all console.log/console.error statements in favor of logger
- Fix potential race condition in TTS queue by setting isTtsProcessing
flag before checking queue length
- Add comprehensive JSDoc comment explaining TTS_MIN_DELAY_MS (15s) rationale
- Fix type guard for stdin error handling with proper type checks
Add JSDoc comment explaining that web handlers require access to
module-level webServer state with getter/setter functions for proper
lifecycle management, which is why they are registered separately
in main/index.ts rather than through registerAllHandlers().
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add path traversal protection in attachments handlers using path.basename()
- Extract IMAGE_EXTENSIONS constant in filesystem.ts to avoid duplication
- Extract SERVER_STARTUP_TIMEOUT_MS and SERVER_STARTUP_POLL_INTERVAL_MS constants in web.ts
- Add proper AITabData type for aiTabs parameter in web:broadcastTabsChange handler
Add debug logging to help diagnose web broadcast issues. Logs webServer
existence and client count when broadcastUserInput is called.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>