Repository navigation
fix(node): isolate throwing codec callbacks - #1529
Conversation
- add JsCodecCallback and build NapiCodec and NapiResponseCodec from it in crates/node/src/callable.rs - remove recv_llm_request_result from crates/node/src/callable.rs - rewire node_llm_codec and node_llm_response_codec and extend the llmCall docstring in crates/node/src/api/mod.rs - add codec callback failure tests to crates/node/tests/llm_tests.mjs Signed-off-by: Greyson Lalonde <[email protected]>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Shared callback dispatch crates/node/src/callable.rs |
A shared callback wrapper handles direct and threadsafe JavaScript calls, argument serialization, result deserialization, and callback errors. Request and response codec adapters use the wrapper. |
Codec wiring and failure behavior crates/node/src/api/mod.rs, crates/node/tests/llm_tests.mjs |
Node LLM codec setup constructs and retains callback wrappers. Tests cover decode and encode failures, callback error recording, emitted events, and request or provider-result behavior. The llm_call documentation describes decode failures and invalid values. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Merge Risk: 
Minimal · up to d0a44
-
Unsupported codec callback results are handled as errors rather than terminating Node. No actionable merge-blocking risk remains after normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Description check
-
Explanation
The pull request description follows the repository template. It includes the overview, completed contribution checks, implementation details, reviewer guidance, and a related issue using the required Fixes keyword.
-
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
willkill07
left a comment
There was a problem hiding this comment.
love the structural cleanup here
Overview
A JavaScript codec callback may throw while Relay processes an LLM event. In some cases, this error stops the Node.js process instead of returning a normal error. This change isolates codec callback failures.
Details
JsCodecCallbackand buildNapiCodecandNapiResponseCodecfrom it incrates/node/src/callable.rsrecv_llm_request_resultfromcrates/node/src/callable.rsnode_llm_codecandnode_llm_response_codecand extend thellmCalldocstring incrates/node/src/api/mod.rscrates/node/tests/llm_tests.mjsWhere should the reviewer start?
Start with
JsCodecCallback::new,JsCodecCallback::call, andJsCodecCallback::invokeincrates/node/src/callable.rs. These methods handle callback execution, result validation, and error reporting.Next, review the
NapiCodecandNapiResponseCodecimplementations in the same file.Then review
node_llm_codecandnode_llm_response_codecincrates/node/src/api/mod.rs.Finally, review the
LLM codec callback failurestests incrates/node/tests/llm_tests.mjs.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit