Skip to content

Fix Node adapter edge cases found in review - #355

Merged
dipeshbabu merged 1 commit into
mainfrom
fix/node-runner-edges
Nov 19, 2026
Merged

dipeshbabu merged 1 commit into
mainfrom
fix/node-runner-edges

Conversation

@dipeshbabu

Copy link
Copy Markdown
Owner

Review and probing of the unreleased Node.js guided setup (#353) found three bugs:

  1. Path escape: `--agent ../outside.mjs:answer` was accepted although the module must be inside the project (only later `..` segments were rejected). Any `..` segment is now rejected.
  2. Missing npm package: the generated runner imported `agentloop-profiler` at module load, so a project without it crashed with a raw `ERR_MODULE_NOT_FOUND` stack trace (exit 1) before `--check` could report anything. The SDK is now imported inside `main()`; the runner exits 2 with `Run npm install agentloop-profiler in this project.`
  3. Unawaited traced call: an agent returning while `trace.tool(...)` was still running crashed the runner with the SDK error and wrote no trace. It now exits 1 explaining to await every `trace.tool/model` call.

Also: `init` for an existing Node project prints `npm install agentloop-profiler, then node agentloop_runner.mjs --check`.

Probed by hand: missing SDK, `undefined`/NaN/function outputs, thrown strings, bad stdin, unawaited spans. Tests: unit cases for `../` paths and the CLI hint; the CI Node smoke now checks the missing-SDK and unawaited-span messages. Locally: 30 init tests and the Node smoke pass.

🤖 Generated with Claude Code

- --agent ../outside.mjs:answer was accepted although the module must be
  inside the project; any .. segment is now rejected.
- The runner imported agentloop-profiler at module load, so a missing
  package crashed with a raw Node stack trace (exit 1) before --check
  could report it. It now loads the SDK inside main and exits 2 with
  the npm install command.
- An agent returning before a traced call finished crashed the runner
  with no trace; it now explains to await trace.tool/model calls.
- init for an existing Node project reminds users to install the npm
  package before --check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 19, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

Copy link
Copy Markdown

AgentLoop replay self-test

This required repository check evaluates generated synthetic demo traces. It tests the replay and CI machinery; it does not show that this PR improves application performance.

AgentLoop CI Report

  • Status: passed
  • Replay: Replay passed: latency improvement 69.68%, cost improvement 78.82%, retry delta -1.
  • Merge recommendation: synthetic self-test only; assess application traces before merge
  • Findings: 1 total, 0 high severity, 1 patchable

Performance Gates

Gate Status Detail
latency_regression pass 0.00% regression <= 0.00% allowed
cost_regression pass 0.00% regression <= 0.00% allowed
latency_improvement pass 69.68% improvement >= 20.00% required
cost_improvement pass 78.82% improvement >= 5.00% required
retry_non_increase pass 0 candidate retries <= 1 baseline retries

Trace inputs

This comparison includes synthetic data. It does not establish application performance gains from a pull request.

Side Run ID Path Synthetic marker Source
baseline run_c3da6fbf6e43451d runs/research_agent_baseline.json yes agentloop_demo
candidate run_13b1a1b71bb14185 runs/research_agent_optimized.json yes agentloop_demo

Metric Impact

Metric Impact
Latency improvement 69.68%
Cost improvement 78.82%
Retry delta -1
Candidate schema validity not provided
Candidate quality score not provided

Top Findings

Finding Severity Type Rewrite
al_cache_context_83c9e5c4fe04: Cache repeated prompt/context prefix medium cache_context Move stable instructions into cached prefixes, summaries, or framework-level memory instead of resending full text.

@dipeshbabu
dipeshbabu merged commit f68edb0 into main Nov 19, 2026
25 checks passed
@dipeshbabu
dipeshbabu deleted the fix/node-runner-edges branch November 19, 2026 07:27
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.

1 participant