Skip to content

fix(advanced): warm the code interpreter before its first eval deadline (0.16 line) - #1102

Open
radu-mocanu wants to merge 2 commits into
release/uipath-langchain-0.16.16from
hotfix/uipath-langchain-0.16.22
Open

radu-mocanu wants to merge 2 commits into
release/uipath-langchain-0.16.16from
hotfix/uipath-langchain-0.16.22

Conversation

@radu-mocanu

Copy link
Copy Markdown
Collaborator

Summary

  • compile the code interpreter's WebAssembly modules when the advanced agent graph is built, outside the per-eval deadline
  • add an import-time warm-up module that hosts preloading modules at process start can list

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

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)
Copilot AI lite review requested due to automatic review settings September 18, 2026 16:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 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.wasm can make transform_source raise a raw third-party TransformError/RuntimeError (and Runtime can likewise raise QuickJSError). The agent startup paths use structured AgentStartupErrors; 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.

@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants