Skip to content
Merged
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
48 changes: 45 additions & 3 deletions src/schema/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4588,6 +4588,16 @@ export const resolvers: IResolvers<unknown, BaseContext> = {
},
};
} catch (err) {
logger.warn(
{
err,
userId: ctx.userId,
askedCount: parsed.askedCount,
seedTagCount: parsed.seedTags.length,
priorAnswerCount: parsed.priorAnswers.length,
},
'personaQuizNextQuestion: request failed',
);
if (err instanceof HttpError) {
throw new ServiceError({
message: 'personaQuizNextQuestion request failed',
Expand Down Expand Up @@ -4616,6 +4626,26 @@ export const resolvers: IResolvers<unknown, BaseContext> = {
}),
);

// Surface unexpected bragi responses (success status but empty
// reveal copy) — without this log the frontend silently falls back
// to the seed-tag headline and the root cause stays invisible.
const bragiHasReveal = !!(
bragiResp.reveal &&
(bragiResp.reveal.headline || bragiResp.reveal.description)
);
if (!bragiHasReveal) {
logger.warn(
{
userId: ctx.userId,
bragiId: bragiResp.id,
includeTagCount: bragiResp.includeTags?.length ?? 0,
answerCount: parsed.answers.length,
seedTagCount: parsed.seedTags.length,
},
'personaQuizReveal: bragi returned empty reveal',
);
}

// Fetch recsys-grounded fillers in parallel-friendly fashion. Used to
// pad the LLM tag list up to targetCount once we've filtered through
// the canonical Keyword table.
Expand Down Expand Up @@ -4661,14 +4691,26 @@ export const resolvers: IResolvers<unknown, BaseContext> = {

return {
includeTags: canonical.slice(0, parsed.targetCount),
reveal: bragiResp.reveal
reveal: bragiHasReveal
? {
headline: bragiResp.reveal.headline,
description: bragiResp.reveal.description,
headline: bragiResp.reveal!.headline,
description: bragiResp.reveal!.description,
}
: null,
};
} catch (err) {
// Log the failure explicitly — the GraphQL middleware will also
// log a generic "unexpected graphql error" further up, but having
// a resolver-tagged entry makes it greppable by feature name.
logger.warn(
{
err,
userId: ctx.userId,
answerCount: parsed.answers.length,
seedTagCount: parsed.seedTags.length,
},
'personaQuizReveal: request failed',
);
if (err instanceof HttpError) {
throw new ServiceError({
message: 'personaQuizReveal request failed',
Expand Down
Loading