feat: enhance review process and role management

- Refactor reviewPass function to identify states with review checks instead of specific review types.
- Introduce review policies (HUMAN, AGENT, AUTO) to control PR review processes based on developer levels.
- Update projectTick to handle review policies and step routing labels for reviewers and testers.
- Add detailed reviewer instructions to templates for clarity on review responsibilities.
- Implement role:level label management, allowing dynamic creation of labels based on project configuration.
- Enhance task_update tool to support state and level updates, ensuring at least one parameter is provided.
- Update work_finish tool to include reviewer actions (approve, reject) in task completion.
- Modify work_start tool to utilize role-level detection for better level assignment.
- Add tests for new functionalities, including review routing and level detection from labels.
This commit is contained in:
Lauren ten Hoor
2026-02-16 18:09:53 +08:00
parent 1464fa82d2
commit d87b9f68a2
25 changed files with 1134 additions and 294 deletions

View File

@@ -6,6 +6,7 @@
* Event types:
* - workerStart: Worker spawned/resumed for a task (→ project group)
* - workerComplete: Worker completed task (→ project group)
* - reviewNeeded: Issue needs review — human or agent (→ project group)
*/
import { log as auditLog } from "./audit.js";
import type { PluginRuntime } from "openclaw/plugin-sdk";
@@ -35,6 +36,16 @@ export type NotifyEvent =
result: "done" | "pass" | "fail" | "refine" | "blocked";
summary?: string;
nextState?: string;
}
| {
type: "reviewNeeded";
project: string;
groupId: string;
issueId: number;
issueUrl: string;
issueTitle: string;
routing: "human" | "agent";
prUrl?: string;
};
/**
@@ -74,6 +85,15 @@ function buildMessage(event: NotifyEvent): string {
msg += `\n🔗 ${event.issueUrl}`;
return msg;
}
case "reviewNeeded": {
const icon = event.routing === "human" ? "👀" : "🤖";
const who = event.routing === "human" ? "Human review needed" : "Agent review queued";
let msg = `${icon} ${who} for #${event.issueId}: ${event.issueTitle}`;
if (event.prUrl) msg += `\n🔗 PR: ${event.prUrl}`;
msg += `\n📋 Issue: ${event.issueUrl}`;
return msg;
}
}
}