feat(site/src): surface pinned chat workspace context in the UI - #26573
Merged
Conversation
Add the workspace-context indicator for agent chats. The popover lists
the chat's pinned context resources (instruction files, skills, and MCP
servers with their tools) and surfaces unusable resources with their
errors instead of dropping them silently. When the pinned context drifts
from the agent's latest snapshot, the ring shows a marker and a "Refresh
context" action re-pins the chat via
PUT /api/experimental/chats/{id}/context.
context_dirty watch events apply the lightweight dirty flags to the
cached chats and refetch the open chat so the full pinned detail loads.
Split from #26466; the context changes/diff view is deferred to a later
split.
sreya
approved these changes
Jun 22, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Adds the workspace-context indicator UI for agent chats, part of breaking the "Workspace Context Sources for Coder Agents" RFC (#26466) into small, reviewable PRs.
What this adds
PUT /api/experimental/chats/{id}/context.context_dirtywatch events apply the lightweight dirty flags across the cached chat lists and refetch the open chat so the full pinned detail loads.Not included
The context changes/diff view (the "View changes" affordance and its dialog) is intentionally deferred to a later split, so this PR contains no diff rendering.
Testing
pnpm lint(types, biome, circular deps, React Compiler, knip)pnpm test src/api/queries/chats.test.ts(cache-merge unit tests, including the newcontext_dirtycases)pnpm test:storybook src/pages/AgentsPage/components/ContextUsageIndicator.stories.tsx(4 stories)pnpm formatDesign notes
This is Split 3 of #26466. Split sequence:
codersdkcontext resource types (merged). During review the type was renamedChatContextMCPTool->ChatContextTooland the fieldmcp_tools->tools; this PR consumes those merged names.coder exp chat contextsource CRUD +refresh(next).changes,ChatContextResourceChange, the changes dialog, andbuildContentPatch) - last.Key decisions:
ChatWatchEventKindContextDirtyand exposes the refresh endpoint (feat: integrate agent context snapshots into chats #26389). Watch/pubsub payloads stay lightweight: they carry only thedirty/dirty_since/errorflags and omitresources. SomergeWatchedChatSummarymerges (not replaces) the cached context to preserve the pinnedresourcesa single-chat GET populated, and theAgentsPagewatch handler refetches only the open chat to pull the full pinned detail.resources; while they have not loaded it falls back to the agent'slast_injected_context, skipping the empty context-file placeholder so it never renders a nameless row.This PR was created by Coder Agents on behalf of @kylecarbs.