Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add MCP connect and generation-prep observability - #28402

Merged
ibetitsmike merged 8 commits into
mainfrom
mike/chatd-mcp-observability
Aug 27, 2026
Merged

feat: add MCP connect and generation-prep observability#28402
ibetitsmike merged 8 commits into
mainfrom
mike/chatd-mcp-observability

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Stack context

Follow-up to the MCP connect-stall incident (chats on dev.coder.com stalled ~15 min/turn while a configured MCP server black-holed requests). The stack: #28400 makes the 10s MCP connect budget actually hold; this PR makes connect and preparation slowness observable so the next incident shows up in logs and the chat debug UI instead of as a silent timeline gap.

Why

During the incident, each stalled turn looked like a silent gap before the first debug step: no per-server connect durations anywhere, no warning that preparation was slow, and the only signal was a generic "connection failure" log without timing.

Changes

  • mcpclient.ConnectAll now returns per-server ConnectSummary values (config ID, slug, outcome connected/timeout/error/no_tools, duration, tool count, redacted error). Failure logs include the duration, and successful connects slower than 5s log a slow MCP server connect warning.
  • Connect summaries are seeded into the chat debug run summary under an mcp_connect key (seeded keys survive FinalizeRun's aggregation), and the debug panel's run card renders them as a per-server list with outcome badges, durations, tool counts, and errors.
  • prepareGeneration logs a slow generation preparation warning when a turn's preparation exceeds 30s.

Tests

  • Go: connect summary assertions added to the budget tests (outcome/duration/tool count for black-holed vs healthy servers); go test ./coderd/x/chatd/... green.
  • Frontend: new coerceRunSummary unit tests for mcp_connect coercion (malformed entries dropped, non-array ignored) and a RunWithMCPConnectSummary story whose play function expands the run and asserts the rendered outcomes, durations, tool counts, and error text. pnpm check, lint:types, unit and storybook projects green.

🤖 Mux authored this PR on Mike's behalf.

@ibetitsmike ibetitsmike changed the title feat(coderd/x/chatd): add MCP connect and generation-prep observability feat: add MCP connect and generation-prep observability Aug 21, 2026
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac462478be

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/x/chatd/active_turn_debug.go Outdated
@ibetitsmike
ibetitsmike force-pushed the mike/chatd-mcp-observability branch from ac46247 to 5a4b501 Compare August 24, 2026 10:44
Base automatically changed from mike/chatd-mcp-connect-budget to main August 25, 2026 09:43
@ibetitsmike
ibetitsmike force-pushed the mike/chatd-mcp-observability branch from 5a4b501 to 4fbb110 Compare August 25, 2026 09:44
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4fbb1108bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/x/chatd/active_turn_debug.go
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7473d06cff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/x/chatd/generation.go Outdated
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: b6cfdf729e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Chat turns that stall in MCP connects or preparation were invisible:
the debug UI showed a silent gap before the first step and logs had
no durations.

- ConnectAll returns per-server ConnectSummary values (outcome,
  duration, tool count, redacted error), logs connect duration on
  failure, and warns on successful connects slower than 5s.
- Connect summaries are seeded into the chat debug run summary
  (mcp_connect key) and rendered in the debug panel run card as a
  per-server list with outcome badges, durations, and errors.
- prepareGeneration warns when preparation exceeds 30s.
A failed title generation or quickgen run with a first_message label
was indistinguishable from a failed chat turn in the debug panel.
Show the run kind in the card metadata whenever a non-chat-turn run
carries a first_message label.
@ibetitsmike
ibetitsmike force-pushed the mike/chatd-mcp-observability branch from b6cfdf7 to 937fa5e Compare August 27, 2026 00:02
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 937fa5e8ed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/x/chatd/generation.go Outdated
Comment thread coderd/x/chatd/active_turn_debug.go Outdated
Comment thread coderd/x/chatd/active_turn_debug.go Outdated
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08221f02f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/x/chatd/generation_preparer.go Outdated
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2b39852bd1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/x/chatd/mcpclient/mcpclient.go Outdated
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 7bb3c7297a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike marked this pull request as ready for review August 27, 2026 08:20
@ibetitsmike
ibetitsmike merged commit 5cc2f2c into main Aug 27, 2026
33 checks passed
@ibetitsmike
ibetitsmike deleted the mike/chatd-mcp-observability branch August 27, 2026 08:22
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants