feat: add high-risk paired plan gate

This commit is contained in:
Eyejoker
2026-03-29 02:12:28 +09:00
parent c76ed1d10a
commit b536c90716
9 changed files with 1288 additions and 20 deletions

View File

@@ -18,6 +18,8 @@ const REVIEWER_SNAPSHOT_STALE_BLOCK_MESSAGE =
'Review snapshot is stale after owner changes. Retry the review once to refresh against the latest owner workspace.';
const REVIEWER_SNAPSHOT_NOT_READY_BLOCK_MESSAGE =
'Review snapshot is not ready yet. Ask the owner to run /review (or /review-ready) after preparing changes.';
export const PLAN_REVIEW_REQUIRED_BLOCK_MESSAGE =
'Plan review is required before formal review for this high-risk task.';
const REVIEWER_SNAPSHOT_DENY_SEGMENTS = new Set([
'.git',
@@ -471,6 +473,14 @@ export interface PreparedReviewerWorkspace {
export function prepareReviewerWorkspaceForExecution(
task: PairedTask,
): PreparedReviewerWorkspace {
if (task.risk_level === 'high' && task.plan_status !== 'approved') {
return {
workspace: null,
autoRefreshed: false,
blockMessage: PLAN_REVIEW_REQUIRED_BLOCK_MESSAGE,
};
}
const ownerWorkspace = getPairedWorkspace(task.id, 'owner') ?? null;
if (!ownerWorkspace) {
return {