microsoft / microsoft/simplechat

Bug: scope collaborative @ suggestions to active Models or Agents mode

Open
#935 0 comments 0 reactions 1 assignee Claimed by @paullizer View on GitHub
bug
Dominant language
Python
Stars
152
Forks
116
Avg merge
7h 7m
Merged PRs (30d)
122

Description

## Summary

The collaborative chat `@` menu currently offers both agent targets and model targets regardless of whether the user is in Models mode or Agents mode. That lets users insert an inactive-mode target: for example, while the toolbar is showing Models, the mention menu can still offer agents, but the selected agent may not respond unless the user has toggled Agents on. The inverse can happen for model mentions while Agents mode is active.

## Observed behavior

- In Models mode, typing `@` can show agent suggestions.
- Selecting an agent from the `@` menu can produce a visible agent invocation chip, but the backend/chat flow only behaves as expected when Agents mode is enabled.
- In Agents mode, model suggestions are still available even though the model selector is hidden.

## Expected behavior

The `@` UI should only offer explicit AI invocation targets that match the currently selected toolbar mode:

- Models mode: show model targets only.
- Agents mode: show agent targets only.
- Participant/collaborator mentions should continue to work as they do today.

## Code context

Likely frontend control path:

- `application/single_app/static/js/chat/chat-collaboration.js`
- `loadMentionSuggestions()` merges participant suggestions with `getCollaborativeTagSuggestions(query)`.
- `application/single_app/static/js/chat/chat-messages.js`
- `getCollaborativeTagSuggestions()` currently returns both `getAvailableCollaborativeAgentTargets()` and `getAvailableCollaborativeModelTargets()`.
- `getAvailableCollaborativeAgentTargets()` reads from `#agent-select` even when `#agent-select-container` is hidden.
- `getAvailableCollaborativeModelTargets()` reads from `#model-select` even when `#model-select-container` is hidden.
- `application/single_app/static/js/chat/chat-agents.js`
- `areAgentsEnabled()` already exposes the active Agents toggle state.
- `initializeAgentInteractions()` toggles `#agent-select-container` and `#model-select-container` visibility.

Because the mention suggestions are sourced from hidden selects instead of the active mode, they can expose targets that the current toolbar mode does not support.

## Suggested fix

Make `getCollaborativeTagSuggestions()` mode-aware, probably by using the same source of truth as the toolbar toggle:

- If Agents are enabled, return agent targets only.
- If Agents are disabled, return model targets only.
- Preserve collaborator/participant `@` suggestions from `chat-collaboration.js`.

If importing `areAgentsEnabled()` into `chat-messages.js` would create an undesirable dependency, derive the active mode from stable DOM state such as the active class on `#enable-agents-btn` or visibility/state of the model/agent selector containers.

## Acceptance criteria

- In Models mode, the `@` menu does not show agent targets such as `@researcher` or `@msgraphagent`.
- In Agents mode, the `@` menu does not show model targets.
- Existing participant/collaborator mentions remain available in both modes.
- Selecting an `@` target from the menu always routes to a target that can respond under the current mode.
- Add/extend frontend functional coverage around `getCollaborativeTagSuggestions()` or the mention menu wiring.

## Regression test ideas

- Seed model and agent options in the DOM, toggle Agents off, assert the collaborative tag suggestions include models and exclude agents.
- Toggle Agents on, assert suggestions include agents and exclude models.
- Keep participant mention suggestions independent of the AI target filtering.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.