fix: 同步工具审批过期状态
- 以条件更新避免过期任务覆盖并发人工审批 - 将过期结果同步到本地或远程运行节点 - 补充跨节点命令与过期任务回归测试
This commit is contained in:
@@ -13,5 +13,10 @@ public enum AgentRuntimeCommandAction {
|
||||
/**
|
||||
* 拒绝工具执行。
|
||||
*/
|
||||
REJECT
|
||||
REJECT,
|
||||
|
||||
/**
|
||||
* 审批过期并取消工具执行。
|
||||
*/
|
||||
EXPIRE
|
||||
}
|
||||
|
||||
@@ -90,6 +90,9 @@ public class AgentRuntimeCommandConsumer implements MQConsumerHandler {
|
||||
agentRunService.rejectRuntimeLocal(
|
||||
command.getRequestId(), command.getResumeToken(), command.getReason(),
|
||||
command.getOperatorId(), command.getUserId());
|
||||
} else if (command.getAction() == AgentRuntimeCommandAction.EXPIRE) {
|
||||
agentRunService.expireApprovalLocal(
|
||||
command.getRequestId(), command.getResumeToken(), command.getReason());
|
||||
} else {
|
||||
markFailureQuietly(command, new IllegalArgumentException("不支持的 Agent 远程运行命令"));
|
||||
LOG.warn("跳过不支持的 Agent 远程运行命令: messageId={}, commandId={}, action={}",
|
||||
|
||||
@@ -91,6 +91,21 @@ public class AgentRuntimeCommandProducer {
|
||||
sendAndWait(targetNodeId, requestId, resumeToken, AgentRuntimeCommandAction.REJECT, reason, operatorId, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 投递远程审批过期命令。
|
||||
*
|
||||
* @param targetNodeId 目标节点 ID
|
||||
* @param requestId 请求 ID
|
||||
* @param resumeToken 恢复令牌
|
||||
* @param reason 过期原因
|
||||
*/
|
||||
public void sendExpire(String targetNodeId,
|
||||
String requestId,
|
||||
String resumeToken,
|
||||
String reason) {
|
||||
sendAndWait(targetNodeId, requestId, resumeToken, AgentRuntimeCommandAction.EXPIRE, reason, null, null);
|
||||
}
|
||||
|
||||
private void sendAndWait(String targetNodeId,
|
||||
String requestId,
|
||||
String resumeToken,
|
||||
|
||||
Reference in New Issue
Block a user