Skip to content

kaizen: replace eslint-disable with idiomatic _kind in PrimitiveDetail#177

Open
gabrypavanello wants to merge 6 commits intomainfrom
kaizen/2026-02-20
Open

kaizen: replace eslint-disable with idiomatic _kind in PrimitiveDetail#177
gabrypavanello wants to merge 6 commits intomainfrom
kaizen/2026-02-20

Conversation

@gabrypavanello
Copy link
Contributor

Kaizen — 2026-02-20

What: Removes an eslint-disable-next-line @typescript-eslint/no-unused-vars comment in PrimitiveDetail.tsx in favour of the idiomatic underscore-prefix convention.

Before:

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { kind, ...primitiveData } = primitive;

After:

const { kind: _kind, ...primitiveData } = primitive;

Why: The project's ESLint config already has varsIgnorePattern: '^_' set. Using the underscore-prefix signals intent clearly — kind is destructured out on purpose to exclude it from primitiveData passed to CopyJsonButton — without needing an inline suppression comment.

Risk: None. No logic change. Build ✅ Tests ✅ (1669/1669 passing).

Sirius added 6 commits February 10, 2026 09:03
…SK-037-02)

Replace all raw console.log/warn/error calls across 17 inspector/src
files with scoped logger instances using createLogger(). Each module
gets a descriptive source name for log filtering.

- 17 files migrated to structured logger
- Stale eslint-disable no-console comments removed
- Tests updated to match new console.info output format
- bin/mcp-inspector.ts and widget-server-templates.ts untouched
- proxy-resources.ts skipped (console call is in client-side template)
Use the underscore-prefix convention (already configured in ESLint as
varsIgnorePattern: '^_') to signal that  is intentionally unused
after destructuring. Removes the inline eslint-disable comment in favour
of the project's established pattern.

No behaviour change.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a structured logging system with timestamped messages, source-specific labels, and configurable verbosity levels controlled via the MCP_APPS_LOG_LEVEL environment variable (defaults to info).
  • Improvements

    • Replaced all direct console logging with the new structured logger throughout the codebase for enhanced consistency, observability, and unified logging behavior across all components.

Walkthrough

Introduces a centralized, structured logging system across the codegen and inspector packages, replacing console.log/warn/error calls with scoped, timestamped loggers controlled by the MCP_APPS_LOG_LEVEL environment variable. The logger supports debug, info, warn, and error levels with consistent formatting.

Changes

