fix: log expected variant-connection failures at debug, not error - #10
Merged
Conversation
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.
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.
Problem
The hub's logger forwarded every bundler
errorstraight to the MCP client.@kunobi/mcp-bundlerlogsTransport error/Connection failedaterrorlevel 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 repeatedMCP 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) fromerror→debug.Failed to list tools,Tool call failed,Resource read failed, …) still surface aterror.src/server.ts— logger usesclassifyBundlerLoginstead of the inlineerror || warnpassthrough.kunobi://statusresource andkunobi_statustool — only the misleading error-level spam is gone.debugkeeps 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.