Skip to content

refactor(server): make group the source of truth in ResourceManager - #3569

Merged
twishabansal merged 17 commits into
feat/groupsfrom
feat/groups-pr1b-wiring
Jul 14, 2026
Merged

refactor(server): make group the source of truth in ResourceManager#3569
twishabansal merged 17 commits into
feat/groupsfrom
feat/groups-pr1b-wiring

Conversation

@twishabansal

@twishabansal twishabansal commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Description

Makes internal/group the source of truth in ResourceManager and derives the tools.Toolset / prompts.Promptset views from it.

Stacked on #3488

twishabansal and others added 5 commits June 22, 2026 15:47
Introduce internal/group as the source of truth for a named collection of
tools and prompts. Group.Initialize reuses the toolset/promptset Initialize
logic; ToToolset/ToPromptset project the legacy views keyed by the group name.
No existing behavior changes yet.
Embed the initialized Toolset and Promptset in Group instead of
flattening their fields, so ToToolset/ToPromptset return the views
with their lookup sets intact rather than rebuilding them per call.
Replace the toolset/promptset maps with an authoritative groups map and
derive the toolset/promptset views from it via ToToolset/ToPromptset.
Legacy kind: toolsets configs convert to tools-only groups at init, and
the default nameless group holds all tools and prompts. No YAML surface
change; kind: groups parsing is deferred to a follow-up.
@twishabansal
twishabansal requested a review from a team as a code owner July 7, 2026 06:01

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the codebase to replace the separate legacy toolsets and promptsets configurations with a unified groups concept. The ResourceManager now stores a groups map as the source of truth, from which toolset and promptset views are dynamically derived. Consequently, configuration structures, initialization functions (such as InitializeConfigs and InitializeOfflineConfigs), and numerous unit and integration tests across the server and command-line packages have been updated to use groups. There are no review comments to address.

@NoClueMike NoClueMike 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.

Truth Works...

@twishabansal twishabansal added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jul 8, 2026
Comment thread internal/server/mcp/v20241105/method_test.go Outdated
Decouple Group from the legacy tools.Toolset/prompts.Promptset types per
review feedback. Group now keeps its own O(1) tool/prompt membership sets and
exposes ContainsTool/ContainsPrompt directly, instead of deriving and storing
full toolset/promptset views. Per-tool and per-prompt manifests are generated
on demand by callers from the resolved tools/prompts maps, so the group no
longer needs serverVersion at Initialize.
@twishabansal
twishabansal requested a review from Yuan325 July 10, 2026 13:13

@Yuan325 Yuan325 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you! LMK if you have more questions~

headsup, there's a PR (#3511) that update all internal/server/resources/* to internal/server/primitives/*. That change might cause alot of merge conflict with this PR~

Comment thread cmd/internal/skills/command.go Outdated
Comment thread internal/server/resources/resources.go
Comment thread internal/server/resources/resources_test.go Outdated
Comment thread internal/server/resources/resources_test.go
Comment thread internal/server/resources/resources_test.go
Comment thread internal/server/config.go Outdated
Comment thread internal/server/server.go Outdated
Comment thread internal/server/config.go Outdated
Comment thread internal/server/config.go
Comment thread internal/server/server_test.go Outdated
@Yuan325 Yuan325 assigned Yuan325 and unassigned duwenxin99 Jul 10, 2026
Base automatically changed from feat/groups-pr1-group-package to feat/groups July 13, 2026 03:55
@twishabansal

Copy link
Copy Markdown
Contributor Author

Thank you! LMK if you have more questions~

headsup, there's a PR (#3511) that update all internal/server/resources/* to internal/server/primitives/*. That change might cause alot of merge conflict with this PR~

Thank you for pointing this out. Currently I'm merging all the groups feat PRs into #3605. It will help us resolve any merge conflicts while also landing the complete feature in main at once. I will take care of any merge conflicts before merging the master PR: #3605

…3575)

## Description

Adds parsing for `kind: group` configuration documents and wires the
parsed groups through initialization. Groups are the source of truth
from which toolset and promptset views are derived; this PR lets users
declare them directly in config.

- `UnmarshalResourceConfig` now parses both flat (`kind: group`) and
nested (`groups:`) formats, returning a new `GroupConfigs` value.
- Validation: rejects duplicate default (nameless) or named groups, and
rejects a default group that declares `tools` or `prompts` (it always
contains all configured tools and prompts).
- `GroupConfigs` flows through config merge, dynamic reload, and
`initializeGroups`; a `kind: group` definition overrides a same-named
toolset (with a warning).
- Mechanically updated all `UnmarshalResourceConfig` call sites for the
new return arity.

Stacked on #3569

---------

Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
@twishabansal
twishabansal merged commit e91d2dc into feat/groups Jul 14, 2026
14 of 16 checks passed
@twishabansal twishabansal removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jul 14, 2026
@twishabansal
twishabansal deleted the feat/groups-pr1b-wiring branch July 14, 2026 05:36
@github-actions

Copy link
Copy Markdown
Contributor

🧨 Preview deployments removed.

Cloudflare Pages environments for pr-3569 have been deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants