Repository navigation
V42: Keep lousho build working without the optional OTel packages - #700
Merged
Merged
Conversation
The deploy runtime statically imported the OTel exporter module, so a node-server build of a project without @opentelemetry/api (every scaffold) failed with 'Could not resolve'. The exporter is now imported lazily, and the node-server build turns an unresolvable @opentelemetry/api into a runtime require that only runs when OTEL_EXPORTER_OTLP_ENDPOINT is set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LinuxDevil
force-pushed
the
v42-otel-optional-build
branch
from
October 20, 2026 11:21
270c03a to
c42cdc5
Compare
On Linux the killed server logs its SIGTERM line before it exits; the helper probed /health again on that output and the late failure replaced the 200. Probe once, settle once, read the port from the whole line, and put the server's output in any failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes audit finding V42 (Vercel competitor audit, 2026-10-19). Regression from #695.
What was wrong
Since #695 the deploy runtime re-exports
otelTracing.ts, which statically importedsrc/execution/otel.tsand with it@opentelemetry/api, an optional peer a scaffolded project does not install (aikeeps its own copy nested undernode_modules/ai). Sonpm run buildin a fresh create-lousho-agent project failed:Could not resolve "@opentelemetry/api"/LOUSHO_DEPLOY_FAILED. CI missed it because the repo has the package as a devDependency and the e2e template test never rannpm run build.What changed
src/deploy/otelTracing.ts: the OTel exporter module is imported lazily insideotelTracingFromEnv(), only onceOTEL_EXPORTER_OTLP_ENDPOINT(or..._TRACES_ENDPOINT) is set.@opentelemetry/apijoins the list of packages the "install these" message names.src/deploy/bundle.ts: newruntimePeerPlugin()for node-server/docker builds. When the build can resolve@opentelemetry/api, it bundles it as before. When it can't, the import becomes arequire()that runs only when the exporter loads. The build succeeds, the server starts, and packages installed next todist/server.jslater still work.src/deploy/adapters/node-server.ts(outside the ticket's file list, one line): registers the plugin.docs/observability.md: the install line includes@opentelemetry/api(llms.txt regenerated).Tests
src/deploy/runtimePeer.test.tsbundlesotelTracing.tswith esbuild while@opentelemetry/apiis hidden from the SDK source, as in a scaffold, then loads the output from a temp dir:otelTracingFromEnv()returnsundefinedand logsnpm install @opentelemetry/api ....Cannot find module '@opentelemetry/api'. Without the plugin, the build fails with "Could not resolve".packages/create-lousho-agent/src/template.e2e.test.tsnow runsnpm run buildin the generated project, startsdist/server.jsand expectsGET /healthto return 200 (openai + openrouter). Both cases pass locally.otelTracing.test.tsmessage assertions are updated.node-server-otel.test.tsandnode-server-externals.test.tsstill pass.npx tsc --noEmit,npm run typecheck:testsandnpm run lintpass.npm run test:coveragepasses (414 files).npm run fallowexits 0.npm run api:checkis up to date.src/tools/mcp/connect.test.tsfailed on timing under load. It passed on its own and on the full re-run.Manual check: packed the SDK (
npm pack --ignore-scripts), then rannode packages/create-lousho-agent/bin/cli.js app --yes --no-git --provider openrouter --template tools --package-manager npm --sdk-path <tgz>in a temp dir (nonode_modules/@opentelemetryin the project):Starting the built server with
OTEL_EXPORTER_OTLP_ENDPOINTset (GET /health -> 200):After running that
npm installnext todist/server.js(no rebuild):Changelog: Fixed
lousho build --target=node-server|dockerfailing with "Could not resolve @opentelemetry/api" in projects without the optional OTel packages, including every create-lousho-agent scaffold (regression in the previous release's OTel trace export).🤖 Generated with Claude Code