Skip to content

fix: resolve PID validation, stack trace handling, and queue overflow…#121

Open
Sana9058 wants to merge 2 commits intoaccordproject:mainfrom
Sana9058:fix/javascript-evaluator-bugs-clean
Open

fix: resolve PID validation, stack trace handling, and queue overflow…#121
Sana9058 wants to merge 2 commits intoaccordproject:mainfrom
Sana9058:fix/javascript-evaluator-bugs-clean

Conversation

@Sana9058
Copy link
Copy Markdown
Contributor

This PR addresses the issues reported in #109 related to the JavaScriptEvaluator.

Summary of Fixes:

  1. Fixed incorrect PID validation
    Updated the PID validation logic to ensure valid processes are not rejected due to falsy values such as 0.

  2. Improved stack trace handling
    Ensured that error stack traces are preserved instead of being swallowed, making debugging easier.

  3. Prevented queue overflow race condition
    Added proper queue length validation to prevent exceeding maxQueueDepth during concurrent operations.

Motivation:

These fixes improve the reliability and debugging clarity of the JavaScriptEvaluator by ensuring correct process validation, better error reporting, and safer queue management.

Notes:

  • No breaking changes introduced
  • Existing behavior preserved while improving stability
  • Implemented based on the issue description

Please let me know if any changes or restructuring are required.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates JavaScriptEvaluator to improve error reporting and process validation, aligning with issues raised in #109.

Changes:

  • Preserve stack traces when evalDangerously() rejects, and log errors to stderr (console.error).
  • Fix child process PID validation to avoid rejecting valid (falsy) PIDs.
  • Include stack traces when rejecting from child process error events.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/JavaScriptEvaluator.ts Outdated
Comment thread src/JavaScriptEvaluator.ts Outdated
Comment thread src/JavaScriptEvaluator.ts Outdated
Comment thread src/JavaScriptEvaluator.ts
@Sana9058 Sana9058 requested a review from a team April 15, 2026 14:27
@Sana9058 Sana9058 force-pushed the fix/javascript-evaluator-bugs-clean branch from 6453da6 to 47035a0 Compare April 15, 2026 14:35
@Sana9058
Copy link
Copy Markdown
Contributor Author

@mttrbrts Addressed review feedback:

  • Added stack support to EvalResponse
  • Improved error handling using instanceof checks
  • Fixed queue overflow handling with early return
  • Ensured DCO compliance

All checks are now passing. Please let me know if further changes are needed.

@mttrbrts
Copy link
Copy Markdown
Member

Thanks for this contribution! This appears to be a duplicate of #110 by @Swastik-Prakash1, which was opened earlier and addresses the same issue (#109).

@Sana9058 — would you mind helping review #110? Your input would be valuable since you've worked on the same fix.


This comment was generated by AI on behalf of @mttrbrts.

@Sana9058
Copy link
Copy Markdown
Contributor Author

@mttrbrts Thank you for the clarification! Sure, I’d be happy to help review #110. Since I worked on a similar fix, I’ll go through it carefully and share my observations.
Thanks for pointing me to it.

@Swastik-Prakash1
Copy link
Copy Markdown

@mttrbrts Thank you for the clarification! Sure, I’d be happy to help review #110. Since I worked on a similar fix, I’ll go through it carefully and share my observations. Thanks for pointing me to it.

Yeah let me know too.. If u find anything interesting that can be worked on...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants