Skip to content

Add connection diagnostics MCP commands - #961

Merged
shanselman merged 1 commit into
mainfrom
bkudiess-connection-diagnostics-cleanup
Jul 10, 2026
Merged

shanselman merged 1 commit into
mainfrom
bkudiess-connection-diagnostics-cleanup

Conversation

@bkudiess

@bkudiess bkudiess commented Jul 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Adds read-only local MCP diagnostics commands: app.connection.status and app.connection.gateways.
  • Introduces a snapshot-derived ConnectionDiagnosticsProjection so agents can inspect active gateway, operator/node credential state, MCP runtime state, browser proxy caveats, pending approval actions, retry hints, and recent diagnostics without adding a competing connection truth model.
  • Documents remaining AppState.Status / ConnectionStatus usage as derived compatibility debt.
  • Updates MCP command descriptions and winnode skill docs, with drift and projection tests.
  • Hardens gateway display URL sanitization so diagnostics remove userinfo, query strings, and fragments.

Validation

  • .\build.ps1 ✅ all builds succeeded.
  • dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore ✅ 2732 passed, 31 skipped, 0 failed.
  • dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore ✅ 1669 passed, 0 failed.
  • dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restore ✅ 422 passed, 0 failed.
  • dotnet test .\tests\OpenClaw.WinNode.Cli.Tests\OpenClaw.WinNode.Cli.Tests.csproj --no-restore ✅ 126 passed, 0 failed.
  • git diff --check ✅ no whitespace errors.

Real behavior proof

Started an isolated tray with EnableMcpServer=true, EnableNodeMode=false using an isolated tray data directory:

C:\Users\<user>\.copilot\session-state\<session-id>\files\mcp-proof-data

winnode --list-tools showed:

"name": "app.connection.status"
"name": "app.connection.gateways"
"name": "app.connection.pendingApprovals"

winnode --command app.connection.status --params '{}' returned current-head diagnostics including:

{
  "schemaVersion": 1,
  "connectionState": "Idle",
  "effectiveMode": "LocalMcpOnly",
  "legacyConnectionStatus": "Disconnected",
  "mcp": {
    "enabled": true,
    "running": true,
    "error": null
  },
  "pendingActions": [],
  "diagnostics": {
    "eventCount": 0,
    "recentEvents": []
  }
}

winnode --command app.connection.gateways --params '{}' returned:

{
  "activeGatewayId": null,
  "count": 0,
  "gateways": []
}

The isolated tray process was stopped after proof collection.

Review notes

  • Rubber-duck review completed; fixed URL userinfo redaction finding before initial closeout.
  • Dual-model review completed; fixed all findings:
    • strip token-like URL query/fragment data from diagnostics display URLs,
    • filter degenerate gateway projections defensively,
    • add regression tests for both cases.

Follow-up risks

  • Exact retry attempt / next retry timestamp is still not manager-published state. The new diagnostics expose recent retry/reconnect diagnostic events instead of inventing a parallel retry model.
  • AppState.Status / ConnectionStatus remain documented as derived compatibility paths for older UI/protocol surfaces.

Expose read-only local MCP diagnostics for connection state and saved gateways. Add snapshot-derived projection, command docs, and regression coverage for credential-safe URL display and degenerate gateway records.

Co-authored-by: Copilot App <[email protected]>
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. labels Jul 10, 2026
@clawsweeper

clawsweeper Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed July 10, 2026, 1:33 PM ET / 17:33 UTC.

Summary
Adds two read-only local MCP commands for connection status and saved-gateway diagnostics, backed by a snapshot-derived projection, stricter URL redaction, documentation, and regression tests.

Reproducibility: not applicable. This PR introduces a new read-only local MCP troubleshooting capability rather than reporting broken existing behavior.

Review metrics: 3 noteworthy metrics.

  • Command surface: 2 read-only commands added. Both commands extend the local MCP troubleshooting contract without adding mutation or gateway-advertised capability.
  • Changed surface: 14 files; 876 added, 6 removed. The response schema, capability registration, documentation, and tests span several ownership areas despite the focused behavior.
  • Runtime proof: 2 commands discovered and invoked. The PR demonstrates the complete supported winnode discovery-and-call path rather than relying only on mocks or unit tests.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Next step before merge

  • No automated repair is indicated; the clean collaborator-authored feature needs routine feature-owner review and merge consideration.

Security
Cleared: The patch adds no dependency, permission, or remote execution surface and strengthens URL redaction while consuming already-sanitized diagnostic events.

Review details

Best possible solution:

Merge the versioned, local-only diagnostics projection after routine owner review, retaining its snapshot-derived design and redaction tests as the supported agent troubleshooting contract.

Do we have a high-confidence way to reproduce the issue?

Not applicable; this PR introduces a new read-only local MCP troubleshooting capability rather than reporting broken existing behavior.

Is this the best way to solve the issue?

Yes; a pure projection from the connection manager, registry, settings, and existing sanitized diagnostics fills the gap beyond app.status without creating a competing state owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8a9e35142d49.

Label changes

Label justifications:

  • P3: This is a low-urgency diagnostics and agent-ergonomics feature with strong proof and no reported production regression.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The isolated current-head tray transcript proves MCP discovery and real invocation of both new commands with representative after-change output.
  • proof: sufficient: Contributor real behavior proof is sufficient. The isolated current-head tray transcript proves MCP discovery and real invocation of both new commands with representative after-change output.
Evidence reviewed

What I checked:

Likely related people:

  • bkudiess: Prior merged current-main work introduced the snapshot-truth and multi-gateway credential behavior from which this projection is derived. (role: recent connection architecture contributor; confidence: high; commits: 74604aebafef, 5a181504336b; files: src/OpenClaw.Connection/GatewayConnectionManager.cs, src/OpenClaw.Connection/ConnectionDiagnostics.cs, src/OpenClaw.Tray.WinUI/App.CapabilityHandlers.cs)
  • Scott Hanselman: The initial repository commit introduced AppConnectionCapability, GatewayUrlHelper, the MCP bridge foundation, and the original connection-manager implementation. (role: original capability and helper introducer; confidence: high; commits: 4166e0fd63f8, 14022dc71222; files: src/OpenClaw.Shared/Capabilities/AppConnectionCapability.cs, src/OpenClaw.Shared/GatewayUrlHelper.cs, src/OpenClaw.Shared/Mcp/McpToolBridge.cs)
  • Caleb Eden: Recent merged work updated the same app capability wiring and MCP command-description surface for chat queue commands. (role: recent adjacent MCP contributor; confidence: medium; commits: 02f2421a5e75; files: src/OpenClaw.Tray.WinUI/App.CapabilityHandlers.cs, src/OpenClaw.Shared/Mcp/McpToolBridge.cs)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-10T16:57:02.781Z sha 85bead6 :: needs maintainer review before merge. :: none

@bkudiess
bkudiess marked this pull request as ready for review July 10, 2026 17:22
@bkudiess

Copy link
Copy Markdown
Collaborator Author

Addressed ClawSweeper feedback: redacted the local Windows username/session-state proof path in the PR body while keeping the live winnode output intact. The branch is now ready for maintainer review.

@shanselman
shanselman merged commit 053501c into main Jul 10, 2026
22 checks passed
@shanselman
shanselman deleted the bkudiess-connection-diagnostics-cleanup branch July 10, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants