chore(slack): add verbose debug logging across message handling flow#329
Merged
chore(slack): add verbose debug logging across message handling flow#329
Conversation
Add console.logs to all strategic points in the Slack message handling pipeline to aid production debugging. Covers: webhook routing, event filtering, event handling, context building, LLM calls, streaming, Decopilot API, and Slack API responses. Includes timing, message previews, config details, and error context at each step. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
9 issues found across 9 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="slack-mcp/server/lib/slack-client.ts">
<violation number="1" location="slack-mcp/server/lib/slack-client.ts:235">
P1: Avoid logging message text previews. This leaks user conversation content into production logs; log only metadata (length/ids) or gate content logging behind a non-production debug flag.</violation>
</file>
<file name="slack-mcp/server/slack/handlers/context-builder.ts">
<violation number="1" location="slack-mcp/server/slack/handlers/context-builder.ts:153">
P1: Do not log raw message content from Slack history; this can leak user data into production logs. Log only metadata (index/role/length) or gate content logging behind a strict debug flag.</violation>
</file>
<file name="slack-mcp/server/lib/llm.ts">
<violation number="1" location="slack-mcp/server/lib/llm.ts:64">
P1: Avoid logging raw LLM response text; this can leak sensitive user or business data into production logs.</violation>
</file>
<file name="shared/mesh-chat/client.ts">
<violation number="1" location="shared/mesh-chat/client.ts:109">
P1: Avoid logging raw Decopilot error bodies; this can leak sensitive request/response content into production logs.</violation>
</file>
<file name="slack-mcp/server/router.ts">
<violation number="1" location="slack-mcp/server/router.ts:354">
P1: Avoid logging raw Slack message text; it can expose user content in production logs. Log metadata (length/type) instead.</violation>
</file>
<file name="slack-mcp/server/slack/handlers/llm-handler.ts">
<violation number="1" location="slack-mcp/server/slack/handlers/llm-handler.ts:158">
P1: Avoid logging raw LLM response text in production; this can leak sensitive user/content data into logs.</violation>
</file>
<file name="shared/mesh-chat/generate.ts">
<violation number="1" location="shared/mesh-chat/generate.ts:130">
P1: Avoid logging raw response content previews in production paths. This can leak user/LLM sensitive data into logs.</violation>
</file>
<file name="slack-mcp/server/slack/handlers/eventHandler.ts">
<violation number="1" location="slack-mcp/server/slack/handlers/eventHandler.ts:514">
P1: Avoid logging raw user message text; log metadata (length/flags) instead to prevent sensitive data leakage in production logs.</violation>
<violation number="2" location="slack-mcp/server/slack/handlers/eventHandler.ts:601">
P1: Do not log LLM prompt content previews; this can leak conversation and attachment data to logs.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Keep both debug logs from main (config/apiMessages/response logging) and timing instrumentation from this branch (startTime for duration). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
3 issues found across 13 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="shared/mesh-chat/generate.ts">
<violation number="1" location="shared/mesh-chat/generate.ts:120">
P1: Do not log raw `config` and `apiMessages`; it can leak the Mesh auth token and full user message/media contents to logs.</violation>
</file>
<file name="openrouter/server/tools/embeddings/generate.ts">
<violation number="1" location="openrouter/server/tools/embeddings/generate.ts:53">
P1: Do not log raw embedding input payloads; this can expose user content in production logs.</violation>
<violation number="2" location="openrouter/server/tools/embeddings/generate.ts:61">
P2: Avoid logging the full embeddings result object; log only lightweight metadata.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
- Remove unused OpenRouterClient import in list-models.ts - Make streaming callback async to match StreamCallback type - Cast to any for files/channel_type on SlackEvent in debug logs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Address PR review: replace all text previews, response previews, and raw object dumps with metadata-only logging (lengths, counts, IDs, timing). Prevents leaking user content, LLM responses, and auth tokens into production logs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CreateEmbeddingsResponse type doesn't expose .data/.model properties directly. Cast to any since this is debug-only metadata logging. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
tlgimenes
added a commit
that referenced
this pull request
Mar 23, 2026
Rollback console.log additions from PR #329 in the shared module. Debug logging should only be in slack-mcp and openrouter, not in the shared library used by multiple MCPs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
console.logstatements across all strategic points in the Slack MCP message handling pipeline for production debuggingHow to Test
[Router]→[Webhook]→[EventHandler]→[ContextBuilder]→[LLMHandler]→[LLM]→[MeshChat]→[Slack]Screenshots
N/A
Migration Notes
N/A — no behavioral changes, only added logging.
🤖 Generated with Claude Code
Summary by cubic
Adds verbose, metadata-only debug logging across the Slack MCP message flow to trace issues end-to-end, with consistent timing/status logs for Decopilot/MeshChat/OpenRouter/Slack APIs. No behavior changes.
Refactors
shared/mesh-chat(client/generate), Slack client, and OpenRouter embedding tools with start/end markers, trace IDs, and streaming chunk counts.oxfmtformatting and minor cleanup inopenrouter/server/utils.ts.Bug Fixes
asyncto matchStreamCallbacktype.OpenRouterClientimport inopenrouter/server/tools/embeddings/list-models.ts.files,channel_type) to avoid TypeScript errors.anyfor metadata-only logging where types don’t expose needed fields.Written for commit 241d583. Summary will update on new commits.