From b56ccd3839d1aa952b854cfe6fc745770f19133a Mon Sep 17 00:00:00 2001 From: Joshua Wilshere Date: Mon, 21 Sep 2026 23:32:04 +0000 Subject: [PATCH] Fix collaborative prompts without explicit AI targets Route ordinary non-empty prompts in shared conversations through the collaborative AI streaming workflow instead of the human-only message endpoint. Add regression coverage, update version 0.261.040, and clarify the collaboration fix documentation and release notes. --- application/single_app/config.py | 2 +- .../single_app/static/js/chat/chat-messages.js | 5 ++++- .../fixes/COLLABORATION_SHARED_AI_WORKFLOW_FIX.md | 12 ++++++++++-- docs/explanation/release_notes.md | 9 +++++++++ .../test_collaboration_shared_ai_workflow.py | 5 +++-- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/application/single_app/config.py b/application/single_app/config.py index 892520372..ddf9ef5fb 100644 --- a/application/single_app/config.py +++ b/application/single_app/config.py @@ -98,7 +98,7 @@ EXECUTOR_TYPE = 'thread' EXECUTOR_MAX_WORKERS = 30 SESSION_TYPE = 'filesystem' -VERSION = "0.261.039" +VERSION = "0.261.040" IS_DEVELOPMENT = is_development_env_enabled() # Opt-out for deployments where App Service Easy Auth is active but the platform diff --git a/application/single_app/static/js/chat/chat-messages.js b/application/single_app/static/js/chat/chat-messages.js index 61b006015..b6062004a 100644 --- a/application/single_app/static/js/chat/chat-messages.js +++ b/application/single_app/static/js/chat/chat-messages.js @@ -7392,7 +7392,10 @@ export function buildCollaborativeInvocationTarget(messageData = {}, explicitInv } export function shouldUseCollaborativeAiWorkflow(messageData = {}, explicitInvocationTarget = null) { - return Boolean(buildCollaborativeInvocationTarget(messageData, explicitInvocationTarget)); + return Boolean( + buildCollaborativeInvocationTarget(messageData, explicitInvocationTarget) + || String(messageData.message || '').trim() + ); } function buildVoiceResponseCompletionHandler(responseModality) { diff --git a/docs/explanation/fixes/COLLABORATION_SHARED_AI_WORKFLOW_FIX.md b/docs/explanation/fixes/COLLABORATION_SHARED_AI_WORKFLOW_FIX.md index c67cfd8ff..33d4f6eec 100644 --- a/docs/explanation/fixes/COLLABORATION_SHARED_AI_WORKFLOW_FIX.md +++ b/docs/explanation/fixes/COLLABORATION_SHARED_AI_WORKFLOW_FIX.md @@ -1,10 +1,13 @@ # Collaboration Shared AI Workflow Fix -Fixed/Implemented in version: **0.241.021** +Original implementation: **0.241.021** +Plain-prompt coverage completed in: **0.261.040** ## Overview -Collaborative conversations were still posting plain shared messages even when the chat toolbar had an active workspace search, web search, image generation, prompt, or agent selection. That meant shared conversations did not enter the same model and agent workflow that single-user chat already uses. +The original collaborative AI implementation added a shared streaming route and correctly covered prompts with an active workspace search, web search, image generation, prompt, agent selection, or explicit model target. It did not cover ordinary prompts with none of those triggers. + +That uncovered case meant an ordinary prompt after inviting participants followed the human-only shared-message path. It was persisted successfully but never invoked the model. This was a missing-case follow-up to the original implementation, not a confirmed rollback of the entire collaboration AI workflow. The shared composer also did not provide an explicit way to target a model without turning on a tool. Users could tag participants, but they could not tag an available model or agent as a first-class AI target in the same shared conversation. @@ -14,6 +17,8 @@ The collaboration composer only posted to the shared message endpoint with messa On the frontend, the `@` suggestion menu was limited to human participants and invite suggestions. Because explicit `@model` and `@agent` tags were never parsed into `ai_invocation_target` metadata, a no-tool shared send still fell back to a plain collaborative message instead of the AI streaming path. +The follow-up defect was in the routing predicate: it only selected the AI stream when `buildCollaborativeInvocationTarget()` found a tool, workspace, prompt, agent, image, or explicit AI target. A normal non-empty message produced no invocation target and was sent to the human-only endpoint. + ## What Changed - Added a collaborative streaming route that saves the shared AI request, proxies the existing `/api/chat/stream` workflow against a hidden backing source conversation, and mirrors the final assistant or image response back into the collaboration message store. @@ -23,6 +28,7 @@ On the frontend, the `@` suggestion menu was limited to human participants and i - Added collaboration-side rendering support for mirrored image responses. - Extended the collaboration `@` suggestion menu so it now surfaces available agents and available models alongside participant tags and invite suggestions. - Added explicit `@agent` and `@model` parsing so shared sends can target AI without selecting a toolbar tool, and the raw `@target` text is stripped from the final message body in favor of a structured chip. +- Routed every non-empty collaborative prompt through the AI stream by default, while retaining invocation metadata for tool, agent, model, and workspace-targeted requests. - Split shared chip styling so participant mentions, agent targets, and model targets render with different background colors. - Updated the streaming chat bridge so explicit tagged-agent requests stamp `agent_selection` and the actual resolved model onto the hidden source user message metadata, which keeps shared user-message detail panels aligned with the assistant response. - Synced source conversation tags and context metadata back into the collaborative conversation record after streaming completes so shared conversation details reflect the resolved agent and actual model used. @@ -36,6 +42,7 @@ On the frontend, the `@` suggestion menu was limited to human participants and i - `application/single_app/static/js/chat/chat-streaming.js` - `application/single_app/static/css/chats.css` - `application/single_app/config.py` +- `functional_tests/test_collaboration_shared_ai_workflow.py` ## Validation @@ -46,6 +53,7 @@ On the frontend, the `@` suggestion menu was limited to human participants and i ## User Impact - Shared workspace and web requests now enter the same model or agent workflow as single-user chat. +- Ordinary prompts sent after inviting participants now receive model responses instead of becoming human-only shared messages. - Shared image requests now route to image generation and mirror the resulting image back into the collaboration conversation. - Shared AI requests now display an explicit target chip instead of silently acting like a plain participant message. - Shared conversation authors can now type `@Default Agent` or `@gpt-5.4` to direct a message to an agent or model without selecting a tool first. diff --git a/docs/explanation/release_notes.md b/docs/explanation/release_notes.md index 40bc4428d..aa80dae2b 100644 --- a/docs/explanation/release_notes.md +++ b/docs/explanation/release_notes.md @@ -2,6 +2,15 @@ For feature-focused and fix-focused drill-downs by version, see [Features by Version](https://github.com/microsoft/simplechat/tree/main/docs/explanation/features) and [Fixes by Version](https://github.com/microsoft/simplechat/tree/main/docs/explanation/fixes). +### **(v0.261.040)** + +#### Bug Fixes + +* **Collaborative Prompts Now Receive Model Responses** + * Fixed ordinary prompts in conversations shared through **Invite Participants** being saved as human-only messages without invoking the model. + * All non-empty collaborative prompts now use the shared AI streaming workflow, while preserving explicit agent, model, workspace, and tool targeting. + * (Ref: `chat-messages.js`, `chat-collaboration.js`, [Collaboration Shared AI Workflow Fix](fixes/COLLABORATION_SHARED_AI_WORKFLOW_FIX.md)) + ### **(v0.261.030)** #### Bug Fixes diff --git a/functional_tests/test_collaboration_shared_ai_workflow.py b/functional_tests/test_collaboration_shared_ai_workflow.py index 52105c87b..4d32e5cc2 100644 --- a/functional_tests/test_collaboration_shared_ai_workflow.py +++ b/functional_tests/test_collaboration_shared_ai_workflow.py @@ -2,8 +2,8 @@ # test_collaboration_shared_ai_workflow.py """ Functional test for collaboration shared AI workflow parity. -Version: 0.250.224 -Implemented in: 0.241.068 +Version: 0.261.040 +Implemented in: 0.261.040 This test ensures collaborative conversations route shared AI requests through the collaboration stream bridge, persist explicit AI-request metadata, and @@ -53,6 +53,7 @@ def test_frontend_collaboration_stream_wiring(): assert 'export function getCollaborativeTagSuggestions(' in messages_source assert 'export function buildCollaborativeInvocationTarget(' in messages_source assert 'export function shouldUseCollaborativeAiWorkflow(' in messages_source + assert "|| String(messageData.message || '').trim()" in messages_source assert 'function buildCollaborativeSendContext(' in messages_source assert "source_mode: 'explicit_tag'" in messages_source assert 'stripExplicitCollaborativeTargetText(' in messages_source