fix(task_capability): claim_task 查询用原样 role(兼容存量裸名),审计记录用规范名 agent.{role}
This commit is contained in:
parent
3687270ca7
commit
7673a7acdf
@ -76,7 +76,7 @@ async def claim_task(tenant_id, role, agent_id, from_state=S_SUBMITTED,
|
|||||||
|
|
||||||
返回 (ok, task_id_or_message)。
|
返回 (ok, task_id_or_message)。
|
||||||
"""
|
"""
|
||||||
role = _normalize_role(role)
|
role_norm = _normalize_role(role) # 审计记录用规范名;查询用原样(兼容存量裸名数据)
|
||||||
db, dbname = _get_db()
|
db, dbname = _get_db()
|
||||||
async with db.sqlorContext(dbname) as sor:
|
async with db.sqlorContext(dbname) as sor:
|
||||||
claim_token = agent_id or getID()
|
claim_token = agent_id or getID()
|
||||||
@ -100,7 +100,7 @@ async def claim_task(tenant_id, role, agent_id, from_state=S_SUBMITTED,
|
|||||||
return False, "认领竞争失败(已被他人认领)"
|
return False, "认领竞争失败(已被他人认领)"
|
||||||
await record_audit(tenant_id, 'pipeline_tasks', task_id, 'claim',
|
await record_audit(tenant_id, 'pipeline_tasks', task_id, 'claim',
|
||||||
from_state=from_state, to_state=to_state,
|
from_state=from_state, to_state=to_state,
|
||||||
who=role, agent_id=agent_id, sor=sor)
|
who=role_norm, agent_id=agent_id, sor=sor)
|
||||||
return True, task_id
|
return True, task_id
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user