MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / startReview

Function startReview

projects/openade-module/src/node.ts:419–570  ·  view source on GitHub ↗
(params: OpenADEReviewStartRequest, context?: { runtimeId?: string })

Source from the content-addressed store, hash-verified

417 }
418
419 async function startReview(params: OpenADEReviewStartRequest, context?: { runtimeId?: string }): Promise<{ taskId: string; eventId: string }> {
420 const task = await projection.readTask(params.repoId, params.taskId)
421 const project = (await projection.readProjects()).find((candidate) => candidate.id === params.repoId)
422 if (!project) throw new Error(`Repository ${params.repoId} not found`)
423
424 const latestPlan = latestCompletedPlanEvent(task.events)
425 const latestPlanHarnessId = actionHarnessId(latestPlan, params.harnessId)
426 const planText = latestPlan ? (extractOpenADEPlanText(executionEvents(latestPlan), latestPlanHarnessId) ?? "") : ""
427 const threadXml = taskReviewThreadXml(task)
428 const changedFiles = recentSnapshotFiles(task)
429 const reviewPrompt =
430 params.reviewType === "plan"
431 ? buildOpenADEPlanReviewPrompt({
432 threadXml,
433 planText,
434 changedFiles,
435 customInstructions: params.customInstructions,
436 })
437 : buildOpenADEWorkReviewPrompt({
438 threadXml,
439 changedFiles,
440 customInstructions: params.customInstructions,
441 })
442
443 const userLabel = params.reviewType === "plan" ? "Review Plan" : "Review"
444 const reviewDisplayInput = params.customInstructions?.trim() ? `${userLabel}: ${params.customInstructions.trim()}` : userLabel
445 const executionId = executionIdForTask(params.taskId)
446 const action = await writer.createActionEvent({
447 taskId: params.taskId,
448 userInput: reviewDisplayInput,
449 executionId,
450 harnessId: params.harnessId,
451 source: {
452 type: "review",
453 userLabel,
454 reviewType: params.reviewType,
455 userInstructions: params.customInstructions,
456 },
457 includesCommentIds: [],
458 modelId: params.modelId,
459 })
460
461 const runtimeId = context?.runtimeId ?? `openade-review:${params.taskId}`
462 if (server) {
463 const runtimePatch = {
464 status: "running" as const,
465 scope: {
466 ownerType: "openade-task",
467 ownerId: params.taskId,
468 repoPath: project.path,
469 rootPath: project.path,
470 labels: {
471 eventId: action.eventId,
472 executionId,
473 },
474 },
475 nativeId: executionId,
476 }

Callers

nothing calls this directly

Calls 15

extractOpenADEPlanTextFunction · 0.90
buildOpenADEPromptFunction · 0.90
actionHarnessIdFunction · 0.85
executionEventsFunction · 0.85
notifyWorkingTasksFunction · 0.85
notifyTaskChangedFunction · 0.85
runHeadlessTurnFunction · 0.85
createMethod · 0.80
notifyMethod · 0.80

Tested by

no test coverage detected