Cohort / File(s) Summary
Core Logger Module
packages/inspector/src/debug/logger.ts, packages/inspector/src/index.ts
New structured logger module with LogLevel type, Logger interface, and createLogger factory. Exports public types and defaultLogger instance. Supports log-level gating via MCP_APPS_LOG_LEVEL environment variable with timestamped, source-prefixed output.
Inspector Connection & Server Logging
packages/inspector/src/connection.ts, packages/inspector/src/dual-server.ts, packages/inspector/src/standalone-server.ts, packages/inspector/src/widget-server.ts
Replaces console logging with module-scoped loggers for lifecycle events (connect/disconnect, startup, auto-connect, request handling, environment updates).
Inspector Host Emulators
packages/inspector/src/hosts/mcp-host.ts, packages/inspector/src/hosts/openai-host.ts
Adds structured logger for host emulation paths, replaces console logs in display-mode changes, tool calls, and Playwright-injected script contexts. Adds type guards for display-mode validation.
Inspector OAuth & Proxy Tools
packages/inspector/src/oauth/preset-config.ts, packages/inspector/src/oauth/provider.ts, packages/inspector/src/oauth/wellknown-proxy.ts, packages/inspector/src/proxy-tools.ts
Introduces module-scoped loggers for OAuth configuration, provider discovery, proxy routing, and widget session management; replaces console.log/warn with logger.info/warn.
Inspector Session Management
packages/inspector/src/session/session-renderer.ts, packages/inspector/src/session/session-store.ts, packages/inspector/src/widget-session-manager.ts
Replaces console logging with logger for session lifecycle events (creation, closure, disposal), MCP/OpenAI host messaging, and viewport updates. Removes eslint-disable directives in favor of proper logger usage.
Inspector Tools & Dashboard
packages/inspector/src/tools/call-tool.ts, packages/inspector/src/tools/widget-control.ts, packages/inspector/src/dashboard/cdp-streamer.ts, packages/inspector/src/dashboard/react/components/PrimitiveDetail.tsx
Adds logger instances for tool execution and widget/CDPStreamer operations; replaces console output with logger calls. Renames unused variable in PrimitiveDetail to suppress lint warnings.
Codegen Logging
packages/codegen/src/watcher.ts
Replaces simple logger with structured, timestamped logger supporting MCP_APPS_LOG_LEVEL configuration.
Cross-Package Logging
packages/testing/src/eval/mcp/evaluator.ts, packages/ui-react/src/hooks.ts
Introduces lightweight, scoped internal loggers (evaluatorLogger, uiReactLogger) with warn method to avoid cross-package dependencies; respects MCP_APPS_LOG_LEVEL threshold.
Test Coverage
packages/inspector/tests/logger.test.ts, packages/inspector/tests/widget-session-manager.test.ts
New comprehensive test suite for logger module covering level gating, timestamp formatting, source prefixes, and environment variable handling. Updates widget-session-manager tests to assert logger.info calls instead of console.log.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: replacing an eslint-disable comment with the idiomatic underscore-prefix convention for an unused variable in PrimitiveDetail.
Description check ✅ Passed The description clearly explains the change, provides before/after code examples, articulates the rationale (ESLint varsIgnorePattern configuration), and confirms no logic changes with passing tests.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kaizen/2026-02-20

Comment @coderabbitai help to get the list of available commands and usage tips.

@claude
Copy link
Contributor

claude bot commented Feb 20, 2026

Code Review — PR #177

Thanks for the cleanup work. The core _kind rename in PrimitiveDetail.tsx is correct and the right approach given the repo's varsIgnorePattern: '^_' ESLint config. The new debug/logger.ts module is well-structured and the test suite is thorough. That said, there is one runtime bug and a few other issues worth addressing.


Bug: logger.info/warn inside Playwright page.evaluate() callbacks

Several console.log/warn calls inside Playwright browser-evaluation callbacks have been replaced with logger.info/warn. Since page.evaluate() serializes the callback and runs it in the browser context, the Node.js-scoped logger variable is not available there. This will throw ReferenceError: logger is not defined at runtime on any code path that hits these branches.

Affected locations in packages/inspector/src/:

session/session-renderer.ts — inside deliverToolCallResponse's page.evaluate(...) and inside updateMcpGlobals / updateOpenAIGlobals page.evaluate blocks.

widget-session-manager.ts — inside the browser-context evaluate callbacks (identifiable by the surrounding eslint-disable no-undef blocks that access window, iframe, etc.).

