From 032fd853ee42c473fbf8d7c2d2605e1e34f73309 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sat, 29 Aug 2026 15:00:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20agent=5Fmenus=E4=BA=A7=E7=BA=BF=E9=9A=94?= =?UTF-8?q?=E7=A6=BB=E2=80=94=E2=80=94=E8=B7=A8=E4=BA=A7=E7=BA=BF=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=B8=8D=E5=8A=AB=E6=8C=81=E6=9C=AC=E4=BA=A7=E7=BA=BF?= =?UTF-8?q?=E8=8F=9C=E5=8D=95;=20=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=B8=A6=E4=BA=A7=E7=BA=BF=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/api/agent_menus.dspy | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/wwwroot/api/agent_menus.dspy b/wwwroot/api/agent_menus.dspy index aadfe31..f170453 100644 --- a/wwwroot/api/agent_menus.dspy +++ b/wwwroot/api/agent_menus.dspy @@ -16,6 +16,8 @@ default_pipeline_id = (params_kw or {}).get('pipeline_id', '') or '' # 1. 解析当前产线:当前会话项目 → sd_projects.pipeline_id # 统一走 get_session_project_id(含悬空引用防护:指向已删除项目的记录自愈清理并回退全局)。 # 禁止在此重复实现 session→项目解析——多份实现语义漂移正是「会话有项目、入口说没有」的根因。 +# 产线隔离:入口指定产线(如商机/投标)时,会话项目必须同产线才生效—— +# 否则残留的跨产线项目(如开发产线的元景项目)会劫持本产线菜单/工作空间。 pipeline_id = '' pid = '' try: @@ -28,6 +30,10 @@ try: "SELECT pipeline_id FROM sd_projects WHERE id=${p}$", {"p": pid}) if precs: pipeline_id = getattr(precs[0], 'pipeline_id', '') or '' + if default_pipeline_id and pipeline_id != default_pipeline_id: + # 跨产线项目劫持:清空项目,用入口产线 + pid = '' + pipeline_id = default_pipeline_id except Exception: pass @@ -70,9 +76,15 @@ def _bind(url, require_project): } # 固定「工作空间」按钮(通用能力,所有 agent 都有;依赖当前项目) +# 带产线参数:入口产线与会话项目跨产线时视为无项目(产线隔离) _ws_url = entire_url("/pipeline-sdlc/api/workspace_popup.dspy") +_ws_q = [] if session_id: - _ws_url += "?session_id=" + session_id + _ws_q.append("session_id=" + session_id) +if pipeline_id: + _ws_q.append("pipeline_id=" + pipeline_id) +if _ws_q: + _ws_url += "?" + "&".join(_ws_q) buttons.append({ "widgettype": "Button", "options": {"label": "🗂 工作空间", "css": "small", "id": "menu_btn_ws"},