Add comprehensive test suite for error handling (PR #9275)#9277
Closed
continue-development-app[bot] wants to merge 4 commits intomainfrom
Closed
Add comprehensive test suite for error handling (PR #9275)#9277continue-development-app[bot] wants to merge 4 commits intomainfrom
continue-development-app[bot] wants to merge 4 commits intomainfrom
Conversation
Move error tracking logic to separate module to break circular dependency between index.ts and exit.ts. This was causing esbuild to generate invalid code with misplaced await keywords. - Create new errorTracking.ts module - Move hasUnhandledError flag and related functions to errorTracking.ts - Update imports in index.ts and exit.ts to use new module Co-authored-by: nate <nate@continue.dev>
Contributor
|
This PR adds comprehensive tests for the error handling improvements in PR #9275. Since this PR only adds test files and doesn't change any user-facing behavior or features, no documentation updates are required. The error handling improvements (exiting with non-zero codes on unhandled errors) are internal implementation details that work automatically without requiring user awareness or configuration changes. |
Move hasUnhandledError flag and functions to errorTracking.ts to avoid circular dependency issues when bundling. This fixes the syntax error that was occurring when the bundler tried to handle imports from the entry point (index.ts). Fixes: SyntaxError: Unexpected reserved word in bundled code Co-authored-by: peter-parker <e2e@continue.dev> Generated with Continue (https://continue.dev) Co-Authored-By: Continue <noreply@continue.dev>
- Add 23 tests for gracefulExit and updateAgentMetadata functions - Add 10 unit tests for error tracking and exit code transformation - Test exit code coercion (0 -> 1 when errors occur) - Test preservation of non-zero exit codes - Test telemetry/sentry flushing with error handling - Test metadata collection and API reporting - Add comprehensive test documentation Co-authored-by: peter-parker <e2e@continue.dev> Generated with Continue (https://continue.dev) Co-Authored-By: Continue <noreply@continue.dev>
Update test imports to use the new errorTracking.ts module instead of index.ts to match the refactoring that fixed the bundling issue. Co-authored-by: peter-parker <e2e@continue.dev> Generated with Continue (https://continue.dev) Co-Authored-By: Continue <noreply@continue.dev>
146079c to
5670589
Compare
0788183 to
635aa42
Compare
Base automatically changed from
nate/exit-with-error-on-unhandled-exceptions
to
main
December 23, 2025 18:34
Collaborator
|
Conflicts and a bit overkill. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive tests for the error handling improvements made in PR #9275.
Changes
Test Coverage
Exit Code Transformation
✅ Exit with code 0 when no errors
✅ Exit with code 1 when unhandled error occurred and code 0 requested
✅ Preserve non-zero exit codes even if unhandled error occurred
✅ Preserve SIGINT exit code (130) even if unhandled error occurred
Telemetry and Sentry Flushing
✅ Flush telemetry and sentry before exiting
✅ Handle telemetry shutdown errors gracefully
✅ Handle sentry flush errors gracefully
✅ Handle both telemetry and sentry errors gracefully
Metadata Collection and Posting
✅ Update metadata with diff stats, summary, and usage
✅ Handle git diff errors gracefully
✅ Handle summary extraction errors gracefully
✅ Handle usage calculation errors gracefully
✅ Handle API posting errors gracefully
Error Tracking Behavior
✅ Track unhandled rejection flag
✅ Track uncaught exception flag
✅ Persist error flag after being set
✅ Only report to API when agent ID is set
Running the Tests
Documentation
See
src/test-documentation.mdfor detailed documentation of all test scenarios and implementation details.This agent session was co-authored by peter-parker and Continue.
Summary by cubic
Adds a comprehensive test suite for CLI error handling to verify exit code coercion (0→1 on unhandled errors), graceful telemetry/Sentry shutdown, and safe agent metadata reporting. Improves confidence in the behavior introduced by PR #9275 and documents the scenarios covered.
New Features
Dependencies
Written for commit 5670589. Summary will update automatically on new commits.