feat: show workspace MCP discovery status and warnings in chat context - #29453
ibetitsmike wants to merge 2 commits into
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
802f7fd to
015fef8
Compare
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
015fef8 to
f9cd025
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
f9cd025 to
a588459
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
a588459 to
190f232
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
190f232 to
c56e317
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
c56e317 to
d9bad62
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
The sentence moves here from the gating layer because this layer renders those states. Add the story for a chat whose agent has not pushed its first snapshot, where the indicator shows only that discovery is underway.
d9bad62 to
ce0c811
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Stack context
This stack replaces #29114 after review feedback that a single
mcp_settledbool was underdeveloped and the change too large to review. It defines how workspace MCP discovery is communicated from the agent to chats: the agent publishes one discovery report inside the existing context snapshot (PushContextState), coderd persists it atomically with the resources, and chatd,find_tools, the create/start workspace tools, and the chat context UI all consume that same committed report.The report has three parts. Completeness:
MCPDiscovery.phaseisPENDINGuntil the agent's initial MCP reload has finished (success, failure, or zero servers all count) andCOMPLETEafterwards for the rest of the process; later reloads update outcomes but never move it back. Per-source outcomes stay on the existingContextResourcerows:mcp_configrows carry structural and semantic config errors,mcp_serverrows carry discovered servers (including zero tools), failed servers with a sanitized error, and a retained previous connection as OK plus a warning. Freshness: every snapshot carries theagent_run_idof the process that produced it, and the agent reports the same id inStartup, so a snapshot is known to describe the current process when the two ids match. Timestamps are deliberately not used for freshness becauseready_atis agent clock andreceived_atis coderd clock.Discovery completeness, per-source outcomes, turn eligibility, and the result of an actual tool invocation stay separate facts. Out of scope: continuous health monitoring, reconnect detection, automatic retries, and any retry or reload UI.
Layers, bottom to top: #29448 agent diagnostics, #29449 protocol and persistence, #29450 agent publication, #29451 chat projection, #29452 first-turn gate, #29453 context UI. Each layer builds and passes its tests on its own. The composed stack was validated end to end with remote UAT; the record is on #29453.
Why
The context usage indicator listed healthy servers and treated only non-
okrows as issues. With the discovery report it can now tell the user whether discovery is initializing, complete, complete but empty, usable with warnings, failed, or describes a previous agent run.Fix
ContextUsageIndicatorrenders fromchat.context.mcp_discoveryand the existing resource rows: an initializing line while the phase is pending, "Discovery complete. No MCP servers discovered." for an empty complete catalog, discovered servers with zero tools marked "(no tools)", warnings onokrows added to Issues without marking the server unavailable, failed servers labeledfailed, and a stale banner when the rows come from a previous agent run and tools are withheld. Long error text wraps inside the popover. Copy never claims live connectivity. The existingcontext_dirtyrefetch already drives updates, so no new fetches are added. Storybook stories cover each state plus an in-place update.Testing
Typecheck, biome, oxlint, the React Compiler check, and the Storybook tests for the component (17 stories, including the pre-first-snapshot pending state). The repository
frontend-reviewchecklist was applied to the diff.Remote UAT record (composed stack)
UAT ran remotely through Coder Agents against the branch tip with a nested deployment built from the exact commit, a real model, and a disposable stdio MCP fixture with planted secret sentinels. Chat: https://dogfood.cdr.dev/agents/7b13b4d7-55d0-435d-b76b-a47d6e37608a.
8884f7f53cf(branchmike/workspace-mcp-discovery): endorsed FAIL. A hung server delayed a healthy sibling's tools past the bounded wait; a bound chat lost its whole context display after a workspace restart with no interaction (root cause: the new chat GET path failed when the bound agent row was soft-deleted by the rebuild, confirmed with DB and log forensics); long error text broke the popover layout; failed servers were labeled with the raw status word. The data plane (redaction, config errors, zero-tool servers, reconnect warnings, withholding, plan-mode exclusion, tool-result embedding) held.a3d761da266(same branch, fixes applied): endorsed PASS. All four issues re-verified with browser evidence, plus regression checks (mixed working, broken, and unreachable servers with redaction; 12 s delayed sibling; 25 s sibling longer than the wait; always-error; removing.mcp.jsonwhile up; repeated identical reloads; create and start tool results; empty tools, no match, plan mode). Remaining findings were cosmetic; the stale banner wording was adjusted afterwards.Heads at the first Codex round differed from
a3d761da266by: the autosquash of the fix commits into their owning layers (tree preserving), one copy-only change to the stale banner text inContextUsageIndicator.tsx(Storybook tests re-run), and a rebase from6967259af4dontoc29116d4bc6(four unrelated main commits; sqlc regeneration produced no diff; targeted agent, agentapi, and chatd suites re-run green). Those changes were not exercised by live UAT. The Codex round 1 fixes (see each layer's review record) and the rebase onto9d97337are also unverified by live UAT; a follow-up UAT round is planned once the stack is otherwise clean.Remote UAT record
Review record
802f7fdd79: no findings (Codex Review: Didn't find any major issues). This layer then gained the context indicator sentence inextending-agents.md(moved from feat: gate first turns on current-run MCP discovery #29452) and one story.015fef82ea: no findings on015fef82ea; thetitlecheck then failed because the moved docs sentence sits outside the(site)scope, so the PR title dropped its scope (head unchanged).f9cd025a37: no findings onf9cd025a37.a58845980b: no findings ona58845980b.190f2322ca: no findings on190f2322ca.c56e317bc0: no findings onc56e317bc0.d9bad62950: no findings ond9bad62950.ce0c8110a3: pending.