Skip to content

Conversation

@continue-development-app
Copy link

@continue-development-app continue-development-app bot commented Dec 23, 2025

Summary

This PR adds comprehensive tests for the error handling improvements made in PR #9275.

Changes

  • 23 tests for and functions in
  • 10 unit tests for error tracking and exit code transformation in
  • Test documentation explaining all test scenarios and implementation details

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

# Run all error handling tests
npm test -- exit.test.ts errorHandling.unit.test.ts

# All 33 tests pass

Documentation

See src/test-documentation.md for 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

    • Added 23 tests for gracefulExit and updateAgentMetadata.
    • Added 10 unit tests for error tracking and exit code transformation.
    • Added test documentation covering diff stats, summaries, usage, and failure paths.
  • Dependencies

    • Bumped @aws-sdk/client-bedrock-runtime and @aws-sdk/credential-providers to ^3.931.0 in extensions/cli.

Written for commit 5670589. Summary will update automatically on new commits.

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 <[email protected]>
@continue-development-app continue-development-app bot requested a review from a team as a code owner December 23, 2025 18:10
@continue-development-app continue-development-app bot requested review from sestinj and removed request for a team December 23, 2025 18:10
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Dec 23, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

@continue
Copy link
Contributor

continue bot commented Dec 23, 2025

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.

continue bot and others added 3 commits December 23, 2025 18:14
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 <[email protected]>
Generated with Continue (https://continue.dev)

Co-Authored-By: Continue <[email protected]>
- 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 <[email protected]>
Generated with Continue (https://continue.dev)

Co-Authored-By: Continue <[email protected]>
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 <[email protected]>
Generated with Continue (https://continue.dev)

Co-Authored-By: Continue <[email protected]>
@continue-development-app continue-development-app bot force-pushed the test-improvements-for-9275 branch from 146079c to 5670589 Compare December 23, 2025 18:15
@sestinj sestinj force-pushed the nate/exit-with-error-on-unhandled-exceptions branch from 0788183 to 635aa42 Compare December 23, 2025 18:20
Base automatically changed from nate/exit-with-error-on-unhandled-exceptions to main December 23, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

continue-agent size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant