Skip to content

Feature/detailed logging#63

Open
bbolek-ap wants to merge 10 commits intoandresharpe:mainfrom
bbolek-ap:feature/detailed_logging
Open

Feature/detailed logging#63
bbolek-ap wants to merge 10 commits intoandresharpe:mainfrom
bbolek-ap:feature/detailed_logging

Conversation

@bbolek-ap
Copy link
Contributor

Resolves #27

image

This pull request introduces structured error logging across the MCP toolchain and runtime scripts by integrating the ErrorLogger module. The changes ensure that errors are consistently captured and logged with context, improving traceability and debugging. The most important changes are grouped below by theme.

ErrorLogger integration:

  • Added import statements for the ErrorLogger.psm1 module in core-helpers.psm1, dotbot-mcp.ps1, ClaudeCLI.psm1, and launch-process.ps1 to enable structured error logging throughout the system. [1] [2] [3] [4]

Structured error logging in tool and process errors:

  • Updated New-EnvelopeResponse in core-helpers.psm1 to log errors using Write-ErrorLog, normalizing error objects and providing tool context.
  • Enhanced error handling in dotbot-mcp.ps1 (Invoke-CallTool, Start-McpServerLoop) to log tool execution and server loop errors with relevant codes and exception details. [1] [2]

Runtime and process error logging:

  • Added structured error logs for process failures, crashes, provider invocation errors, non-recoverable task failures, max retries, and merge failures in launch-process.ps1, ensuring that all critical runtime errors are logged with context such as process and task IDs. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

ClaudeCLI error logging:

  • Implemented error logging in ClaudeCLI.psm1 for process start failures, rate limit events, stream event and line processing errors, using Write-ErrorLog for improved visibility and debugging. [1] [2] [3] [4]

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds centralized, structured error logging (JSONL) across the MCP server, runtime processes, and provider CLI wrappers, and surfaces that log in the web dashboard via new API endpoints and an “Errors” tab.

Changes:

  • Introduces ErrorLogger.psm1 (write/read/summary/clear + rotation) and integrates Write-ErrorLog into MCP/runtime/CLI error paths.
  • Adds UI server endpoints (/api/errors, /api/errors/clear, /api/errors/summary) and state polling support for an error summary/badge.
  • Implements a new dashboard “Errors” tab (JS module, HTML layout, CSS styling) with filtering, pagination, and clearing.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
profiles/default/systems/ui/static/modules/ui-updates.js Updates UI polling to refresh the error badge from state.
profiles/default/systems/ui/static/modules/tabs.js Triggers error fetch when switching to the Errors tab.
profiles/default/systems/ui/static/modules/errors.js New client module to fetch/render/clear error log entries in the UI.
profiles/default/systems/ui/static/index.html Adds Errors tab + context panel markup and loads errors.js.
profiles/default/systems/ui/static/css/views.css Adds styling for the Errors tab, entries, and badge.
profiles/default/systems/ui/static/app.js Initializes the Errors module on page load.
profiles/default/systems/ui/server.ps1 Adds API routing for error log endpoints and loads ErrorLogAPI module.
profiles/default/systems/ui/modules/StateBuilder.psm1 Adds error_summary to /api/state output (for badge/polling).
profiles/default/systems/ui/modules/ErrorLogAPI.psm1 New API layer for reading/clearing/summarizing the error log.
profiles/default/systems/runtime/modules/ErrorLogger.psm1 New central JSONL error log writer/reader with rotation and summary.
profiles/default/systems/runtime/launch-process.ps1 Logs key runtime/process failures to the central error log.
profiles/default/systems/runtime/ClaudeCLI/ClaudeCLI.psm1 Adds structured logging for CLI process start/rate-limit/stream errors.
profiles/default/systems/mcp/dotbot-mcp.ps1 Logs MCP tool/server-loop failures to the central error log.
profiles/default/systems/mcp/core-helpers.psm1 Logs tool envelope errors to the central error log in New-EnvelopeResponse.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@andresharpe
Copy link
Owner

Also have a look at https://github.com/andresharpe/dotbot-v3/blob/claude/dotbot-refactor-planning-kKO9U/docs/DOTBOT-V4-phase-01-structured-logging.md

... and see if we can match criteria?

@bbolek-ap
Copy link
Contributor Author

Also have a look at https://github.com/andresharpe/dotbot-v3/blob/claude/dotbot-refactor-planning-kKO9U/docs/DOTBOT-V4-phase-01-structured-logging.md

... and see if we can match criteria?

@andresharpe
I updated PR according to v4 structured logging

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.

Centralised error logging across dotbot processes

3 participants