The original console.log() worked because console is available in both Node and browser contexts. The fix is to revert these specific call sites back to console.log/warn (with // eslint-disable-next-line no-console if needed), since there is no way to pass the Node.js logger into a page.evaluate serialization boundary.

The tests still pass (1669/1669) because these code paths appear not to be exercised in the automated test suite, so the bug would only surface in real E2E usage.


Import ordering in multiple files

Several files declare const logger = createLogger(...) between import statements. ES modules require all import declarations to appear before any executable statements. While TypeScript/bundlers hoist imports, this violates style conventions and may trigger lint rules.

Affected files: dual-server.ts, session-store.ts, session-renderer.ts, call-tool.ts, widget-control.ts, widget-session-manager.ts.

All import declarations should be grouped together before the const logger = ... line.


PR scope vs. description mismatch

The PR title and description focus exclusively on the _kind rename in PrimitiveDetail.tsx, but the diff introduces ~450 lines of new logging infrastructure across five packages (inspector, codegen, testing, ui-react). The description should reflect the actual scope of the change.


Duplicated inline logger logic

The packages that cannot depend on inspector (codegen/watcher.ts, testing/evaluator.ts, ui-react/hooks.ts) each contain a copy-pasted IIFE logger with the same LEVELS table and threshold logic. The comment says "mirrors inspector's createLogger, avoids cross-package dep" — the intent is valid, but three copies of the same 15-line IIFE will diverge over time.

Consider extracting the logger into a minimal package (e.g. @mcp-apps-kit/logger or into packages/core) that all packages can depend on.


What's good

  • packages/inspector/src/debug/logger.ts is clean and well-typed; the LogLevel type, LEVEL_ORDER map, and single eslint-disable no-console block are all idiomatic.
  • logger.test.ts covers the key behaviors: default level, level filtering, silent, invalid env var fallback, and variadic args passthrough. Good test coverage.
  • The _kind fix in PrimitiveDetail.tsx is exactly right.
  • Removing the // eslint-disable-next-line no-console scatter across connection.ts, dual-server.ts, etc. is a real improvement.
  • Updating widget-session-manager.test.ts to spy on console.info instead of console.log is correct for the new log path.

Summary

Severity Issue
Bug (critical) logger used inside page.evaluate() browser-context callbacks — will ReferenceError at runtime
Style Import declarations interleaved with executable statements in 6 files
Scope PR description does not match the actual extent of changes
Design Duplicated inline logger logic across 3 packages

The critical issue needs to be fixed before merge. The style issues are lower priority but worth addressing in the same PR given they touch the same files.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (7)
packages/inspector/src/widget-session-manager.ts (4)

400-415: ⚠️ Potential issue | 🔴 Critical

logger is not available in browser context — will cause runtime error.

The logger.info() call at line 412 is inside a page.evaluate() callback, which executes in the browser context. The Node.js logger variable is not serialized or available in that context, causing a ReferenceError: logger is not defined at runtime.

Use console.log for browser-context logging, or remove the log statement since it's inside the browser and won't appear in server logs anyway.

Proposed fix
           iframe.contentWindow.postMessage(message, "*");
-          logger.info("[MCP Host] Sent ui/notifications/host-context-changed", ctx);
+          // Browser context: use console.log (not Node logger)
+          console.log("[MCP Host] Sent ui/notifications/host-context-changed", ctx);
         }

Or remove the log entirely if browser-side logging is not desired.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/inspector/src/widget-session-manager.ts` around lines 400 - 415, The
browser-executed callback passed to page.evaluate references the Node-side
logger (logger.info) which isn't available in the browser context and causes a
ReferenceError; update the callback inside page.evaluate (the function using
hostContext, iframe, and iframe.contentWindow.postMessage) to remove or replace
logger.info with a browser-safe call (e.g., console.log) or omit logging
entirely so the browser context does not reference the Node logger variable.

436-445: ⚠️ Potential issue | 🔴 Critical

Same browser context issue — logger unavailable in page.evaluate().

Line 442 has the same problem: logger.info() inside a browser-evaluated callback will fail at runtime.

Proposed fix
           iframe.contentWindow.postMessage(message, "*");
-          logger.info("[OpenAI Host] Sent globals sync:", message.data);
+          console.log("[OpenAI Host] Sent globals sync:", message.data);
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/inspector/src/widget-session-manager.ts` around lines 436 - 445, The
call to logger.info inside page.evaluate will fail because logger is not defined
in the browser context; update the block that calls page.evaluate with (message:
typeof syncMessage) => { ... } so that it only posts the message from the page
context and returns any needed status (e.g., true or message.data), then perform
logger.info(...) in the Node context after await page.evaluate(...) completes
(refer to the page.evaluate invocation, the syncMessage argument, and the logger
variable) so logging runs outside the browser-evaluated function.

