Repository navigation
Fix Go/JS regex compatibility issues in engine error patterns (Go-only solution) - #1091
Conversation
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
| * @returns {boolean} | ||
| */ | ||
| function validateErrors(logContent, patterns) { | ||
| const { createJSRegexFromGoPattern } = require("./regex_compatibility.cjs"); |
There was a problem hiding this comment.
@copilot Inline this function in this file. no requires allowed
There was a problem hiding this comment.
Done! I've inlined the createJSRegexFromGoPattern and convertGoPatternToJS functions directly in the validate_errors.cjs file and removed the require() statement. The functionality remains the same and has been tested to work correctly with both case-insensitive patterns and error detection. Commit: 9e24268
|
@copilot update Go compiler to convert Go regex syntax to JavaScript syntax when creating the pattern env var |
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Done! I've updated the Go compiler to convert Go regex syntax to JavaScript syntax when creating the GITHUB_AW_ERROR_PATTERNS environment variable. The conversion now happens at compile time rather than runtime: Changes made:
This eliminates runtime conversion overhead and provides better error handling during compilation. Commit: 517feed |
|
@copilot revert all changes to JavaScript .cjs files, recompile |
…conversion Co-authored-by: pelikhan <[email protected]>
Done! I've reverted all JavaScript .cjs files to their original state and successfully recompiled all workflows: Changes made:
The solution now works with zero JavaScript modifications - the Go compiler handles all pattern conversion at compile time. Commit: 0e00c32 |
|
@copilot merge main, format, lint, fix tests |
Co-authored-by: pelikhan <[email protected]>
Done! I've completed all requested tasks: ✅ Merged main: Integrated latest changes from main branch Test Results:
Test Fix Details: All quality checks now pass successfully. Commit: 8f75ab8 |
Complete Go/JS Regex Compatibility Implementation ✅
🎯 Problem Solved
Fixed compatibility issues between Go and JavaScript regex patterns used by agentic engines. The core issue was that Go's
(?i)inline case-insensitive flag is not supported in JavaScript, causing validation failures.✅ Final Implementation Status
Core Features Completed:
Pattern Compatibility Verified:
Quality Assurance Complete:
gofmt✅🔧 Technical Implementation
Go Compiler-Only Solution:
The Go compiler now converts regex patterns before creating the
GITHUB_AW_ERROR_PATTERNSenvironment variable:JavaScript Runtime (Original, Unchanged):
Latest Updates:
core.error()logging. Updated test to match actual behavior.Key Architectural Decision:
Files Modified:
pkg/workflow/compiler.go- Added compile-time Go-to-JS pattern conversionpkg/workflow/engine_error_patterns_test.go- Go pattern validation testspkg/workflow/js/validate_errors.test.cjs- Fixed test expectation to match graceful error handling🎉 Impact
Error patterns from agentic engines now work consistently in both Go (compilation/validation) and JavaScript (runtime error detection) environments. The solution requires zero JavaScript changes while providing complete compatibility through Go compiler preprocessing.
Quality Metrics: ✅ All code formatted, linted, and tested successfully
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.