GeezerVison is showing github.com — mcpx: Bun runtime fidelity for captureFrames FunctionName and console formatting (stdout purity constraint) · Issue #8350 · developing-today/code
mcpx: Bun runtime fidelity for captureFrames FunctionName and console formatting (stdout purity constraint) #8350DescriptionProblem
mcpx's emitted runtime shim (pkgs/mcpx/internal/codegen/emit.go) has a Bun fidelity gap, surfaced by stranded PR #7145 (closed 2026-11-10 under task 14681 rather than merged):
- captureFrames: under Bun, CallSite.getFunctionName() can return nothing for frames that Node/Deno name; current main only tries getFunctionName (emit.go). PR fix(mcpx): handle missing FunctionName in Bun CallSite and match console strings to runtime #7145 tried getMethodName / getFunction / getTypeName fallbacks.
- captureConsole: runtime-native formatting differs under Bun; console strings should match the runtime's own formatting.
Hard constraint (why PR #7145 was not merged)
Stdout is the script's result stream. Any Bun console handling must keep diagnostics on the structured record path — PR #7145's approach of invoking the original console methods for info/debug/dir/table writes diagnostics to stdout, corrupting results (Codex P1 on PR #7145, comment 4505048960, verified with Bun 1.2.14). Its test changes also weakened TestCaptureFramesIsAvailableToScripts to accept an empty top function name under Bun instead of fixing the naming.
Acceptance
- captureFrames names the caller under Bun without weakening the existing e2e assertion, or a documented, narrowly-scoped Bun exception with evidence.
- Console records under Bun match runtime formatting while diagnostics never reach stdout.
- pkgs/mcpx e2e tests pass for the Bun runtime path.
Refs: PR #7145 (closed, diff preserved), task 14681, batch issue #7297. Activitydeveloping-today commented on Nov 10, 2026 dezren39 commented on Nov 17, 2026 🤖 Agent note · triaged
- Agent: queue worker (repo-worker-code), lane any-h
- Session / ID: task 18641
- Found via: queue claim
- Verdict: real and current. Labels decided: kind/bug, priority/normal, effort/m, task/small-fix (the routed packet's kind; added this triage — app/mcpx, epic/mcpx-platform already present).
- Fresh evidence (2026-11-17): on current main, pkgs/mcpx/internal/codegen/emit.go's captureFrames still only tries CallSite.getFunctionName() (:928, :960) — no getMethodName/getFunction/getTypeName fallback — so the Bun naming gap is live, and captureConsole (:1180) has no Bun formatting parity work.
- Routing: enqueued as task 20128 (small_fix, repo-health-code-pilot) with the issue's hard constraint baked into the packet as an exclusion: stdout is the result stream, diagnostics stay on the structured emitRecord path, the original console methods are never invoked for info/debug/dir/table (the Codex P1 that closed PR fix(mcpx): handle missing FunctionName in Bun CallSite and match console strings to runtime #7145, comment 4505048960), and TestCaptureFramesIsAvailableToScripts must pass unweakened. PR fix(mcpx): handle missing FunctionName in Bun CallSite and match console strings to runtime #7145's preserved diff is the starting reference for the frame-naming chain only.
- Acceptance for the follow-on: Bun e2e green at full assertion strength; a diagnostics-emitting script under Bun leaves stdout as a clean result stream.
dezren39 commented on Nov 17, 2026
🤖 Agent note · done — task 20128 fixed and merged in PR #11238
- Agent: queue worker (repo-worker-code), lane any-a
- PR: fix(mcpx): Bun fidelity for captureFrames naming and console formatting (#8350) #11238 — MERGED, merge commit 2539312
- Root causes (reproduced fresh on Bun 1.4.2 before fixing): (1) Bun's V8 CallSite shim returns a single collapsed, unnamed frame for stacks its default stack string names correctly — the
getMethodName/getFunction getters PR fix(mcpx): handle missing FunctionName in Bun CallSite and match console strings to runtime #7145 chained are equally empty there; (2) captureConsole took the Deno inspect branch under Bun because Bun exposes a Deno compatibility global, so console records rendered in Deno's format, not Bun's.
- Fix (emit.go only): frame naming tries getFunctionName → getMethodName → getFunction()?.name in captureFrames and errorFrames; under Bun, a nameless CallSite result falls back to parsing the runtime's default stack string; captureConsole now checks Bun.inspect before Deno and renders at
{ depth: 2 }, byte-identical to native Bun console output (including the [Object ...] collapse). Stdout purity untouched — diagnostics stay on the structured emitRecord path; no original console method is invoked (the Codex P1 that closed PR fix(mcpx): handle missing FunctionName in Bun CallSite and match console strings to runtime #7145).
- Documented Bun exception (per this issue's acceptance): JavaScriptCore inlines trivial wrapper functions; an inlined frame exists in no stack representation on any runtime (probes recorded in the PR). TestCaptureFramesIsAvailableToScripts is not weakened — its one-liner assertion stays on the default runtime — and the new
TestBunCaptureFramesAndConsoleMatchTheRuntime e2e covers the Bun path at full assertion strength with a non-inlinable caller.
- Verification: new Bun e2e PASS;
go test -count=1 ./internal/codegen/ ok; go vet + gofmt clean; manual Bun smokes matched native output. The e2e package's mcpx testing: guard tests that close a whole bug class #1971 leaked-daemon sweep fails on the (heavily loaded) worker laptop even on pristine main — reproduced on main, environmental; the tests themselves pass.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|