791-799: ⚠️ Potential issue | 🔴 Critical

Browser context logger usage at line 796 will fail.

Same issue: logger.info() inside page.evaluate() runs in browser context.

Proposed fix
       if (iframe?.contentWindow) {
         iframe.contentWindow.postMessage(message, "*");
-        logger.info("[OpenAI Host] Sent synced event:", message.syncType, message.data);
+        console.log("[OpenAI Host] Sent synced event:", message.syncType, message.data);
       }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/inspector/src/widget-session-manager.ts` around lines 791 - 799, The
code calls logger.info(...) inside session.page.evaluate (browser context) which
will fail because logger isn't available in the page scope; update the logic in
widget-session-manager.ts so page.evaluate only posts the message and returns
any needed status or payload (use session.page.evaluate((message)=>{...; return
true}, syncMessage) or similar), then call logger.info(...) in the Node context
after await session.page.evaluate resolves (reference the symbols
session.page.evaluate, syncMessage, and logger) so logging happens outside the
browser sandbox; alternatively, pass only serializable data back from the page
and log that from the surrounding async function.

732-765: ⚠️ Potential issue | 🔴 Critical

Browser context logger usage at lines 747 and 760 will fail.

Both logger.info() calls inside this page.evaluate() callback are in browser context where the Node.js logger is undefined.

Proposed fix
         if (storeOnHost) {
           const w = window as Window & { __mcpHostContextUpdates?: Record<string, unknown> };
           w.__mcpHostContextUpdates = { ...(w.__mcpHostContextUpdates ?? {}), ...(p as object) };
-          logger.info("[MCP Host] Stored hostContext update for ui/initialize:", p);
+          console.log("[MCP Host] Stored hostContext update for ui/initialize:", p);
         }

         const iframe = document.getElementById("widget-frame") as HTMLIFrameElement | null;
         if (iframe?.contentWindow) {
           iframe.contentWindow.postMessage(
             {
               jsonrpc: "2.0",
               method: m,
               params: p,
             },
             "*"
           );
-          logger.info("[MCP Host] Sent synced event:", m, p);
+          console.log("[MCP Host] Sent synced event:", m, p);
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/inspector/src/widget-session-manager.ts` around lines 732 - 765, The
browser-evaluated function passed to session.page.evaluate uses the Node logger
(logger.info) which is undefined in the page context; replace those calls so
logging happens correctly: inside the callback (the function passed to
session.page.evaluate) remove or replace logger.info(...) with console.info(...)
(or collect the log messages into a returned object) and then, if you need
Node-side logging with the existing logger, return the details from
session.page.evaluate and call logger.info(...) in the outer scope after the
await; update the function that references method, params, storeOnHost,
isHostContextUpdate, iframe ("widget-frame") and __mcpHostContextUpdates
accordingly so no direct use of logger occurs inside the browser context.
packages/inspector/src/hosts/openai-host.ts (1)

226-250: ⚠️ Potential issue | 🟠 Major

Replace logger.info() with console.info() in the Playwright init script.

The logger.info() call at line 248 runs in the browser context of addInitScript, where the logger variable (defined in Node.js scope on line 22) is not available. This will throw a ReferenceError and break requestDisplayMode handling.

