(url: URL)
| 466 | }; |
| 467 | |
| 468 | const getSemanticDiff = async (url: URL): Promise<SemanticDiffResponse> => { |
| 469 | // Semantic diff reads real files — wait out the checkout warmup in PR mode. |
| 470 | if (isPRMode && options.worktreePool) await ensurePRLocalCwd(); |
| 471 | const cwd = resolveSemanticDiffCwd(); |
| 472 | const fileExts = semanticDiffFileExtsFromSearchParams(url.searchParams); |
| 473 | const cacheKey = semanticDiffCacheKey({ rawPatch: currentPatch, cwd, fileExts }); |
| 474 | const cached = semanticDiffCache.get(cacheKey, currentPatch); |
| 475 | if (cached) return cached; |
| 476 | |
| 477 | const result = await runSemanticDiff( |
| 478 | { rawPatch: currentPatch, cwd, fileExts }, |
| 479 | createSemanticDiffRuntime(cwd), |
| 480 | ); |
| 481 | if (result.status === "ok") { |
| 482 | semanticDiffCache.set(cacheKey, currentPatch, result); |
| 483 | } else if (result.status === "error") { |
| 484 | // Cooldown-memoized: request rate (file badges remount on scroll) must |
| 485 | // not drive sem execution rate when it's failing. |
| 486 | semanticDiffCache.setFailure(cacheKey, currentPatch, result); |
| 487 | } |
| 488 | return result; |
| 489 | }; |
| 490 | |
| 491 | const agentJobs = createAgentJobHandler({ |
| 492 | mode: "review", |
no test coverage detected