fix: agent_menus产线隔离——跨产线项目不劫持本产线菜单; 工作空间按钮带产线参数
This commit is contained in:
parent
b0f08e83fb
commit
032fd853ee
@ -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"},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user