Skip to content

feat(quizzes): add AI-graded short answers and improve question quality - #851

Draft
mahruschow wants to merge 3 commits into
ThinkEx-OSS:mainfrom
mahruschow:feat/quiz-question-quality
Draft

mahruschow wants to merge 3 commits into
ThinkEx-OSS:mainfrom
mahruschow:feat/quiz-question-quality

Conversation

@mahruschow

@mahruschow mahruschow commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

Quizzes currently support only multiple-choice responses, and generated distractors can make the correct answer obvious. Adds a Short answer creation option, model answers and grading criteria, and server-side AI grading with saved feedback. Strengthens multiple-choice authoring guidance to request realistic misconceptions, reasoning questions, and comparable option wording.

Short-answer submissions enforce workspace access and existing AI usage limits. Grading runs outside database transactions, validates structured output, and saves a first-submission result. Edits invalidate old grades; concurrent edits or progress resets reject stale results. Failed grading preserves the response in the tab for retry. Mixed quizzes are supported by progress, missed-question sessions, AI reads, search, and Markdown exports.

Validation:

  • 53 focused tests passed, including short-answer content, edits, grading failures, usage limits, persistence races, and AI read contracts.
  • TypeScript, scoped formatting/lint checks, and git diff --check passed.
  • Production build passed.

Draft: local interactive verification is blocked by PostgreSQL connection refusal on localhost:5432. Live model grading quality and desktop/mobile UI interaction still need verification with the team's development environment and AI Gateway credentials. Persistence race tests mock the database; real PostgreSQL concurrency should also be exercised before marking ready.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/features/workspaces/quizzes/quiz-edits.ts
Comment thread src/features/workspaces/components/study/CreateStudyItemDialog.tsx Outdated
@greptile-apps

greptile-apps Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Improves quiz generation prompts and validation descriptions.

Neither issue blocks merging. The dialog prompt should be adjusted so topic-only and true/false requests receive consistent guidance.

Findings

  1. P2 Allow topic-only quizzes ▶
  2. P2 Align true/false guidance ▶

Summary

The PR strengthens quiz-writing guidance in the quiz tool and Create Quiz dialog, and documents quiz behavior. The dialog prompt needs two non-blocking adjustments: it asks for workspace source material even when a request supplies only a topic, and it gives true/false requests distractor guidance that conflicts with the quiz tool.

Reviews (1) · Last reviewed commit: "fix(quizzes): strengthen question and di..."

countLabel: "Number of questions",
prompt: (count: number, locationPhrase: string, topic: string) =>
`Create a quiz with exactly ${count} multiple-choice questions ${locationPhrase}. Cover: ${topic}`,
`Create a quiz with exactly ${count} multiple-choice questions ${locationPhrase}. Cover: ${topic}. Use the relevant workspace source material. Prefer application and reasoning questions, with three plausible distractors based on common misconceptions. Keep all options comparable in length, specificity, and wording so the correct answer does not stand out. Check that exactly one option is correct and explain why each distractor is wrong.`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Allow topic-only quizzes

If a workspace has no relevant source material, the dialog still asks the AI to use it. That instruction cannot be followed for a topic-only request and may lead to a clarification instead of the requested quiz. Qualify the instruction for cases where relevant material is available. This is a non-blocking prompt concern.

Knowledge Base Used: Workspace learning tools

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Artifacts

Executable Chromium comparison command

  • This script rendered the parent or PR dialog and submitted a topic-only request, capturing the resulting composer queue.

Rendered dialog and composer queue fixture

  • This fixture mounted the real dialog and displayed its queued prompt without supplying workspace sources.

Empty-workspace browser fixture

  • This page hosted the dialog with no source files, quotes, or attachments.

Parent revision submission log

  • The recorded command exited 0 and captured a queued topic-only prompt without the source-material instruction.

▶ Parent revision dialog and topic-only submission

  • Chromium submitted the topic-only request through the parent dialog, showing the original prompt in the queue.

Parent revision queued prompt

  • The captured browser frame shows the submitted topic-only prompt without a source-material instruction.

PR revision submission log

  • The recorded command exited 0 and captured the same queued request with the added source-material instruction.

▶ PR revision dialog and topic-only submission

  • Chromium submitted the same request through the PR dialog, showing the changed prompt in the queue.

PR revision queued prompt

  • The captured browser frame shows the added source-material instruction despite the fixture having no sources.

Chromium validation command source

  • The executed script renders both dialog versions, submits the same topic, and checks the queued prompts against the tool schema; it documents the comparison.

