fix(coach): catalog the decline and clarify-choice strings, and let a briefing asked for by hand reason

This commit is contained in:
Marc-André Bombeck committed 2026-10-06 20:14:11 +02:00
1 parent 8f9c443d35
commit e59fef2545
7 files changed
+21 -12

No files matched your search

@@ -41,6 +41,10 @@ const ADMITTED: Record<string, { jobs: string[]; why: string }> = {
jobs: ["daily_briefing"],
why: "The daily briefing's generation and its phrasing re-roll; the JSON and grounding repairs do not reason.",
},
"app/api/insights/generate/route.ts": {
jobs: ["daily_briefing"],
why: "A briefing asked for by hand reasons like the scheduled one; its JSON and grounding repairs do not.",
},
"lib/insights/narrative/period-narrative-generate.ts": {
jobs: ["period_narrative_month", "period_narrative_week"],
why: "The weekly and monthly narratives' first pass; the grounding repair does not reason.",
+3
View File
@@ -795,6 +795,9 @@ export const POST = apiHandler((request: NextRequest) =>
// v1.25 — honours the per-user response-timeout setting.
timeoutMs: effectiveTimeoutMs,
stage: "generate",
// v1.41 — a briefing asked for by hand reasons exactly like the
// scheduled one; the retries below repair a reply and do not.
reasoningJob: "daily_briefing",
});
result = fallback.result;
workingProviderType = fallback.workingProvider.providerType;
@@ -120,8 +120,9 @@ describe("v1.41 contract keys", () => {
it("produces the whole catalog", () => {
// Every key laid down for the release but the `change_assumption` chip
// label, which the dialog catalog's own test covers.
expect(keys.size).toBe(57);
// label, which the dialog catalog's own test covers, plus the two
// declined-proposal replies.
expect(keys.size).toBe(59);
});
it.each(locales)("every catalog key resolves in %s", (locale) => {
+4 -4
View File
@@ -48,6 +48,7 @@ import {
} from "@/lib/ai/coach/types";
import { coachClarificationSchema } from "@/lib/ai/coach/stream-events";
import {
COACH_CLARIFY_UI_KEYS,
COACH_FOLLOW_UP_KEYS,
clarifyWindowLabelKey,
coachDomainLabelKey,
@@ -439,12 +440,11 @@ export const CLARIFY_DAILY_LIMIT = 3;
const COMPARISON_LABEL_KEY: Readonly<Record<CoachComparisonBasis, string>> = {
previous_period: COACH_FOLLOW_UP_KEYS.previous_period,
year_ago: COACH_FOLLOW_UP_KEYS.year_ago,
// Pending until integration copies it into the bundles.
baseline_90d: "coach.clarify.comparison.baseline90d",
baseline_90d: COACH_CLARIFY_UI_KEYS.comparisonBaseline90d,
};
/** A pending key: "Since {date}", an illness episode as an anchor. */
const ANCHOR_ILLNESS_KEY = "coach.clarify.anchor.illness";
/** "Since {date}", an illness episode as an anchor. */
const ANCHOR_ILLNESS_KEY = COACH_CLARIFY_UI_KEYS.anchorIllness;
/** A choice the server built from the record: an id and a catalog label. */
export interface ClarifyRecordChoice {
+2
View File
@@ -247,6 +247,8 @@ export const COACH_CLARIFY_UI_KEYS = {
choicesLabel: "coach.clarify.choicesLabel",
freeTextHint: "coach.clarify.freeTextHint",
contextHint: "coach.clarify.contextHint",
comparisonBaseline90d: "coach.clarify.comparison.baseline90d",
anchorIllness: "coach.clarify.anchor.illness",
} as const;
/** A window choice on a clarification card ("Last 30 days"). */
+2
View File
@@ -61,6 +61,7 @@ export const COACH_MEMORY_KEYS = {
accept: "insights.coach.memory.accept",
decline: "insights.coach.memory.decline",
confirmed: "insights.coach.memory.confirmed",
declined: "insights.coach.memory.declined",
} as const;
/** A plan proposal's two replies, and the line a decision turn answers with. */
@@ -68,6 +69,7 @@ export const COACH_PLAN_KEYS = {
accept: "insights.coach.plan.accept",
decline: "insights.coach.plan.decline",
confirmed: "insights.coach.plan.confirmed",
declined: "insights.coach.plan.declined",
} as const;
/** The memory list in settings, and the link to it from the Coach. */
+3 -6
View File
@@ -214,13 +214,10 @@ export async function runReuseTurn(args: {
return new Response(stream, { status: 200, headers: SSE_HEADERS });
}
/**
* The reply a declined proposal gets. Pending keys: integration copies them
* into the bundles with the rest of this release's strings.
*/
/** The reply a declined proposal gets. */
export const COACH_DECISION_DECLINED_KEYS = {
memory: "insights.coach.memory.declined",
plan: "insights.coach.plan.declined",
memory: COACH_MEMORY_KEYS.declined,
plan: COACH_PLAN_KEYS.declined,
} as const;
/** The stored note and plan of a message, each held to its wire schema. */