feat(diagnostics): capture MCP registration errors and cloud endpoint transport evidence - #3201
Merged
Merged
Conversation
… transport evidence Self-hosted Den deployments behind corporate TLS failed openwork-cloud MCP registration for three weeks with zero captured cause: the engine's error string was discarded at parse time, the credentialed catalog probe fails closed for self-hosted origins, and mcps[] hid the real endpoint. - persist OpenCode's registration error (sanitized, bounded) through the registration record into engine-mcp-sync failedRegistrations, with a classified transportCause (tls_incomplete_chain, tls_untrusted_ca, ...) - scrub URL/path segments to [url]/[path] placeholders instead of whole-string redaction so endpoint-bearing TLS errors survive sanitization - new credential-free cloud-endpoint-transport check: bare TLS handshake captures the exact verify error code, served chain length/subjects, and local trust evidence (system CA count, NODE_EXTRA_CA_CERTS state) - report real origin + path for managed openwork-cloud MCP entries - keep the credentialed-probe trust gating and report-safety claims intact
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
Author
|
Rebased onto dev via merge commits after #3199/#3200/#3203 landed. Recomposition notes:
|
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.
Problem
Self-hosted Den behind corporate TLS (Blue Yonder POC):
openwork-cloudMCP registration fails on some machines while sign-in, Den API, models, and inference all work. Three weeks of debugging produced zero captured error cause, because:server.tsparsed onlyentry.statusfrom OpenCode'sPOST /mcpregistration response and discardedentry.error— the exact TLS message from the failing runtime (OpenCode's failed status carries{ status: "failed", error: string }).cloud-tool-catalogfails closed (untrusted_endpoint) for self-hosted origins, so its transport classifier never runs.mcps[].originwas hardcodednullandpatha constant — endpoint drift between users was invisible.Change
sanitizeDiagnosticString, bounded to 400 chars) through the registration record intoengine-mcp-sync.details.failedRegistrations[].errorSummary, plus a classifiedtransportCause(tls_incomplete_chain,tls_untrusted_ca,dns_error,connection_refused, …) covering Node and Bun error shapes.[url]/[path]placeholders so endpoint-bearing TLS errors survive (failed to connect to [url] unable to verify the first certificate), while credential-bearing strings still fully redact.cloud-endpoint-transportcheck — credential-free (barenode:tlshandshake, no HTTP, no headers): exact verify error code, served chain length + subject/issuer CNs (the "is the proxy serving leaf-only?" question), DNS/TCP reachability, and local trust evidence (tls.getCACertificates("system").length,NODE_EXTRA_CA_CERTSpresence + bundle cert count). Runs only when the managed cloud MCP is not connected.origin+pathfor managedopenwork-cloudMCP entries (no query/hash/userinfo; strict schema validators added).untrusted_endpointcontract,semi-airgapped-den-contracteval) untouched; report-safety claims stay truthful (rawEngineErrorsIncluded: false, newsanitizedEngineErrorSummariesIncluded/credentialFreeTransportProbePerformedflags).Proof (real run, real TLS-broken endpoint)
runAgentContextDiagnosticsagainst a live self-signed TLS server with the incident-shaped registration record — schema-valid report now carries:Note
systemCaCertificateCount: 0— reproduced live on macOS, the same measurement as the control machine, now visible in every report.Tests
bun test(apps/server): agent-context-diagnostics, agent-context-diagnostics-local-schema, agent-context-diagnostics.schema, mcp.engine-sync.e2e, agent-context-transport-probe (real openssl self-signed TLS server, ECONNREFUSED, ENOTFOUND), agent-context-cloud-probe, cloud-mcp-health, cloud-mcp-reconcile.e2e — 150 pass / 0 failbun test --isolate(apps/app): agent-context-diagnostics report component tests — 20 pass / 0 failpnpm --filter openwork-server typecheck✅ ·pnpm --filter @openwork/app typecheck✅Validation honesty: verified at the server level with a real TLS endpoint plus component tests; no fraimz/Electron-UI run for the new check's wizard rendering (label wiring is enforced by the
Record<AgentContextDiagnosticCheckId, string>typecheck). Repro steps for reviewers:cd apps/server && bun test src/agent-context-transport-probe.test.ts src/agent-context-diagnostics.test.ts.