From 8781e7616ae7ca021b64e782093623939a6b690a Mon Sep 17 00:00:00 2001 From: Zeeshan Adil Date: Thu, 3 Dec 2026 15:23:22 +0500 Subject: [PATCH] Tell learners they can move on when AI feedback is not passing Course-level AI feedback on a lab log already counts the chapter as done once sent, but the reader only said 'Not quite' and 'Try again', so learners redid work thinking they were blocked. Show a line that it counts and they can go on. The capstone send button now says it moves the learner on, since sending to the mentor completes the chapter. --- .../src/blocks/capstone-check/CapstoneCheckClient.tsx | 4 ++-- frontend/src/shared/blocks/open-question/schema.ts | 8 +++++++- .../src/blocks/exercises/OpenQuestionClient.tsx | 5 +++++ .../learning-ui/src/shared/blocks/open-question/schema.ts | 8 +++++++- server/src/services/blocks/state.ts | 5 ++++- server/src/shared/blocks/open-question/schema.ts | 8 +++++++- 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/frontend/src/blocks/capstone-check/CapstoneCheckClient.tsx b/frontend/src/blocks/capstone-check/CapstoneCheckClient.tsx index 4289433a1..9afa87cbc 100644 --- a/frontend/src/blocks/capstone-check/CapstoneCheckClient.tsx +++ b/frontend/src/blocks/capstone-check/CapstoneCheckClient.tsx @@ -134,9 +134,9 @@ function Report({ check, onSend, sending, decided }: { check: CapstoneCheckView; <> -

The AI checks your project. You can also ask a mentor for feedback.

+

The AI notes are tips. Send it to your mentor and you can go on to the next chapter now, then come back to these checks later.

)} diff --git a/frontend/src/shared/blocks/open-question/schema.ts b/frontend/src/shared/blocks/open-question/schema.ts index 4e5751073..fa4245366 100644 --- a/frontend/src/shared/blocks/open-question/schema.ts +++ b/frontend/src/shared/blocks/open-question/schema.ts @@ -58,7 +58,13 @@ export type OpenQuestionConfig = z.infer; export type SanitizedOpenQuestionConfig = Omit< OpenQuestionConfig, "rubric" | "sampleAnswer" | "hints" | "personalizeInstructions" ->; +> & { + /** + * Set when the course turned on AI feedback for a question that is not AI-graded on its own. + * The answer already counts once sent, so the reader tells the learner they can move on. + */ + countsOnSubmit?: boolean; +}; /** True when this open question is graded instantly with the learner's OpenRouter key. */ export function isLlmGradedOpenQuestion(config: unknown): boolean { diff --git a/packages/learning-ui/src/blocks/exercises/OpenQuestionClient.tsx b/packages/learning-ui/src/blocks/exercises/OpenQuestionClient.tsx index 1d76dfd68..4e993e342 100644 --- a/packages/learning-ui/src/blocks/exercises/OpenQuestionClient.tsx +++ b/packages/learning-ui/src/blocks/exercises/OpenQuestionClient.tsx @@ -324,6 +324,11 @@ export function OpenQuestionClient({ Not quite{typeof llmResult.attempt === "number" ? ` (try ${llmResult.attempt})` : ""}

+ {config.countsOnSubmit ? ( +

+ This already counts as done, so you can go on to the next lesson now. The notes below are tips. Come back and improve your answer whenever you like. +

+ ) : null} {llmResult.explanation ? (

{llmResult.explanation} diff --git a/packages/learning-ui/src/shared/blocks/open-question/schema.ts b/packages/learning-ui/src/shared/blocks/open-question/schema.ts index 4e5751073..fa4245366 100644 --- a/packages/learning-ui/src/shared/blocks/open-question/schema.ts +++ b/packages/learning-ui/src/shared/blocks/open-question/schema.ts @@ -58,7 +58,13 @@ export type OpenQuestionConfig = z.infer; export type SanitizedOpenQuestionConfig = Omit< OpenQuestionConfig, "rubric" | "sampleAnswer" | "hints" | "personalizeInstructions" ->; +> & { + /** + * Set when the course turned on AI feedback for a question that is not AI-graded on its own. + * The answer already counts once sent, so the reader tells the learner they can move on. + */ + countsOnSubmit?: boolean; +}; /** True when this open question is graded instantly with the learner's OpenRouter key. */ export function isLlmGradedOpenQuestion(config: unknown): boolean { diff --git a/server/src/services/blocks/state.ts b/server/src/services/blocks/state.ts index 9c9373afa..bb363732a 100644 --- a/server/src/services/blocks/state.ts +++ b/server/src/services/blocks/state.ts @@ -6,6 +6,7 @@ import { loadCapstoneState } from "../capstone/service.js"; import { CodeConfigSchema, type SanitizedCodeConfig } from "../../shared/blocks/code/schema.js"; import { MustReadConfigSchema } from "../../shared/blocks/must-read/schema.js"; import { + isLlmGradedOpenQuestion, shouldLlmGradeOpenQuestion, OpenQuestionConfigSchema, type OpenQuestionStoredPayload, @@ -179,7 +180,9 @@ async function blockStateFor( return { type: "OPEN_QUESTION", // Course-level auto-grade must look like llm mode so the learner UI asks for an OpenRouter key. - config: llmMode ? { ...clientConfig, autoGrade: "llm" as const } : clientConfig, + config: llmMode + ? { ...clientConfig, autoGrade: "llm" as const, ...(isLlmGradedOpenQuestion(config) ? {} : { countsOnSubmit: true }) } + : clientConfig, group: getOpenQuestionGroupPosition(chapterBlocks, blockId), ...(aiStatus ? { ai: { configured: aiStatus.configured, hasKey: aiStatus.hasKey } } diff --git a/server/src/shared/blocks/open-question/schema.ts b/server/src/shared/blocks/open-question/schema.ts index 2049a817f..515fd1cc0 100644 --- a/server/src/shared/blocks/open-question/schema.ts +++ b/server/src/shared/blocks/open-question/schema.ts @@ -57,7 +57,13 @@ export type OpenQuestionConfig = z.infer; export type SanitizedOpenQuestionConfig = Omit< OpenQuestionConfig, "rubric" | "sampleAnswer" | "hints" | "personalizeInstructions" ->; +> & { + /** + * Set when the course turned on AI feedback for a question that is not AI-graded on its own. + * The answer already counts once sent, so the reader tells the learner they can move on. + */ + countsOnSubmit?: boolean; +}; /** True when this open question is graded instantly with the learner's OpenRouter key. */ export function isLlmGradedOpenQuestion(config: unknown): boolean {