Conversation
…uide - Add docs/API.md with comprehensive REST endpoint and WebSocket event documentation - Add docs/ARCHITECTURE.md with system diagram, directory structure, and data flow - Add docs/TROUBLESHOOTING.md with common issues and solutions - Update PLAN.md with expanded documentation links - Update README.md with new documentation references - Fix test for model selection (move 'fix typo' to coding keywords group)
Major features: - M22: Orphan auto-retry - agents retry up to 3x, then create investigation task - M23: Self-improvement system - 11 rotating task types (UI, security, code quality, etc.) - M24: Goal-driven proactive mode - CoS always working, never idle - M25: Task learning system - tracks completion rates and model effectiveness Self-improvement task types: - ui-bugs, mobile-responsive, security, code-quality - console-errors, performance, accessibility - cos-enhancement, test-coverage, documentation, feature-ideas Security fixes: - Command injection prevention in git.js (spawn instead of exec) - Path traversal protection in screenshots.js UI improvements: - Compact two-line status widget (same on mobile/desktop) - Real status messages instead of rotating placeholders - useMemo for expensive derived state Configuration changes: - Evaluation interval: 5min → 1min - App cooldown: 1hr → 30min - Idle priority: LOW → MEDIUM - New: proactiveMode, goalsFile settings New files: - data/COS-GOALS.md - mission and goals for CoS - server/services/selfImprovement.js - self-improvement utilities - server/services/taskLearning.js - task completion tracking - Various test files for better coverage
- Add M25 (Task Learning System) documentation to PLAN.md - Completion tracking, success rate analysis, model effectiveness - API endpoints: /api/cos/learning, /durations, /backfill - Add M26 (Scheduled Scripts) documentation to PLAN.md - Cron scheduling, agent triggers, command allowlist - Schedule presets and trigger actions - Update API.md with new endpoints: - CoS Task Learning section - CoS Scheduled Scripts section - Script WebSocket events - Update ARCHITECTURE.md with new services: - Task Learning Service - Script Runner Service - Update README.md features list: - Task Learning - Scheduled Scripts
- Add aria-hidden="true" to decorative icons in buttons with visible text - Add aria-label attributes to icon-only buttons for screen readers - Add aria-expanded attributes to expand/collapse toggle buttons - Add role="dialog" and aria-modal to modal components - Fix AppIcon component to properly handle decorative vs meaningful icons - Add aria-label to file inputs and action buttons in CoS components
- Add "Today's Activity" section to HealthTab showing completed tasks, success rate, time worked, and recent accomplishments - Add command allowlist validation for scripts with defense-in-depth validation at create, update, and execution time - Extract shared formatters (formatTime, formatRuntime, formatBytes) to client/src/utils/formatters.js for DRY compliance - Add comprehensive tests for apps, history, agents, and taskClassifier
- Remove debug console.log statements from client socket service - Fix duplicated Start button logic in AppTile component - Remove TODO comment in memory.js (convert to design note) - Remove unused isStopped variable in AppTile
SECURITY ADVISORY: This commit addresses multiple command injection
vulnerabilities identified during a security audit.
## Vulnerabilities Fixed:
### CRITICAL: Command Injection in commands.js and scriptRunner.js
- The command execution service only validated the base command but
passed the full command string to a shell via `sh -c`, allowing
attackers to inject arbitrary commands using shell metacharacters
(e.g., `npm; rm -rf /` or `npm && malicious_cmd`)
- Fixed by:
1. Adding DANGEROUS_SHELL_CHARS regex to reject commands containing
shell metacharacters (;|&\`$(){}[]<>\\!#*?~)
2. Using spawn() with shell:false and array arguments instead of
passing strings to a shell
### MEDIUM: Command Injection in scaffold.js
- npm create and gh repo create commands used execAsync with
user-provided directory/organization names
- Fixed by using spawn() with shell:false and array arguments
### MEDIUM: Command Injection via PID in agents.js and cos-runner
- Functions accepting PID parameters passed them directly to shell
commands without validation
- Fixed by parsing PIDs as integers and rejecting invalid values
## Security Measures Implemented:
- All user input now validated before use in shell commands
- spawn() with shell:false used instead of exec/execAsync where possible
- Shell metacharacter blocklist prevents bypass attempts
- PID parameters validated as positive integers
All 296 tests pass after changes.
…ents - Add isPidAlive check in cleanupOrphanedAgents before marking as orphaned - If agent PID is still running, re-sync to runner tracking instead of failing - Runner now emits completion events for dead agents so tasks can be retried - Delay runner cleanup by 3s to allow socket connections to establish first Fixes issue where agents were incorrectly marked as orphaned when servers restarted but the agent processes were still running.
Display estimated time to completion for pending tasks in the TasksTab based on historical learning data. The feature shows a timer icon with duration (e.g., "~5m") and a tooltip showing how many completed tasks the estimate is based on along with their success rate. - Fetch duration estimates from /api/cos/learning/durations on mount - Extract task type from description to match historical data - Fall back to overall average if no type-specific data available - Only show estimates for pending tasks (not completed ones)
- Add new extraction patterns for "No Issues Found", "already well-optimized", conclusion sections, and positive assessments - Store memory extraction results (created count, pending approval) in agent metadata - Display memory status with Brain icon on completed agents in AgentCard - Purple color for saved memories, yellow for pending, gray for none
Adaptive Task Learning: - Skip self-improvement task types with <30% success rate after 5+ attempts - Add cooldown multipliers based on historical success rates - Add /api/cos/learning/skipped endpoint to view underperforming tasks - Add /api/cos/learning/cooldown/:taskType for task-specific insights - Log learning-based recommendations when spawning agents Performance Optimizations: - Add 2-second cache to apps.js to reduce file reads during polling - Memoize AppTile component to prevent unnecessary re-renders - Use useCallback/useMemo in Apps.jsx and Dashboard.jsx - Memoize appStats calculation in Dashboard
- Add appsEvents EventEmitter to emit 'changed' events - Add notifyAppsChanged() to trigger events after start/stop/restart - Forward apps:changed events to all connected clients via socket.io - Update Apps.jsx and Dashboard.jsx to listen for socket events - Remove setInterval polling from both pages This eliminates the noisy GET /api/apps polling every 5-10 seconds. Apps now update instantly when state changes.
- PORTS.md: Update port 5558 from reserved to portos-cos (CoS Agent Runner) - CONTRIBUTING.md: Update API documentation link to point to docs/API.md
- Add vitest coverage configuration with v8 provider - Add test:coverage script to package.json - Add tests for lib/validation.js (41 tests) - Add tests for lib/errorHandler.js (13 tests) - Add tests for lib/vectorMath.js (46 tests) - Total test count now 396 (up from 296)
- Add task learning service to track success/failure patterns - Add adaptive cooldowns based on historical performance - Add new dependency-updates self-improvement task type - Integrate performance summary logging in task evaluation - Add runs source filtering API endpoint - Update DevTools with runner source filter
- Idle review tasks now include commit instructions - Test coverage self-improvement task includes commit step - Console errors task in selfImprovement.js includes commit step
- Full monorepo structure with client/, server/, and .github/ - React + Vite + Tailwind CSS client with collapsible sidebar - Express + Socket.IO server with health endpoint - GitHub Actions CI/CD (ci.yml and release.yml) - PM2 ecosystem config with proper ports convention - CLAUDE.md and README.md documentation
Generates comprehensive weekly summaries with task completion stats, success rates, week-over-week comparisons, and actionable insights.
- Add DigestTab component with live week progress, summary stats, insights, top accomplishments, task type breakdown, and error patterns - Shows week-over-week comparison with trend indicators - Supports viewing historical digests via dropdown selector - Collapsible sections for better information density - Add Calendar icon and digest tab to TABS constant - Export DigestTab from cos components index - Document M28: Weekly Digest UI milestone in PLAN.md
- Fix memory extraction regex to exclude colons, preventing truncated memories like 'Already has excellent responsive design:' - Add execution lock to prevent duplicate script runs within 5 seconds - Clear execution lock on script completion and error Fixes: - Truncated memories ending with ':' due to incomplete regex capture - Double script execution logging (02:59:59 and 03:00:00)
SECURITY ADVISORY: 1. server/services/agents.js - Fixed command injection in findUnixProcesses and findWindowsProcesses. The pattern parameter was previously interpolated directly into shell commands via grep/wmic. Added validatePattern() function that only allows alphanumeric, hyphens, and underscores. 2. server/routes/logs.js - Fixed command injection in GET /api/logs/:processName. The processName parameter was passed directly to pm2 logs without validation. Added validateProcessName() function to sanitize input. 3. server/routes/apps.js - Fixed arbitrary command execution in open-editor endpoint. The editorCommand field from app config was executed without validation. Added ALLOWED_EDITORS allowlist and shell metacharacter validation for arguments. All 396 tests pass.
- Change deduplication key from provider+runId to provider+model - This prevents multiple tasks from being created for the same provider/model combination when errors have different runIds The previous key (provider+runId) created duplicates because each error had a unique runId. The new key (provider+model) ensures only one task is created per unique provider/model combination within the 60-second deduplication window. Resolves issue where users saw multiple identical "Investigate AI provider failure" tasks and got "Task not found" errors when deleting.
- Create client/src/utils/fileUpload.js for shared screenshot upload logic - processScreenshotUploads(): handles file validation, reading, and upload - uploadScreenshotFile(): single file upload with error handling - Used by DevTools.jsx and TasksTab.jsx (was ~40 lines duplicated) - Extract processAgentCompletion() in subAgentSpawner.js - Consolidates memory extraction and app cooldown logic - Used by handleAgentCompletion() and spawnDirectly() - Reduces ~35 lines of duplicate code Total: 94 lines of duplicate code removed
- Store medium-confidence memories with pending_approval status instead of discarding - Add approve/reject endpoints for pending memories - Create notification service with real-time socket events - Add notification dropdown in header and sidebar badge - Add pending approval section in Memory Tab with approve/reject buttons - Notifications auto-remove when memories are approved/rejected
- Move notification icon from fixed top-right to sidebar footer - Add position prop to NotificationDropdown for flexible positioning - Dropdown opens upward from sidebar footer, downward from mobile header - Resolves overlay issue where notifications covered page content
- Update ecosystem.config.cjs to use flat PORTS object as single source of truth - Remove redundant `ports:` property from app configs, derive from env vars - Enhance streamingDetect.js parser to handle: - Flat PORTS objects (PORTS.API, PORTS.UI, etc.) - Nested PORTS objects (PORTS.server.api for backwards compat) - Variable references in env (PORT: PORTS.API) - Smart port labeling based on process name context - Update PORTS.md documentation with new recommended pattern
There was a problem hiding this comment.
Pull request overview
This is a major release (v0.7.14) focused on Chief of Staff (CoS) enhancements, security hardening, and new task management features. The PR introduces a pending memory approval system, weekly digest tracking, task learning with performance optimization, and comprehensive security fixes addressing command injection vulnerabilities across multiple services.
Key Changes:
- Security fixes for command injection in shell execution across 10+ files
- New task learning system to track and optimize agent performance
- Weekly digest system for CoS activity summaries
- Pending memory approval with user notifications
- Enhanced self-improvement capabilities with adaptive task selection
Reviewed changes
Copilot reviewed 83 out of 86 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| server/services/git.js | Migrated from exec to spawn to prevent shell injection |
| server/services/commands.js | Added shell metacharacter validation and allowlist enforcement |
| server/services/scriptRunner.js | Implemented command validation, duplicate execution prevention |
| server/services/agents.js | Added PID and pattern validation for process operations |
| server/services/weeklyDigest.js | New service for tracking weekly CoS activity and trends |
| server/services/taskLearning.js | New adaptive learning system for task performance tracking |
| server/services/notifications.js | New notification service for pending approvals |
| server/services/memoryExtractor.js | Enhanced memory extraction with approval workflow |
| server/services/memory.js | Added approve/reject endpoints for pending memories |
| server/services/cos.js | Major enhancements for self-improvement and proactive task generation |
| server/routes/*.js | Added new API endpoints for learning, digest, and notifications |
| server/vitest.config.js | New test configuration with coverage thresholds |
| *.test.js files | Comprehensive test coverage for routes and services |
Files not reviewed (1)
- server/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Remove unused imports across client and server files - Remove unused functions (generateAnalysisPrompt, createImprovementTask) from selfImprovement.js - Remove unused variables (pendingUserTasks, completedUserTasks) from TasksTab.jsx - Update API.md security documentation to clarify security model
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 83 out of 86 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- server/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…/ leak CI caught this after the rebase: the annotated-regen route stages its init-image snapshot under PATHS.imageRefs (ensureDir + write), and this suite never redirected PATHS away from the real install tree, so it wrote that snapshot into the developer's live data/image-refs on every run. It only looked green locally because that directory already existed from prior runs — ensureDir's create-path guard is a no-op against an existing dir, so the write went unnoticed until a fresh checkout (or a first-time directory) exposed it. This is the same class of leak #6176 already fixed in six other files; this one's #7. Also mocks lib/paths.js alongside lib/fileUtils.js: pathSafety.js's resolveGalleryImage/resolveImageRef/resolveImageInputPath read PATHS from paths.js directly, so the fileUtils.js redirect alone left the runner's own re-validation of the staged path checking against the real root.
Summary
This release includes significant enhancements to the Chief of Staff (CoS) system, security improvements, and new features for task management and system monitoring.
Major Features
Security Fixes
Improvements
Bug Fixes
Documentation
Test Plan
cd server && npm test)