fix(advanced): warm the code interpreter before its first eval deadline (0.16 line) - #1102
Open
radu-mocanu wants to merge 2 commits into
Open
radu-mocanu wants to merge 2 commits into
radu-mocanu wants to merge 2 commits into
Conversation
quickjs_rs compiles its source transform WebAssembly module lazily, inside the first eval of the process, under the same per-call deadline as user code. On a CPU-starved instance the compile alone outlasts the deadline, so the first advanced run on a fresh process fails at its first model call with "interrupted" and a retry on the same process succeeds. Compile it when the graph is built instead, and expose an import-time warm-up module for hosts that preload modules at process start. Claude-Session: https://claude.ai/code/session_013CLJG6q56YoHrgNTgm3pA3 (cherry picked from commit 30f10ec)
There was a problem hiding this comment.
🔵 Needs a closer look
Startup initialization failures should be wrapped before approval.
Pull request overview
Pre-warms QuickJS WebAssembly modules before the first advanced-agent evaluation to prevent cold-start deadline failures.
Changes:
- Added cached interpreter warm-up and import-time preload support.
- Added warm-up and preload tests.
- Bumped the package version to 0.16.22.
File summaries
| File | Summary |
|---|---|
uv.lock |
Synchronizes the locked package version. |
tests/agent/advanced/test_code_interpreter.py |
Tests warm-up and preload behavior. |
src/uipath_langchain/agent/advanced/code_interpreter.py |
Implements cached WASM warm-up. Moderate finding (1 vote): wrap startup initialization failures as structured AgentStartupErrors. |
src/uipath_langchain/agent/advanced/code_interpreter_preload.py |
Provides import-time preloading. |
src/uipath_langchain/agent/advanced/__init__.py |
Exports the warm-up function. |
pyproject.toml |
Updates the package version. |
Review details
Suppressed comments (1)
src/uipath_langchain/agent/advanced/code_interpreter.py:257
- Because this now runs during agent/graph startup, a missing or corrupt
_transform.wasmcan maketransform_sourceraise a raw third-partyTransformError/RuntimeError(andRuntimecan likewise raiseQuickJSError). The agent startup paths use structuredAgentStartupErrors; please catch and chain these initialization failures so a low-level dependency exception does not escape to the host.
transform_source(
"warmup.js", "const x = 1;", flags=SourceTransform.TOP_LEVEL_CONST_TO_VAR
)
- Files reviewed: 5/6 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Why
quickjs_rs compiles its source transform module lazily inside the first eval, under the same 5 s deadline as user code. On a CPU-starved instance the compile alone exceeds the deadline, so the first advanced run on a fresh process fails at its first model call with
interrupted, and a retry on the same process succeeds. Cherry-pick of #1101, released as 0.16.22.https://claude.ai/code/session_013CLJG6q56YoHrgNTgm3pA3