fix: wire generated_by_model into observation write path
The generated_by_model column was added to the observations table in the Phase 0 governance schema migration but never wired into the INSERT statements. All 3,878+ observations in production have this field NULL. This fix threads the model ID from each agent (SDKAgent, GeminiAgent, OpenRouterAgent) through processAgentResponse() into storeObservation(), storeObservations(), and storeObservationsAndMarkComplete(). Unblocks Thompson Sampling RFC (#1571) which needs {obs_type}:{model} as the bandit arm key. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -175,7 +175,9 @@ export class GeminiAgent {
|
||||
worker,
|
||||
tokensUsed,
|
||||
null,
|
||||
'Gemini'
|
||||
'Gemini',
|
||||
undefined,
|
||||
model
|
||||
);
|
||||
} else {
|
||||
logger.error('SDK', 'Empty Gemini init response - session may lack context', {
|
||||
@@ -248,7 +250,8 @@ export class GeminiAgent {
|
||||
tokensUsed,
|
||||
originalTimestamp,
|
||||
'Gemini',
|
||||
lastCwd
|
||||
lastCwd,
|
||||
model
|
||||
);
|
||||
} else {
|
||||
logger.warn('SDK', 'Empty Gemini observation response, skipping processing to preserve message', {
|
||||
@@ -298,7 +301,8 @@ export class GeminiAgent {
|
||||
tokensUsed,
|
||||
originalTimestamp,
|
||||
'Gemini',
|
||||
lastCwd
|
||||
lastCwd,
|
||||
model
|
||||
);
|
||||
} else {
|
||||
logger.warn('SDK', 'Empty Gemini summary response, skipping processing to preserve message', {
|
||||
|
||||
@@ -131,7 +131,8 @@ export class OpenRouterAgent {
|
||||
tokensUsed,
|
||||
null,
|
||||
'OpenRouter',
|
||||
undefined // No lastCwd yet - before message processing
|
||||
undefined, // No lastCwd yet - before message processing
|
||||
model
|
||||
);
|
||||
} else {
|
||||
logger.error('SDK', 'Empty OpenRouter init response - session may lack context', {
|
||||
@@ -202,7 +203,8 @@ export class OpenRouterAgent {
|
||||
tokensUsed,
|
||||
originalTimestamp,
|
||||
'OpenRouter',
|
||||
lastCwd
|
||||
lastCwd,
|
||||
model
|
||||
);
|
||||
|
||||
} else if (message.type === 'summarize') {
|
||||
@@ -244,7 +246,8 @@ export class OpenRouterAgent {
|
||||
tokensUsed,
|
||||
originalTimestamp,
|
||||
'OpenRouter',
|
||||
lastCwd
|
||||
lastCwd,
|
||||
model
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +270,8 @@ export class SDKAgent {
|
||||
discoveryTokens,
|
||||
originalTimestamp,
|
||||
'SDK',
|
||||
cwdTracker.lastCwd
|
||||
cwdTracker.lastCwd,
|
||||
modelId
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@ export async function processAgentResponse(
|
||||
discoveryTokens: number,
|
||||
originalTimestamp: number | null,
|
||||
agentName: string,
|
||||
projectRoot?: string
|
||||
projectRoot?: string,
|
||||
modelId?: string
|
||||
): Promise<void> {
|
||||
// Track generator activity for stale detection (Issue #1099)
|
||||
session.lastGeneratorActivity = Date.now();
|
||||
@@ -102,7 +103,8 @@ export async function processAgentResponse(
|
||||
summaryForStore,
|
||||
session.lastPromptNumber,
|
||||
discoveryTokens,
|
||||
originalTimestamp ?? undefined
|
||||
originalTimestamp ?? undefined,
|
||||
modelId
|
||||
);
|
||||
|
||||
// Log storage result with IDs for end-to-end traceability
|
||||
|
||||
Reference in New Issue
Block a user