Suggested fix
-            logger.info('[OpenAI Host] requestDisplayMode:', mode, 'sizing:', sizing);
+            console.info('[OpenAI Host] requestDisplayMode:', mode, 'sizing:', sizing);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/inspector/src/hosts/openai-host.ts` around lines 226 - 250, The
browser-side function requestDisplayMode inside the addInitScript uses
logger.info which is a Node scope variable and will throw in the page context;
replace the logger.info call with console.info (keeping the same message and
variables: mode and sizing) so the log runs in the browser environment, e.g.
update the logging statement in requestDisplayMode to use console.info(...)
instead of logger.info(...).
packages/inspector/src/session/session-renderer.ts (1)

206-217: ⚠️ Potential issue | 🟠 Major

Replace logger calls with console inside page.evaluate blocks.

page.evaluate() executes JavaScript in the browser context where logger is not available. Six instances found across lines 217, 256, 287, 304, 313, and 332 will throw runtime errors if executed.

Fixes required
-      logger.info("[MCP Host] Sent ui/notifications/host-context-changed", ctx);
+      console.info("[MCP Host] Sent ui/notifications/host-context-changed", ctx);
-      logger.info("[OpenAI Host] Sent globals sync:", message.data);
+      console.info("[OpenAI Host] Sent globals sync:", message.data);
-      logger.info("[MCP Host] Tool response is not a valid object:", responseData);
+      console.info("[MCP Host] Tool response is not a valid object:", responseData);
-      logger.info("[MCP Host] Tool response missing valid name/toolName string:", responseData);
+      console.info("[MCP Host] Tool response missing valid name/toolName string:", responseData);
-      logger.info("[MCP Host] No pending calls for tool:", toolName);
+      console.info("[MCP Host] No pending calls for tool:", toolName);
-      logger.info("[MCP Host] Delivered synced tool response:", toolName, call.messageId);
+      console.info("[MCP Host] Delivered synced tool response:", toolName, call.messageId);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/inspector/src/session/session-renderer.ts` around lines 206 - 217,
Inside the page.evaluate(...) browser-executed callbacks (the function that
receives ctx and manipulates the iframe), replace any use of the Node-side
logger object with the browser console API (e.g.,
console.info/console.warn/console.error) so logging runs in the page context
rather than throwing; update all occurrences inside the page.evaluate callbacks
(the function passed to page.evaluate in session-renderer.ts that references ctx
and iframe) to use console instead of logger while keeping the original messages
and arguments.
packages/inspector/src/hosts/mcp-host.ts (1)

220-305: ⚠️ Potential issue | 🟠 Major

Replace logger calls with console in the Playwright init script.

The injected script runs in the browser context where logger is undefined. The four logger.info() calls in the ui/initialize, tool-result, and display-mode handlers will throw a ReferenceError. Use console.info() instead.

