fix(qa): WS 问答路径补传 user_dept/user_role,对齐 SSE(补完 2eb0e46) - #8
Merged
Merged
Conversation
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 不生效
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
2eb0e46 给 SSE 与 system/agent/run 补了用户上下文透传,但 WS 问答路径(
routers/qa.py的answer_ws)漏了user_dept/user_role,导致: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通过