Rendered dialog validation source

  • The executed page mounts the real dialog and displays the composer queue and live schema description; it shows what the browser test exercised.

Pre-PR dialog source used for comparison

  • This file was extracted from the parent commit and rendered in the before run; it supplies the unchanged-behavior baseline.

▶ Before PR: true/false request without a three-distractor prompt

  • Chromium submitted the true/false topic through the pre-PR dialog; the queued prompt contains the topic but no three-distractor instruction.

Before PR: queued true/false prompt and schema guidance

  • The captured browser frame shows the pre-PR queued prompt beside the schema’s one-distractor true/false guidance; there is no conflict in the prompt.

▶ PR version: true/false request with conflicting distractor guidance

  • Chromium submitted the same topic through the PR dialog; the queued prompt requests three distractors beside schema guidance requesting one for true/false.

PR version: queued prompt says three while schema says one

  • The captured browser frame displays both instructions after submission; it makes the guidance conflict directly comparable with the before frame.

Successful Chromium execution record

  • The captured command output records the working directory, exit code 0, and both observed queued prompts and schema descriptions; it confirms the asserted difference.

View artifacts

T-Rex Ran code and verified through T-Rex

countLabel: "Number of questions",
prompt: (count: number, locationPhrase: string, topic: string) =>
`Create a quiz with exactly ${count} multiple-choice questions ${locationPhrase}. Cover: ${topic}`,
`Create a quiz with exactly ${count} multiple-choice questions ${locationPhrase}. Cover: ${topic}. Use the relevant workspace source material. Prefer application and reasoning questions, with three plausible distractors based on common misconceptions. Keep all options comparable in length, specificity, and wording so the correct answer does not stand out. Check that exactly one option is correct and explain why each distractor is wrong.`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Align true/false guidance

Submitting a true/false quiz request sends an instruction to write three distractors, while the quiz tool instructs the AI to use one for true/false questions. The conflicting guidance makes the requested format less reliable. Reserve three distractors for standard multiple-choice questions. This is non-blocking.

Artifacts

Executable Chromium comparison command

  • This script rendered the parent or PR dialog and submitted a topic-only request, capturing the resulting composer queue.

Rendered dialog and composer queue fixture

  • This fixture mounted the real dialog and displayed its queued prompt without supplying workspace sources.

Empty-workspace browser fixture

  • This page hosted the dialog with no source files, quotes, or attachments.

Parent revision submission log

  • The recorded command exited 0 and captured a queued topic-only prompt without the source-material instruction.

▶ Parent revision dialog and topic-only submission

  • Chromium submitted the topic-only request through the parent dialog, showing the original prompt in the queue.

Parent revision queued prompt

  • The captured browser frame shows the submitted topic-only prompt without a source-material instruction.

PR revision submission log

  • The recorded command exited 0 and captured the same queued request with the added source-material instruction.

▶ PR revision dialog and topic-only submission

  • Chromium submitted the same request through the PR dialog, showing the changed prompt in the queue.

PR revision queued prompt

  • The captured browser frame shows the added source-material instruction despite the fixture having no sources.

Chromium validation command source

  • The executed script renders both dialog versions, submits the same topic, and checks the queued prompts against the tool schema; it documents the comparison.

Rendered dialog validation source

  • The executed page mounts the real dialog and displays the composer queue and live schema description; it shows what the browser test exercised.

Pre-PR dialog source used for comparison

  • This file was extracted from the parent commit and rendered in the before run; it supplies the unchanged-behavior baseline.

▶ Before PR: true/false request without a three-distractor prompt

  • Chromium submitted the true/false topic through the pre-PR dialog; the queued prompt contains the topic but no three-distractor instruction.

Before PR: queued true/false prompt and schema guidance

  • The captured browser frame shows the pre-PR queued prompt beside the schema’s one-distractor true/false guidance; there is no conflict in the prompt.

▶ PR version: true/false request with conflicting distractor guidance

  • Chromium submitted the same topic through the PR dialog; the queued prompt requests three distractors beside schema guidance requesting one for true/false.

PR version: queued prompt says three while schema says one

  • The captured browser frame displays both instructions after submission; it makes the guidance conflict directly comparable with the before frame.

Successful Chromium execution record

  • The captured command output records the working directory, exit code 0, and both observed queued prompts and schema descriptions; it confirms the asserted difference.

View artifacts

T-Rex Ran code and verified through T-Rex

@mahruschow
mahruschow marked this pull request as draft October 4, 2026 08:06
@mahruschow mahruschow changed the title fix(quizzes): improve generated multiple-choice question quality feat(quizzes): add AI-graded short answers and improve question quality Oct 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant