Skip to content

Surface multiple solutions for katas that have them#3275

Open
amcasey wants to merge 3 commits into
mainfrom
amcasey/AltSoln
Open

Surface multiple solutions for katas that have them#3275
amcasey wants to merge 3 commits into
mainfrom
amcasey/AltSoln

Conversation

@amcasey

@amcasey amcasey commented May 29, 2026

Copy link
Copy Markdown
Member

I remember finding the alternative solutions useful in the web version of the katas and I thought they might be useful in VS Code too. I decided not to try to figure out if the user's solution matched one of the available solutions since I wasn't sure Haiku could handle that reliably and it's easy enough to read past the one that matches yours.
AlternativeApproaches

amcasey added 2 commits May 26, 2026 13:01
When an exercise has multiple reference solutions (14 exercises today),
show a "See alternative approaches" link in the panel after a passing
check. Clicking opens Copilot Chat where the agent presents all
reference solutions with their explanations.

Changes:
- Preserve all @[solution] blocks from katas content (catalog.ts was
  discarding all but the first via .find())
- Add hasAlternatives flag to ExerciseContent, driven by solutionCodes.length > 1
- Extend the solution tool to return alternatives alongside the primary
- Thread hasAlternatives through webview to conditionally render the link
- Update agent instructions with new chat entry point and handling
- **"Explain this concept in more detail"** — Provide a deeper pedagogical explanation. Offer analogies, relate to prior units. Don't repeat the panel content.
- **"Help me understand why my solution failed"** — Analyze common mistakes for that exercise. Give targeted debugging hints, not the full solution.
- **"Explain this solution step by step"** — Walk through the reference solution line by line, explaining the quantum concepts and Q# patterns.
- **"Explain this solution step by step"** — Walk through the reference solution line by line, explaining the quantum concepts and Q# patterns. If there are multiple reference solutions, walk through only the first one.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shall we instruct Copilot to also call the readUserCode (?) tool to read the user's solution, and compare to the reference solution?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This comment was meant for the line below it. Looks like this line is just out of date (and the corresponding row in the table). Could you clean it up maybe?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

After editing

Image

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removed the entry for "Explain this solution"

Comment thread source/vscode/src/learning/types.d.ts
@amcasey amcasey marked this pull request as ready for review May 29, 2026 23:22
@amcasey amcasey requested review from billti and idavis as code owners May 29, 2026 23:22
Comment on lines 94 to +95

Render the result, offer a brief reaction. Don't auto-call `next` — the user may want to review the solution first.
Render the result, offer a brief reaction. Don't auto-call `next` — the user may want to review the solution first. If the exercise has alternative approaches (indicated by the panel showing a "See alternative approaches" link), you may briefly mention that other approaches exist, but don't present them unless asked.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The agent can't "see" this UI state, so this wording is likely to just confuse it.

Most of the time the agent can't "see" passing checks as they happen at all, because the user does it through the Check button in the UI. So this paragraph is essentially telling the agent how to handle the result of a check tool call that it made.

Probably best to guide the agent towards the hasAlternativeSolutions flag for the current exercise (which should hopefully already be in context, thanks to frequent calls the agent has to make to getState).

(indicated by the hasAlternativeSolutions flag)

filePath: string;
isComplete: boolean;
/** True when multiple reference solutions exist for this exercise. */
hasAlternatives: boolean;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggest renaming this to hasAlternativeSolutions because the agent can't see the doc comment, just the JSON data. The agent can infer meaning from descriptive names.

@minestarks minestarks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! Works well on the exercise I tried. A couple of minor suggestions

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants