Commit Graph
23 Commits
Author SHA1 Message Date
PartoufandClaude 303027ec0c Fix type signature for WebSocket send method to use CompilationResult
- 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>
2025-08-13 05:29:33 +02:00
PartoufandClaude 1e81e3d103 Add s3Key property to compilation results for large result S3 storage
- 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>
2025-08-13 05:23:03 +02:00
Partouf 4ea0613b43 fix parsing of sqs compile messages 2025-08-12 22:34:12 +02:00
partouf ac7d425f25 bugfix compiler execTime 2025-08-12 15:52:30 +02:00
partouf 423b92f8fb fix error message 2025-08-12 15:06:37 +02:00
PartoufandClaude 14eb75bab2 Add timing information to WebSocket success logging
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>
2025-08-08 01:53:38 +02:00
PartoufandClaude 5dc36a874b Implement persistent WebSocket connections for compilation workers
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>
2025-08-07 23:34:53 +02:00
Partouf ed87199480 update cp year 2025-08-07 16:50:25 +02:00
Partouf 6e1f0ace48 only handle local compilation 2025-08-07 16:28:15 +02:00
Partouf 00ff276698 readonly prop 2025-07-29 01:25:31 +02:00
PartoufandClaude e496502830 Add SQS queue time tracking to compilation results
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>
2025-07-29 01:22:25 +02:00
partoufandClaude 905301ad85 Add remote compiler support to compilation workers
- 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>
2025-07-21 23:43:40 +02:00
PartoufandClaude 561603a793 Remove debug logging from SQS compilation queue for performance
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>
2025-06-29 20:45:42 +02:00
PartoufandClaude a8cdd43cbe Add comprehensive WebSocket debugging for compilation results
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>
2025-06-29 19:37:50 +02:00
PartoufandClaude 66f565f89e Create shared compilation request parsing utilities
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>
2025-06-29 19:15:02 +02:00
PartoufandClaude 01070a8478 Fix SQS compilation message structure parsing
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>
2025-06-29 19:08:30 +02:00
PartoufandClaude 67760b231e Enhance SQS message logging and add defensive options parsing fix
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>
2025-06-29 18:26:34 +02:00
PartoufandClaude bbe1ae5f5c Add comprehensive SQS message debugging to diagnose parsing issue
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>
2025-06-29 18:04:36 +02:00
PartoufandClaude 3471d4db2d Add debug logging for SQS compilation queue messages
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>
2025-06-29 17:13:18 +02:00
partoufandClaude c95ccb1bb4 Optimize SQS polling with long polling and configurable intervals
- 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>
2025-06-26 17:51:56 +01:00
partoufandClaude 00b91bbe54 Add configurable polling interval for compilation workers
- 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>
2025-06-26 10:18:48 +01:00
partoufandClaude 1f3127f51d Refactor compilation workers to use single queue and remove producer code
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>
2025-06-24 22:10:57 +01:00
partoufandClaude 05b0af5c74 Add compilation worker mode infrastructure
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>
2025-06-24 20:05:05 +01:00