Skip to content

Assistant debug/fix affordances for errors and failing checks#161

Merged
josephschorr merged 1 commit into
mainfrom
feat/assistant-debug-fix-affordances
Jul 23, 2026
Merged

Assistant debug/fix affordances for errors and failing checks#161
josephschorr merged 1 commit into
mainfrom
feat/assistant-debug-fix-affordances

Conversation

@josephschorr

Copy link
Copy Markdown
Member

Summary

Adds one-click "Ask assistant to debug/fix" entry points that open the AI assistant and auto-submit a targeted debug prompt for a specific failure. The assistant already has the tools and full document state each turn, so this is purely the entry points plus one small new primitive.

Surfaces (all gated on AppConfig().aiEnabled — nothing renders/registers when AI is off)

  • Schema syntax errors & failed assertions — an inline "Ask assistant to fix" CodeLens in the schema/assertions editors, mirroring the existing registerAssertionFixes pattern.
  • Failing check watches — an "Ask assistant to debug" button in the Watches panel for every non-passing state (denied / errored / couldn't-run / missing-context).
  • Problems panel — an "Ask assistant to fix" action on schema, assertion, and validation error rows, alongside the existing "Add check watch".

How it works

  • A transient pendingPrompt on the assistant store (deliberately not persisted).
  • requestAssistantDebug(prompt, source) opens the assistant dock and stashes the prompt; a usePendingPromptConsumer hook in AssistantPanel submits it once the panel isn't mid-turn. It defers only while a turn is actively streaming/executing tools — not on the terminal error state — so a request made after a failed turn still fires.
  • A pure debugPrompts.ts builds the prompts (schema / assertion / validation / relationship errors, plus check watches), keeping wording consistent and testable.
  • Analytics: a single playground_ai_debug_requested event tagged with { source: "editor" | "watches" | "problems" }.

Tests

  • Unit: prompt builders + the isDebuggableWatchStatus predicate, the store's pending-prompt actions, and the requestAssistantDebug dispatcher.
  • Browser: the affordance components (click → dock opens + prompt submitted) and the pending-prompt hook (idle, deferred-while-streaming, and fires-from-error).
  • Full gate green: unit 228, browser 47, vite build clean, oxfmt --check clean, lint clean (no findings on changed files).

The inline editor CodeLens has no automated test by design, matching the existing untested registerAssertionFixes; its prompt output is covered by the builder unit tests.

Notes

  • Design spec and implementation plan live under docs/superpowers/.
  • The four triggers were also verified live in-app with AI enabled.

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
playground Ready Ready Preview, Comment Jul 22, 2026 11:40pm

Request Review

Add entry points that open the AI assistant and auto-submit a targeted
debug prompt for a specific failure. Everything is gated on
AppConfig().aiEnabled and renders/registers nothing when AI is off.

Surfaces:
- Inline "Ask assistant to fix" CodeLens on schema syntax errors and
  failed assertions, in the schema/assertions editors.
- "Ask assistant to debug" button in the Watches panel for every
  non-passing check-watch state (denied, errored, couldn't run, missing
  context).
- "Ask assistant to fix" action on Problems-panel error rows (schema,
  assertion, validation).

Mechanism: a transient, non-persisted pendingPrompt on the assistant
store; requestAssistantDebug(prompt, source) opens the assistant dock and
stashes the prompt; a usePendingPromptConsumer hook in AssistantPanel
submits it once the panel is not mid-turn (it defers only while a turn is
streaming or executing tools, not on the terminal error state, so a
request after a failed turn still fires). A pure debugPrompts module
builds the prompts. Emits a single playground_ai_debug_requested
analytics event tagged with the source surface.

Covered by unit tests (prompt builders, predicate, store actions,
dispatcher) and browser tests (affordance components and the
pending-prompt hook, including the error-state case).
@josephschorr
josephschorr merged commit f76e82e into main Jul 23, 2026
5 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants