Skip to content

fix: log expected variant-connection failures at debug, not error - #10

Merged
jleni merged 1 commit into
mainfrom
fix/kunobi-mcp-expected-absence-log-level
Jun 22, 2026
Merged

fix: log expected variant-connection failures at debug, not error#10
jleni merged 1 commit into
mainfrom
fix/kunobi-mcp-expected-absence-log-level

Conversation

@jleni

@jleni jleni commented Jun 22, 2026

Copy link
Copy Markdown
Member

Problem

The hub's logger forwarded every bundler error straight to the MCP client. @kunobi/mcp-bundler logs Transport error / Connection failed at error level when a variant port is closed — i.e. when the Kunobi app simply isn't running.

That's normal operation for this hub: it retries forever and already reports an absent variant as not_running (VariantManager.getStates). But the error reached every client (codex, Claude, etc.) looking like something broke when nothing did. Observed as repeated MCP server log message (level: Error, logger: "kunobi-mcp", data: "[legacy] Transport error") lines on a successful run.

Fix

  • src/logging.ts (new) — classifyBundlerLog(level, message) maps bundler logs to the MCP level, downgrading connection-establishment failures (Transport error, Connection failed) from errordebug.
  • Genuine errors from a connected variant (Failed to list tools, Tool call failed, Resource read failed, …) still surface at error.
  • src/server.ts — logger uses classifyBundlerLog instead of the inline error || warn passthrough.
  • Connection state stays fully observable via the kunobi://status resource and kunobi_status tool — only the misleading error-level spam is gone. debug keeps it available when actually debugging, without firing every ~5s while the app is closed.

Tests

  • src/__tests__/logging.test.ts (new) — 4 cases pinning the behavior.
  • Full suite: 94/94 pass; typecheck clean; biome clean; build succeeds.

The hub forwarded every bundler `error` straight to the MCP client. The
mcp-bundler logs `Transport error` / `Connection failed` at error level when a
variant port is closed — i.e. when the Kunobi app simply isn't running. That is
normal operation for this hub (it retries forever and already reports absent
variants as `not_running`), but it reached every client looking like a failure.

Add `classifyBundlerLog` (src/logging.ts) to downgrade those
connection-establishment failures from error to debug. Genuine errors from a
connected variant (Failed to list tools, Tool call failed, ...) still surface at
error. Connection state stays observable via kunobi://status and kunobi_status.
@jleni
jleni merged commit 98b25c7 into main Jun 22, 2026
2 checks passed
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