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

@@ -10,6 +10,7 @@ import { runCommand } from "../run-command.js";
import { notify, getNotificationConfig } from "../notify.js";
import { log as auditLog } from "../audit.js";
import { loadConfig } from "../config/index.js";
import { detectStepRouting } from "./queue-scan.js";
import {
DEFAULT_WORKFLOW,
Action,
@@ -146,6 +147,36 @@ export async function executeCompletion(opts: {
}
}
// Send review routing notification when developer completes
if (role === "developer" && result === "done") {
// Re-fetch issue to get labels after transition
const updated = await provider.getIssue(issueId);
const routing = detectStepRouting(updated.labels, "review") as "human" | "agent" | null;
if (routing === "human" || routing === "agent") {
notify(
{
type: "reviewNeeded",
project: projectName,
groupId,
issueId,
issueUrl: updated.web_url,
issueTitle: updated.title,
routing,
prUrl,
},
{
workspaceDir,
config: notifyConfig,
groupId,
channel: channel ?? "telegram",
runtime,
},
).catch((err) => {
auditLog(workspaceDir, "pipeline_warning", { step: "reviewNotify", issue: issueId, role, error: (err as Error).message ?? String(err) }).catch(() => {});
});
}
}
// Build announcement using workflow-derived emoji
const emoji = getCompletionEmoji(role, result);
const label = key.replace(":", " ").toUpperCase();