microsoft / microsoft/simplechat
Add configurable Workspace Search result-count controls for admins, agents, and chat users
@paullizer is already working on this.
Since Jun 26, 2026.
- Dominant language
- Python
- Stars
- 153
- Forks
- 116
- Avg merge
- 7h 7m
- Merged PRs (30d)
- 122
Description
Summary
Add configurable Workspace Search result-count controls so admins can define the default retrieval breadth and optionally allow assigned-knowledge agents and chat users to override it. In normal chat, users can open a compact control in the Grounded Search panel and choose a persistent personal default from 5 to 100 results.
User Value
Different searches need different retrieval breadth. A focused lookup may need only a few chunks, while broad discovery may benefit from many more. Admins need a bounded policy that manages latency and token usage, and users need a quick way to tune normal Workspace Search without repeating instructions or changing the value for every new conversation.
Proposed Behavior
Admin Settings
- Add a new Chat tab in Admin Settings for chat-specific policies and controls.
- Add a Workspace Search default result-count setting bounded from 5 to 100.
- Add an independent enable/disable setting that determines whether users may set a personal Workspace Search result count.
- Retain a separate policy controlling whether assigned-knowledge agents may override the admin default.
- When user overrides are disabled, hide the user control and enforce the admin default server-side.
Chat Experience
- Add a compact icon button to the Grounded Search controls. Clicking it opens an accessible popover containing a slider and the selected numeric value.
- Show and apply the control only when the Action selection is Search.
- Do not show or apply this value to Analyze or Compare actions.
- Do not apply this setting to Web Search, URL access, Source Review/deep research, or unrelated search surfaces.
- Bound the slider to integer values from 5 through 100.
- Initialize the control from the user's saved preference when one exists; otherwise use the admin default.
- Persist changes in the user's settings so the selected value becomes that user's default for normal Workspace Search in the current and future conversations.
- Allow the user to move the slider before later searches and provide a clear way to reset the personal preference to the current admin default.
- Label the setting as a maximum retrieval count because fewer results may be available after access filtering, relevance ranking, and deduplication.
Retrieval and Policy Enforcement
- Send the effective result count with normal Workspace Search requests and apply it to the centralized
top_nretrieval path. - Treat admin policy as authoritative: validate values server-side, ignore unauthorized overrides, and constrain malformed or stale saved preferences to the current 5-100 range.
- Include the effective result count in search cache identity so results cached under one limit are not reused for another.
- For normal non-agent Workspace Search, use this precedence: allowed user preference, then admin default.
- Keep assigned-knowledge agent overrides separate from the normal chat preference; when agent retrieval is active, use the allowed per-agent value or the admin default according to the agent policy.
- Existing users without a saved preference inherit the current admin default without migration or failures.
Acceptance Criteria
- Admin Settings includes a new Chat tab with a 5-100 Workspace Search default and a user-override enable/disable setting.
- Admins can enable or disable assigned-knowledge agent overrides independently from chat user overrides.
- When user overrides are enabled and Search is selected, Chat exposes an accessible icon-triggered slider showing the active value from 5 through 100.
- The control is hidden or inactive for Analyze and Compare, and its value does not affect those actions.
- The setting affects normal Workspace Search only and does not alter Web Search, URL access, Source Review/deep research, or unrelated retrieval paths.
- A user's selection is saved as a user preference and becomes their default across conversations and sessions.
- Users can change the preference at any time and reset it to the current admin default.
- Disabling user overrides hides the control and causes the server to use the admin default regardless of client-supplied or previously saved values.
- Server-side validation enforces authorization and the 5-100 range, including after an admin changes the configured bounds or default.
- The effective value reaches the centralized Workspace Search
top_npath and participates in cache identity. - Assigned-knowledge agent behavior remains isolated and follows its separately configured override policy.
- Functional and UI tests cover admin settings, Search-only visibility, user persistence, reset behavior, disabled policy, request tampering, bounds, retrieval propagation, and cache separation.
Notes
- The current local retrieval anchor is
application/single_app/functions_search.py, whereSEARCH_DEFAULT_TOP_N = 12,SEARCH_MAX_TOP_N = 500, andnormalize_search_top_n()centralize existing defaults and bounds. - The normal Search/Analyze/Compare selector lives in the Grounded Search panel in
application/single_app/templates/chats.html; request construction is handled inapplication/single_app/static/js/chat/chat-messages.js. - User-level persistence can use the existing user settings store rather than conversation metadata because this selection is intended to follow the user into future conversations.
- Assigned knowledge configuration remains in
application/single_app/templates/_agent_modal.htmlandapplication/single_app/static/js/agent_modal_stepper.js.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.