Skip to content

feat(site/src/pages/AgentsPage): group context indicator resources by directory#26598

Merged
kylecarbs merged 1 commit into
mainfrom
kylecarbs/context-indicator-grouping
Jun 23, 2026
Merged

feat(site/src/pages/AgentsPage): group context indicator resources by directory#26598
kylecarbs merged 1 commit into
mainfrom
kylecarbs/context-indicator-grouping

Conversation

@kylecarbs

Copy link
Copy Markdown
Member

What

Groups the Skills and Context files lists in the context-usage popover (ContextUsageIndicator) by their parent directory. Resources pulled from different roots, for example a repo-root AGENTS.md and a nested site/AGENTS.md, or same-named skills from .coder/skills vs .agents/skills, previously collapsed to identical basenames and lost their provenance. Each group now renders a dimmed directory header with a folder icon, and its items are indented beneath it.

Why

ChatContextResource.source carries the real path for instruction files and skill directories, but the popover only rendered the basename, so multiple context roots were indistinguishable.

Notes

  • The directory header shows even for a single root, so provenance is always visible.
  • MCP is intentionally left flat for now: an mcp_server's source is a server name (not a path) and the row carries no reference to the mcp_config that declared it, so it does not fit the directory model without a backend change.
  • Adds a getPathDirname helper (with tests) and switches the skill list key from skill.name to skill.source to avoid collisions across roots.

Test plan

  • ContextUsageIndicator.stories.tsx: new MultipleContextRoots story (files + skills across several directories); Clean story updated to assert the single-root header. Storybook play tests pass (4/4).
  • path.test.ts: added getPathDirname cases (unit pass).
  • biome check, tsc -p ., and make pre-commit all pass.
Design decision log
  • Header gating: started by only showing the directory header when a section spanned more than one directory; changed to always show because the provenance is useful even for a single root.
  • Presentation: chose a grouped layout (dimmed directory header + folder icon, items indented beneath) over an inline dimmed path prefix, since there is typically a lot of shared structure to convey.
  • Directory labels currently render the full path (dimmed, truncated with a title tooltip). Open follow-ups: collapse $HOME to ~ or show fewer path segments if the labels feel long.
  • MCP: evaluated applying the same grouping. An mcp_server is keyed by name and has no link to its mcp_config (confirmed in codersdk.ChatContextResource and the pinnedContextResources builder), so grouping servers under a config would require a backend data change. Left flat for this PR.

🤖 This PR was created by Coder Agents on behalf of @kylecarbs.

… directory

Group the Skills and Context files lists in the context usage popover by
their parent directory so resources pulled from different roots (for
example a repo-root AGENTS.md and a nested one, or same-named skills from
different skill roots) stay distinguishable instead of collapsing to
identical basenames. Each group renders a dimmed directory header with a
folder icon.

Add a getPathDirname helper (with tests) and a MultipleContextRoots story
covering files and skills spanning several directories.
@kylecarbs kylecarbs marked this pull request as ready for review June 23, 2026 03:39
@kylecarbs kylecarbs merged commit 688ee63 into main Jun 23, 2026
58 of 59 checks passed
@kylecarbs kylecarbs deleted the kylecarbs/context-indicator-grouping branch June 23, 2026 03:39
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 23, 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