feat(bcode-laminar): wire LMNR_PARENT_SPAN_CONTEXT env (re-land plugin on main)#39
Merged
Alezander9 merged 2 commits intomainfrom May 6, 2026
Merged
Conversation
added 2 commits
May 6, 2026 16:12
Re-applies PR #33 onto current main. The original PR was merged into the feat/embed-lmnr-key feature branch (and shipped as v0.0.8/v0.0.9), but the feature branch was never re-merged into main, so the package was lost when subsequent harness/upstream syncs landed directly on main. Identical contents to v0.0.9: 13 files in packages/bcode-laminar/ vendored from lmnr-ai/lmnr-opencode-plugin@bb2fceaff and lmnr-ai/lmnr-ts@5ebe07a6, plus the first-run telemetry notice in bcode-browser/src/telemetry.ts and the one-line LaminarPlugin registration in INTERNAL_PLUGINS. Filtered turbo typecheck 6/6 passes.
…Span When LMNR_PARENT_SPAN_CONTEXT is set in the process env, every 'turn' span the plugin opens is parented under the given Laminar span context (via the parentSpanContext arg startTurnSpan already accepts). Used by external evaluation harnesses that spawn bcode as a subprocess and want the agent's traces to nest under their own evaluation span — one trace per task, judge + agent siblings — instead of producing a separate root trace per bcode process. Format is the JSON serialization of a LaminarSpanContext (the lmnr Python SDK exposes Laminar.serialize_span_context() which returns exactly this shape; the JS-side parseLaminarSpanContext in span.ts already accepts snake_case and camelCase keys). Default behavior (env unset) is unchanged: bcode opens a fresh root turn span per chat.message event as before. Read once at plugin init via closure; one process is one parent for our intended use case (eval harness spawns bcode per task).
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
Two commits, in order:
Re-land
packages/bcode-laminar/onmain. The original PR (feat: vendored Laminar OpenCode plugin (@browser-use/bcode-laminar) #33) was merged into thefeat/embed-lmnr-keyfeature branch, notmain. v0.0.8 / v0.0.9 were tagged from the feature branch. Subsequent harness/upstream syncs landed directly onmain, leaving the laminar package absent from the canonical history. This commit reapplies the package contents verbatim fromv0.0.9plus the small companion changes (rootpackage.jsontypecheck filter,packages/opencode/package.jsonworkspace dep,packages/opencode/src/plugin/index.tsINTERNAL_PLUGINSentry,packages/bcode-browser/src/telemetry.tsfirst-run notice).LMNR_PARENT_SPAN_CONTEXTenv hook. When the env var is set, everyturnspan the plugin opens is parented under the given Laminar span context. This is for our internal evaluation harness — it spawnsbcodeas a subprocess and wants the agent traces to nest under itsEVALUATIONspan so judge + agent appear as siblings on one trace per task instead of producing a fresh root trace perbcodeprocess.startTurnSpan({ ..., parentSpanContext }).span.tsalready accepts this argument and parses it viaparseLaminarSpanContext.LaminarSpanContext. ThelmnrPython SDK exposesLaminar.serialize_span_context()which returns exactly this shape; the parser already accepts bothsnake_caseandcamelCase.Verification
@browser-use/{bcode-browser,bcode-laminar,browsercode-core}+@opencode-ai/{core,plugin,sdk}).v0.0.9's tree underpackages/bcode-laminar/.bun installregeneratedbun.lockwith only the new workspace dep additions.Use from the Python eval side
Notes on the re-land
I considered cherry-picking
58cc2fdc1andf5f70c109but the conflicts onpackages/opencode/src/plugin/index.ts(theWorkspaceAdaptor->WorkspaceAdapterrename and theServerAuth.headers()refactor onmain) made a verbatim re-checkout fromv0.0.9plus a freshINTERNAL_PLUGINSinsertion cleaner than resolving cherry-pick conflicts. Thepackages/bcode-laminar/package itself, the telemetry-notice block, and the workspace deps are all taken verbatim fromv0.0.9.Once this merges, cut
v0.0.10frommain. The eval-side PR (benchmark-x-laminar) can then bump to it and injectLMNR_PARENT_SPAN_CONTEXTfromLaminar.serialize_span_context()inside the@observewrapper.