PostMessageTransport: make debug logging opt-in (or accept a logger)
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 70/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
この issue は src/message-transport.ts を指しており、特に console.debug が呼び出されている行を対象としています。まず、PostMessageTransport コンストラクタとその現在のシグネチャを調べてください。タスクは、ロガー用のオプションの第3引数を追加し、デフォルトではロギングを行わないようにすることです。コードベースの他の場所でトランスポートがどのようにインスタンス化されているかを確認し、下位互換性を確保してください。ロガーが提供された場合にのみロギングが行われることを確認するテストを作成してください。
索引モデルが issue の本文から書いたものです。
説明
Problem
PostMessageTransport calls console.debug unconditionally (src/message-transport.ts at 264d9ca, lines 77, 82, 87 and 128):
- "Sending message" for every outgoing message except
tool-input-partial - "Parsed message" for every valid incoming message
- "Ignoring message from unknown source" for every message from another frame
A host cannot turn these off. The transport takes no option for it, and the only workaround is wrapping console.debug globally.
The noise grows with the number of Apps on a page. Each card's host transport listens on the same window, so a message from any View reaches every bridge. The owning bridge logs "Parsed message", and each of the other N−1 bridges logs "Ignoring message from unknown source" with the full MessageEvent. With four cards in a conversation, every View message produces four host lines, plus the View's own "Sending message" inside its frame. Size changes and host-context updates fan out the same way.
The source check is correct. Only the logging is the problem.
Prior discussion
- #237 / #239 moved the unknown-source log from
console.errortoconsole.debug. - #546 skipped the log for
tool-input-partialbecause it flooded the console. - #741 asked for opt-in logging or a configurable logger, and noted that full payloads, including tool-result
_meta, reach the console. Its filer closed it without a change.
Proposal
Make transport logging opt-in through an options argument:
new PostMessageTransport(eventTarget, eventSource, { logger?: Pick<Console, "debug"> })
Log nothing when logger is absent. The console.error for a malformed JSON-RPC message can stay. The third argument keeps the existing constructor compatible.
Happy to open a PR if this direction works.
Seen on 1.7.5; unchanged on main as of v2.0.0.
- 主要言語
- TypeScript
- スター
- 2.9k
- フォーク
- 387
- 平均マージ
- 2時間 54分
- マージ済み PR(30日)
- 7
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/ext-apps のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
modelcontextprotocol/ext-apps#767 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modelcontextprotocol/ext-apps#742 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
modelcontextprotocol/ext-apps#711 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
modelcontextprotocol/ext-apps#706 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelcontextprotocol/ext-apps#703 · リアクション 1 件 ·
modelcontextprotocol/ext-apps の issue をすべて見る
似ている issue
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
Mend: dependency security vulnerability untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100