Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ Please fix the automation script to resolve this error.`;
{ text: errorMessage },
{
body: {
modelId: 'google/gemini-3.1-flash-lite-preview',
modelId: 'google/gemini-3.1-flash-lite',
reasoningEffort: 'high',
orgId,
taskId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function useChatHandlers({
{ text },
{
body: {
modelId: 'google/gemini-3.1-flash-lite-preview',
modelId: 'google/gemini-3.1-flash-lite',
reasoningEffort: 'high',
orgId,
taskId,
Expand All @@ -96,7 +96,7 @@ export function useChatHandlers({
},
{
body: {
modelId: 'google/gemini-3.1-flash-lite-preview',
modelId: 'google/gemini-3.1-flash-lite',
reasoningEffort: 'high',
orgId,
taskId,
Expand All @@ -120,7 +120,7 @@ export function useChatHandlers({
},
{
body: {
modelId: 'google/gemini-3.1-flash-lite-preview',
modelId: 'google/gemini-3.1-flash-lite',
reasoningEffort: 'high',
orgId,
taskId,
Expand Down
16 changes: 16 additions & 0 deletions apps/app/src/lib/rerank-suggestions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ describe('rerankSuggestions', () => {
expect(byId.tsk_c).toBe(0);
});

// Regression: the reranker was pinned to `google/gemini-3.1-flash-lite-preview`. The
// gateway retires `-preview` aliases on GA, so every call 404'd — and because both
// callers in run-linkage.ts catch and fall back to cosine, nothing surfaced the failure.
it('requests a GA model slug, never a -preview alias', async () => {
generateObjectMock.mockResolvedValueOnce({ object: { scores: [] } });

await rerankSuggestions({
source: { kind: 'risk', title: 't', description: 'd' },
candidates: [{ id: 'tsk_a', title: 'A', description: 'a', cosineScore: 0.5 }],
});

const { model } = generateObjectMock.mock.calls[0][0];
expect(model.modelId).toBe('google/gemini-3.1-flash-lite');
expect(model.modelId).not.toMatch(/-preview$/);
});

it('assigns 0 to candidates the LLM omits', async () => {
generateObjectMock.mockResolvedValueOnce({
object: { scores: [{ id: 'tsk_a', score: 8 }] },
Expand Down
7 changes: 6 additions & 1 deletion apps/app/src/lib/rerank-suggestions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ const gateway = createGatewayProvider({
baseURL: process.env.AI_GATEWAY_BASE_URL,
});

const RERANK_MODEL = 'google/gemini-3.1-flash-lite-preview' as const;
/**
* GA slug. Never pin a `-preview` alias here: the gateway retires it once the model
* goes GA, and every rerank call then 404s. Both callers in `run-linkage.ts` swallow that
* into a cosine-only fallback, so the failure is silent — suggestion quality just degrades.
*/
const RERANK_MODEL = 'google/gemini-3.1-flash-lite' as const;

const SYSTEM_PROMPT = `You are a GRC analyst evaluating which compliance tasks would meaningfully reduce a specific risk or vendor exposure.

Expand Down
Loading