Fix
-                logger.info('[MCP Host Emulator] Received ui/initialize, responding...');
+                console.info('[MCP Host Emulator] Received ui/initialize, responding...');
...
-                logger.info('[MCP Host Emulator] Sent ui/initialize response');
+                console.info('[MCP Host Emulator] Sent ui/initialize response');
...
-                  logger.info('[MCP Host Emulator] Sending ui/notifications/tool-result...');
+                  console.info('[MCP Host Emulator] Sending ui/notifications/tool-result...');
...
-                  logger.info('[MCP Host Emulator] Display mode changed to:', requestedMode, 'sizing:', sizing);
+                  console.info('[MCP Host Emulator] Display mode changed to:', requestedMode, 'sizing:', sizing);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/inspector/src/hosts/mcp-host.ts` around lines 220 - 305, The
injected Playwright browser script uses an undefined logger and will throw
ReferenceError; replace all logger.info(...) calls in the MCP host emulator
message handlers with console.info(...). Specifically, update the ui/initialize
handler (the block that builds and dispatches the initialization response and
schedules the tool-result), the setTimeout that sends the
ui/notifications/tool-result resultMessage, and the ui/requests/display-mode
handler (where it logs display mode and sizing) to use console.info so the code
in methods handling message (jsonrpc 'ui/initialize',
'ui/notifications/tool-result', and 'ui/requests/display-mode') runs in the
browser context without errors.
🧹 Nitpick comments (1)
packages/inspector/src/oauth/wellknown-proxy.ts (1)

81-85: Redundant prefix in log message.

The logger already formats output as timestamp [INFO] [wellknown-proxy] ..., so the [oauth:wellknown-proxy] prefix in the message creates redundancy:

2026-02-20T... [INFO] [wellknown-proxy] [oauth:wellknown-proxy] Upstream changed...

Consider removing the inline prefix since the source is already captured by the logger.

Proposed fix
   function log(message: string): void {
     if (debug) {
-      logger.info(`[oauth:wellknown-proxy] ${message}`);
+      logger.info(message);
     }
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/inspector/src/oauth/wellknown-proxy.ts` around lines 81 - 85, The
inline prefix "[oauth:wellknown-proxy]" in the log() helper duplicates the
logger's own source tag; update the log function (log(message: string)) to stop
prepending that prefix and call logger.info(message) when debug is true so
messages are not double-tagged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/testing/src/eval/mcp/evaluator.ts`:
- Around line 37-50: Replace the custom inline evaluatorLogger with the shared
llmLogger: remove the evaluatorLogger IIFE (including the eslint-disable
comment) and instead import the exported llmLogger from the package's
debug/logger module, then use llmLogger.warn(...) wherever
evaluatorLogger.warn(...) was used; ensure any timestamp/source formatting is
preserved by using llmLogger's API rather than reimplementing logging logic.

---

Outside diff comments:
In `@packages/inspector/src/hosts/mcp-host.ts`:
- Around line 220-305: The injected Playwright browser script uses an undefined
logger and will throw ReferenceError; replace all logger.info(...) calls in the
MCP host emulator message handlers with console.info(...). Specifically, update
the ui/initialize handler (the block that builds and dispatches the
initialization response and schedules the tool-result), the setTimeout that
sends the ui/notifications/tool-result resultMessage, and the
ui/requests/display-mode handler (where it logs display mode and sizing) to use
console.info so the code in methods handling message (jsonrpc 'ui/initialize',
'ui/notifications/tool-result', and 'ui/requests/display-mode') runs in the
browser context without errors.

In `@packages/inspector/src/hosts/openai-host.ts`:
- Around line 226-250: The browser-side function requestDisplayMode inside the
addInitScript uses logger.info which is a Node scope variable and will throw in
the page context; replace the logger.info call with console.info (keeping the
same message and variables: mode and sizing) so the log runs in the browser
environment, e.g. update the logging statement in requestDisplayMode to use
console.info(...) instead of logger.info(...).

In `@packages/inspector/src/session/session-renderer.ts`:
- Around line 206-217: Inside the page.evaluate(...) browser-executed callbacks
(the function that receives ctx and manipulates the iframe), replace any use of
the Node-side logger object with the browser console API (e.g.,
console.info/console.warn/console.error) so logging runs in the page context
rather than throwing; update all occurrences inside the page.evaluate callbacks
(the function passed to page.evaluate in session-renderer.ts that references ctx
and iframe) to use console instead of logger while keeping the original messages
and arguments.

In `@packages/inspector/src/widget-session-manager.ts`:
- Around line 400-415: The browser-executed callback passed to page.evaluate
references the Node-side logger (logger.info) which isn't available in the
browser context and causes a ReferenceError; update the callback inside
page.evaluate (the function using hostContext, iframe, and
iframe.contentWindow.postMessage) to remove or replace logger.info with a
browser-safe call (e.g., console.log) or omit logging entirely so the browser
context does not reference the Node logger variable.
- Around line 436-445: The call to logger.info inside page.evaluate will fail
because logger is not defined in the browser context; update the block that
calls page.evaluate with (message: typeof syncMessage) => { ... } so that it
only posts the message from the page context and returns any needed status
(e.g., true or message.data), then perform logger.info(...) in the Node context
after await page.evaluate(...) completes (refer to the page.evaluate invocation,
the syncMessage argument, and the logger variable) so logging runs outside the
browser-evaluated function.
- Around line 791-799: The code calls logger.info(...) inside
session.page.evaluate (browser context) which will fail because logger isn't
available in the page scope; update the logic in widget-session-manager.ts so
page.evaluate only posts the message and returns any needed status or payload
(use session.page.evaluate((message)=>{...; return true}, syncMessage) or
similar), then call logger.info(...) in the Node context after await
session.page.evaluate resolves (reference the symbols session.page.evaluate,
syncMessage, and logger) so logging happens outside the browser sandbox;
alternatively, pass only serializable data back from the page and log that from
the surrounding async function.
- Around line 732-765: The browser-evaluated function passed to
session.page.evaluate uses the Node logger (logger.info) which is undefined in
the page context; replace those calls so logging happens correctly: inside the
callback (the function passed to session.page.evaluate) remove or replace
logger.info(...) with console.info(...) (or collect the log messages into a
returned object) and then, if you need Node-side logging with the existing
logger, return the details from session.page.evaluate and call logger.info(...)
in the outer scope after the await; update the function that references method,
params, storeOnHost, isHostContextUpdate, iframe ("widget-frame") and
__mcpHostContextUpdates accordingly so no direct use of logger occurs inside the
browser context.

---

Nitpick comments:
In `@packages/inspector/src/oauth/wellknown-proxy.ts`:
- Around line 81-85: The inline prefix "[oauth:wellknown-proxy]" in the log()
helper duplicates the logger's own source tag; update the log function
(log(message: string)) to stop prepending that prefix and call
logger.info(message) when debug is true so messages are not double-tagged.

Comment on lines +37 to +50
// Lightweight scoped logger (mirrors inspector's createLogger, avoids cross-package dep)
const evaluatorLogger = (() => {
const source = "testing:evaluator";
const ts = () => new Date().toISOString();
const LEVELS: Record<string, number> = { debug: 0, info: 1, warn: 2, error: 3, silent: 4 };
const envLevel = (process.env.MCP_APPS_LOG_LEVEL ?? "").toLowerCase();
const threshold: number = LEVELS[envLevel] ?? 1; // 1 = info
const ok = (l: string): boolean => (LEVELS[l] ?? 1) >= threshold;
return {
// eslint-disable-next-line no-console
warn: (...args: unknown[]) => {
if (ok("warn")) console.warn(`${ts()} [WARN] [${source}]`, ...args);
},
};
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for existing logger helpers in packages/testing or shared debug utilities
rg -n "createLogger|logger|logLevel|MCP_APPS_LOG_LEVEL" packages/testing src packages -g'*.ts' -g'*.tsx' --max-count=100

Repository: AndurilCode/mcp-apps-kit

Length of output: 50441


🏁 Script executed:

#!/bin/bash
# Examine the packages/testing/src/debug/logger.ts file
head -100 packages/testing/src/debug/logger.ts

Repository: AndurilCode/mcp-apps-kit

Length of output: 1898


🏁 Script executed:

#!/bin/bash
# Check the evaluator.ts file structure and usage around lines 789-791
sed -n '785,795p' packages/testing/src/eval/mcp/evaluator.ts

Repository: AndurilCode/mcp-apps-kit

Length of output: 377


Use the shared llmLogger instead of creating an inline evaluatorLogger with eslint-disable.

The packages/testing/src/debug/logger.ts module already exports an llmLogger specifically for LLM evaluation logging. Replace the inline evaluatorLogger (lines 37–50) with this existing utility to avoid reinventing the logging pattern and eliminate the eslint-disable suppression. Both are in the same package, so there's no cross-package dependency concern.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/testing/src/eval/mcp/evaluator.ts` around lines 37 - 50, Replace the
custom inline evaluatorLogger with the shared llmLogger: remove the
evaluatorLogger IIFE (including the eslint-disable comment) and instead import
the exported llmLogger from the package's debug/logger module, then use
llmLogger.warn(...) wherever evaluatorLogger.warn(...) was used; ensure any
timestamp/source formatting is preserved by using llmLogger's API rather than
reimplementing logging logic.

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