Skip to content

Conversation

Copy link

Copilot AI commented Jan 11, 2026

During development with HMR tooling (Vite, etc.), PostMessageTransport logs console.error for every benign message from dev servers and browser extensions, obscuring actual errors.

Changes:

  • Changed console.error to console.debug in PostMessageTransport when ignoring messages from unknown sources (line 80)
  • Maintains identical security behavior (still ignores unknown sources)
  • Parsing failures remain at console.error level (line 88)
// Before: noisy during development
if (eventSource && event.source !== this.eventSource) {
  console.error("Ignoring message from unknown source", event);
  return;
}

// After: hidden by default, available when debugging
if (eventSource && event.source !== this.eventSource) {
  console.debug("Ignoring message from unknown source", event);
  return;
}
Original prompt

This section details on the original issue you should resolve

<issue_title>PostMessageTransport logs noisy console.error for expected unknown sources during development</issue_title>
<issue_description>When using AppBridge with Vite dev server (or similar HMR tooling), the console is filled with error logs:

Ignoring message from unknown source MessageEvent {isTrusted: true, data: {…}, origin: 'http://localhost:8081', ...}

This comes from src/message-transport.ts:80:

console.error("Ignoring message from unknown source", event);

Cause

This is a dev-only issue. During development:

  • Vite sends HMR (hot module reload) messages to all windows
  • Browser extensions may also send messages
  • AppBridge's PostMessageTransport receives these and logs errors

In production builds without dev servers, this noise doesn't occur.

Problem

Using console.error for expected/benign dev-time events creates noise that obscures real errors during development - exactly when clear console output matters most.

Suggested Fix

Change to console.debug so it's hidden by default but still available when needed:

console.debug("Ignoring message from unknown source", event);

Alternatively, filter known noise sources (e.g., messages containing vite or hot-update in the data).


🦉 Drafted with Claude Code and reviewed by @olaservo</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: liady <7003853+liady@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix noisy console.error logs in PostMessageTransport Change unknown source message log from error to debug level Jan 11, 2026
Copilot AI requested a review from liady January 11, 2026 22:14
@liady liady changed the title Change unknown source message log from error to debug level fix: change unknown source message log from error to debug level Jan 11, 2026
@liady liady marked this pull request as ready for review January 11, 2026 22:24
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 12, 2026

Open in StackBlitz

@modelcontextprotocol/ext-apps

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/ext-apps@239

@modelcontextprotocol/server-basic-react

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-basic-react@239

@modelcontextprotocol/server-basic-vanillajs

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-basic-vanillajs@239

@modelcontextprotocol/server-budget-allocator

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-budget-allocator@239

@modelcontextprotocol/server-cohort-heatmap

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-cohort-heatmap@239

@modelcontextprotocol/server-customer-segmentation

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-customer-segmentation@239

@modelcontextprotocol/server-scenario-modeler

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-scenario-modeler@239

@modelcontextprotocol/server-system-monitor

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-system-monitor@239

@modelcontextprotocol/server-threejs

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-threejs@239

@modelcontextprotocol/server-wiki-explorer

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-wiki-explorer@239

commit: 4f1ba25

Copy link
Collaborator

@antonpk1 antonpk1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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.

PostMessageTransport logs noisy console.error for expected unknown sources during development

3 participants