- Change send() method parameter from BasicExecutionResult to CompilationResult
- Update messageQueue type to match actual usage
- Remove unnecessary filenameTransform property addition
- Both EventsWsSender and PersistentEventsSender now correctly typed
The send methods were receiving CompilationResult objects but typed as
BasicExecutionResult, causing type mismatches. This fixes the actual
usage to match the type signatures.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add optional s3Key property to CompilationResult interface
- Set s3Key = BaseCache.hash(key) in both compile() and cmake() functions
- Remove s3Key from API responses before sending to users
- Add size checking and logging for large results in compilation queue
- Update documentation with S3 storage integration details
This enables compilation workers to reference large results (>31KiB)
stored in S3 using the deterministic cache key hash, addressing
WebSocket disconnection issues with large compilation results.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Enhances both compilation and execution worker logging by including
the total processing time (from message receipt to result send) in
the WebSocket success logs. This provides better visibility into:
- End-to-end processing performance
- WebSocket delivery confirmation with timing context
- Debugging and monitoring capabilities for worker performance
Example logs:
- "Successfully sent compilation result for abc123 via WebSocket (total time: 1250ms)"
- "Successfully sent execution result for def456 via WebSocket (total time: 890ms)"
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Adds PersistentEventsSender class to maintain a single WebSocket connection
throughout the worker's lifetime, eliminating connection overhead for each
compilation result. Features include:
- Connection health monitoring with heartbeat (30s intervals)
- Automatic reconnection with exponential backoff (up to 5 attempts)
- Message buffering during connection interruptions
- Thread-safe operation for concurrent worker threads
- Graceful shutdown handling
This significantly reduces result delivery latency by avoiding WebSocket
handshake overhead for every compilation result.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Track the time messages spend in the SQS queue by retrieving the SentTimestamp
attribute and calculating the difference with current UTC time. This queue time
is now included as a queueTime property (in milliseconds) in all CompilationResult
objects for both successful and failed compilations.
Changes:
- Request SentTimestamp attribute when receiving SQS messages
- Calculate queue time from SentTimestamp to current time
- Add queueTime property to CompilationResult interface
- Include queue time in all compilation results (success/error cases)
- Handle queue time for both local and remote compilations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Workers now automatically detect and proxy requests to remote compilers
- HTTP requests are made to remote compiler endpoints with proper formatting
- Error handling ensures Lambda never waits endlessly via comprehensive WebSocket responses
- Timeout handling with 35-second abort controller for network issues
- Sentry error capture for worker thread exceptions
- Updated documentation to reflect remote compiler support
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit removes extensive debug logging that was added for troubleshooting
SQS compilation worker issues. The logging served its purpose in identifying
and fixing the compilation result transmission problems, but is now removed
to improve performance in production.
Changes:
- Removed verbose SQS message parsing debug logs
- Removed WebSocket transmission debug logs
- Removed compilation processing debug logs
- Kept essential error logging for troubleshooting
- Updated documentation to reflect shared parsing utilities
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added detailed logging to diagnose why compilation results aren't being sent
back via WebSocket:
- Log all stages of WebSocket sender creation and result transmission
- Check for both compilequeue.events_url and execqueue.events_url configuration
- Create custom property getter to use compilation-specific events URL
- Log result structure and WebSocket connection details
- Enhanced error reporting with full error details
This will help identify whether the issue is in WebSocket configuration,
connection, or result formatting.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Created shared parsing functions that both web handlers and SQS workers can use:
- Added compilation-request-parser.ts with utilities for parsing user arguments,
execution parameters, tools, and filters consistently
- Updated web handler parseRequest() to use shared utilities for final parsing steps
- SQS workers now use the same parsing logic as web handlers for consistency
- Ensures both code paths handle argument splitting, tool processing, and
parameter validation the same way
This provides the foundation for consistent compilation request handling across
different entry points (web API, SQS workers) while maintaining backward
compatibility with existing web handler logic.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixed the issue where SQS messages had incorrect parameter mapping by:
- Added convertSqsMessageToParsedRequest() function that properly maps SQS message
structure to the format expected by compile handlers
- Updated doOneCompilation() to use shared parsing logic instead of direct field mapping
- Fixed the parameter structure mismatch where msg.filters should be used for filters
instead of incorrectly passing msg.backendOptions, etc.
- Reused compilation handler patterns from lib/handlers/compile.ts for consistency
This ensures SQS workers use the same parameter structure as the web handlers,
preventing compilation failures due to incorrect option parsing.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Identified root cause: Lambda sends 'options' as object instead of string array.
Enhanced debugging to show more of the message content and added defensive fix:
- Increased message logging from 300 to 1000 chars (first) + 500 chars (last)
- Added comprehensive SQS polling debug info
- Added defensive conversion for options object to array
- Extract userArguments string and split into array if available
- Default to empty array if no valid options structure found
This allows compilation to proceed while Lambda can be fixed separately.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Enhance debug logging in SQS compilation queue to diagnose the issue where
SQS messages are being received as indexed character objects instead of
proper JSON objects. Added detailed logging at multiple levels:
- SQS message structure validation
- Raw message body analysis
- JSON parsing diagnostics
- Post-parse object validation
- Property access testing
This will help identify whether the issue is in SQS client configuration,
JSON parsing, or message corruption between parsing and usage.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add info-level logging to show full SQS message content when processing
compilation requests. This helps debug issues where message fields like
'options' might be undefined, causing compilation failures.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add WaitTimeSeconds=20 for SQS long polling (immediate message delivery, efficient empty queue handling)
- Change default poll_interval_ms from 50ms to 1000ms (only applies between messages/errors)
- Add error handling to ensure worker threads continue after failures
- Update comments to explain long polling behavior and performance characteristics
With long polling, response time is < 100ms when messages are available, and up to 20s when queue is empty, providing optimal balance of performance and cost efficiency.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add compilequeue.poll_interval_ms property (default: 50ms)
- Make SQS queue polling interval configurable instead of hardcoded 100ms
- Update documentation to include new configuration property
- Log polling interval on worker startup for debugging
This allows fine-tuning the polling frequency based on workload and latency requirements.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Changes:
- Remove queue producer code (SqsCompileRequester, RemoteCompilationEnvironment)
- Save producer code reference in compilation-queue-producer-reference.md
- Simplify to single SQS queue for both regular and CMake compilations
- Use isCMake flag in messages to distinguish compilation types
- Update worker to poll single queue and determine compilation type from message
- Remove cmake_queue_url configuration property
- Update documentation to reflect Lambda-based message production approach
The producer functionality will be implemented separately in Lambda functions.
Workers now only consume from queues and process compilation requests.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This adds a new worker mode for compilation tasks similar to the existing execution worker architecture:
- Add SQS-based compilation queue infrastructure for regular and CMake compilations
- Implement RemoteCompilationEnvironment for client-side queue interaction
- Add worker startup logic in main.ts to detect and initialize compilation workers
- Create proper message types and serialization for compilation requests
- Implement WebSocket-based result delivery using existing EventsWsSender
- Add configuration properties for compilation worker mode
- Include structured logging and basic metrics for worker operations
- Update documentation with worker mode configuration details
The implementation supports:
- Dual queue system (regular compilation + CMake compilation)
- Configurable number of worker threads per queue type
- Language-aware compiler discovery and execution
- Comprehensive error handling and logging
- Backward compatible with existing compilation API
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>