feat(changes): pass opencode evidence mode

This commit is contained in:
777genius 2026-04-28 17:57:01 +03:00
parent 051bfe2319
commit 8da5b7f25d
4 changed files with 21 additions and 0 deletions

View file

@ -46,6 +46,7 @@ import type { AgentChangeSet, ChangeStats, TaskChangeSetV2 } from '@shared/types
const logger = createLogger('Service:ChangeExtractorService'); const logger = createLogger('Service:ChangeExtractorService');
const OPEN_CODE_AUTO_BACKFILL_ATTRIBUTION_MODE = 'strict-delivery' as const; const OPEN_CODE_AUTO_BACKFILL_ATTRIBUTION_MODE = 'strict-delivery' as const;
const OPEN_CODE_AUTO_BACKFILL_EVIDENCE_MODE = 'chain-only' as const;
const OPEN_CODE_MAX_DISCOVERED_LANES = 500; const OPEN_CODE_MAX_DISCOVERED_LANES = 500;
/** Кеш-запись: данные + mtime файла + время протухания */ /** Кеш-запись: данные + mtime файла + время протухания */
@ -425,6 +426,7 @@ export class ChangeExtractorService {
sourceGeneration, sourceGeneration,
deliveryContextFingerprint, deliveryContextFingerprint,
attributionMode: OPEN_CODE_AUTO_BACKFILL_ATTRIBUTION_MODE, attributionMode: OPEN_CODE_AUTO_BACKFILL_ATTRIBUTION_MODE,
evidenceMode: OPEN_CODE_AUTO_BACKFILL_EVIDENCE_MODE,
}); });
const now = Date.now(); const now = Date.now();
const cached = this.openCodeBackfillCache.get(cacheKey); const cached = this.openCodeBackfillCache.get(cacheKey);
@ -499,6 +501,7 @@ export class ChangeExtractorService {
projectDir, projectDir,
workspaceRoot, workspaceRoot,
attributionMode: OPEN_CODE_AUTO_BACKFILL_ATTRIBUTION_MODE, attributionMode: OPEN_CODE_AUTO_BACKFILL_ATTRIBUTION_MODE,
evidenceMode: OPEN_CODE_AUTO_BACKFILL_EVIDENCE_MODE,
...(deliveryContext.filePath ? { deliveryContextPath: deliveryContext.filePath } : {}), ...(deliveryContext.filePath ? { deliveryContextPath: deliveryContext.filePath } : {}),
}); });
void appendOpenCodeTaskChangeDiag({ void appendOpenCodeTaskChangeDiag({
@ -838,6 +841,7 @@ export class ChangeExtractorService {
sourceGeneration?: string | null; sourceGeneration?: string | null;
deliveryContextFingerprint: string; deliveryContextFingerprint: string;
attributionMode: typeof OPEN_CODE_AUTO_BACKFILL_ATTRIBUTION_MODE; attributionMode: typeof OPEN_CODE_AUTO_BACKFILL_ATTRIBUTION_MODE;
evidenceMode: typeof OPEN_CODE_AUTO_BACKFILL_EVIDENCE_MODE;
}): string { }): string {
return JSON.stringify({ return JSON.stringify({
teamName: input.teamName, teamName: input.teamName,
@ -848,6 +852,7 @@ export class ChangeExtractorService {
sourceGeneration: input.sourceGeneration ?? '', sourceGeneration: input.sourceGeneration ?? '',
deliveryContextFingerprint: input.deliveryContextFingerprint, deliveryContextFingerprint: input.deliveryContextFingerprint,
attributionMode: input.attributionMode, attributionMode: input.attributionMode,
evidenceMode: input.evidenceMode,
}); });
} }

View file

@ -240,10 +240,17 @@ export interface OpenCodeBackfillTaskLedgerCommandBody {
workspaceRoot?: string; workspaceRoot?: string;
deliveryContextPath?: string; deliveryContextPath?: string;
attributionMode?: OpenCodeBackfillTaskLedgerAttributionMode; attributionMode?: OpenCodeBackfillTaskLedgerAttributionMode;
evidenceMode?: OpenCodeBackfillTaskLedgerEvidenceMode;
dryRun?: boolean; dryRun?: boolean;
} }
export type OpenCodeBackfillTaskLedgerAttributionMode = 'strict-delivery' | 'compatible'; export type OpenCodeBackfillTaskLedgerAttributionMode = 'strict-delivery' | 'compatible';
export type OpenCodeBackfillTaskLedgerEvidenceMode =
| 'off'
| 'metadata-only'
| 'chain-only'
| 'snapshot-probe'
| 'snapshot-auto';
export type OpenCodeBackfillTaskLedgerOutcome = export type OpenCodeBackfillTaskLedgerOutcome =
| 'imported' | 'imported'
@ -264,6 +271,12 @@ export interface OpenCodeBackfillTaskLedgerCommandData {
workspaceRoot?: string; workspaceRoot?: string;
dryRun: boolean; dryRun: boolean;
attributionMode?: OpenCodeBackfillTaskLedgerAttributionMode; attributionMode?: OpenCodeBackfillTaskLedgerAttributionMode;
evidenceMode?: OpenCodeBackfillTaskLedgerEvidenceMode;
strictWindowCandidateCount?: number;
openCodeDbFingerprint?: string;
deliveryLedgerFingerprint?: string;
snapshotShapeFingerprint?: string;
retryAfterReason?: string;
scannedSessions: number; scannedSessions: number;
scannedToolparts: number; scannedToolparts: number;
candidateEvents: number; candidateEvents: number;

View file

@ -308,6 +308,7 @@ export class OpenCodeReadinessBridge implements OpenCodeTeamRuntimeBridgePort {
...(input.workspaceRoot ? { workspaceRoot: input.workspaceRoot } : {}), ...(input.workspaceRoot ? { workspaceRoot: input.workspaceRoot } : {}),
dryRun: input.dryRun === true, dryRun: input.dryRun === true,
...(input.attributionMode ? { attributionMode: input.attributionMode } : {}), ...(input.attributionMode ? { attributionMode: input.attributionMode } : {}),
...(input.evidenceMode ? { evidenceMode: input.evidenceMode } : {}),
scannedSessions: 0, scannedSessions: 0,
scannedToolparts: 0, scannedToolparts: 0,
candidateEvents: 0, candidateEvents: 0,

View file

@ -1058,6 +1058,7 @@ describe('ChangeExtractorService', () => {
projectDir, projectDir,
workspaceRoot: projectPath, workspaceRoot: projectPath,
attributionMode: 'strict-delivery', attributionMode: 'strict-delivery',
evidenceMode: 'chain-only',
}) })
); );
expect(workerClient.computeTaskChanges).not.toHaveBeenCalled(); expect(workerClient.computeTaskChanges).not.toHaveBeenCalled();
@ -1182,6 +1183,7 @@ describe('ChangeExtractorService', () => {
workspaceRoot: projectPath, workspaceRoot: projectPath,
deliveryContextPath: expect.stringContaining('delivery-context.json'), deliveryContextPath: expect.stringContaining('delivery-context.json'),
attributionMode: 'strict-delivery', attributionMode: 'strict-delivery',
evidenceMode: 'chain-only',
}) })
); );
}); });