Skip to content

fix(qa): WS 问答路径补传 user_dept/user_role,对齐 SSE(补完 2eb0e46) - #8

Merged
zhyese merged 1 commit into
zhyese:mainfrom
leaderwm:fix/ws-user-context-passthrough
Sep 4, 2026
Merged

fix(qa): WS 问答路径补传 user_dept/user_role,对齐 SSE(补完 2eb0e46)#8
zhyese merged 1 commit into
zhyese:mainfrom
leaderwm:fix/ws-user-context-passthrough

Conversation

@leaderwm

@leaderwm leaderwm commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

问题

2eb0e46 给 SSE 与 system/agent/run 补了用户上下文透传,但 WS 问答路径(routers/qa.pyanswer_ws)漏了 user_dept/user_role,导致:

  • WS agent 模式下角色门禁工具(create_ticket/submit_ticket/draft_ticket)因 ctx.role 为空恒被拒
  • user_dept/user_role=None 使 _acl_ok 直接放行,WS 路径文档级 dept/role ACL 不生效

改动

WS 分支调 qa_service.stream_answer 时补传 user_dept=user.dept, user_role=user.role(与 HTTP SSE 端点完全对齐,一行 + 注释)。

验证

  • python -m pytest tests/ -q --ignore=tests/test_api.py -m "not integration":828 passed(3 个失败为 main 上已存在的 test_batch3_infra openai SDK 环境差异,与本 PR 无关,已在未改动代码上复现确认)
  • python scripts/validate_golden.py 通过

2eb0e46 只给 SSE 与 system/agent/run 补了用户上下文,WS 漏传导致:
- agent 工具角色门禁(create_ticket/submit_ticket/draft_ticket)在 WS agent 模式因 ctx.role 为空恒被拒
- user_dept/user_role 为 None 时 _acl_ok 直接放行,WS 路径文档级 ACL 不生效
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants