diff --git a/pipeline_service/agent_loop.py b/pipeline_service/agent_loop.py index 7310bd0..d544402 100644 --- a/pipeline_service/agent_loop.py +++ b/pipeline_service/agent_loop.py @@ -1026,7 +1026,8 @@ async def _build_role_skills_block(sor, project_id, role, org_id=""): if not merged: return "" skills = sorted(merged.values(), - key=lambda s: -SCOPE_PRIORITY.get(getattr(s, 'scope', ''), 0)) + key=lambda s: (-int(getattr(s, 'essential', False)), + -SCOPE_PRIORITY.get(getattr(s, 'scope', ''), 0))) lines = ["## 可用技能(目录,按需用 load_skill 加载全文;优先级 角色>项目>产线>组织>通用)"] for s in skills[:60]: tag = SCOPE_TAG.get(getattr(s, 'scope', ''), getattr(s, 'scope', ''))