Skip to content

feat(studio): render assistant SQL with AssistantQueryCell - #49170

Merged
SaxonF merged 2 commits into
feat/assistant-query-cellfrom
feat/assistant-sql-blocks
Aug 20, 2026
Merged

SaxonF merged 2 commits into
feat/assistant-query-cellfrom
feat/assistant-sql-blocks

Conversation

@SaxonF

@SaxonF SaxonF commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor
image

I have read the CONTRIBUTING.md file.

YES

What kind of change does this PR introduce?

Feature.

What is the current behavior?

Assistant execute_sql tool parts and markdown SQL fences render through DisplayBlockRenderer. The confirm footer is gated to the last part of the last message, so a pending SQL approval can disappear if the assistant keeps writing.

What is the new behavior?

SQL tool parts and markdown fences use AssistantQueryCell inside Confirm. The footer follows the same manual-approval helpers as Edge Functions. DisplayBlockRenderer is removed.

Additional context

Top of stack #49171. Base: feat/assistant-query-cell (#49169).

Does not wrap notebook create/update proposals. That depends on #49159 merging first.

Test plan

  • execute_sql approval shows Run query / Skip on the Confirm card under the editor
  • Footer still shows if the assistant writes text after the SQL tool part
  • Markdown SQL fences render as AssistantQueryCell without a confirm footer
  • After skip, the query cell remains so the user can run it locally
  • Edge Function confirm from feat(studio): wrap assistant Edge Function approval in a Confirm card #49168 still works

@SaxonF
SaxonF requested a review from a team as a code owner August 18, 2026 03:38
@vercel

vercel Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
studio-self-hosted Ready Ready Preview Aug 20, 2026 12:50am
studio-staging Ready Ready Preview Aug 20, 2026 12:50am
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Aug 20, 2026 12:50am
design-system Skipped Skipped Aug 20, 2026 12:50am
docs Skipped Skipped Aug 20, 2026 12:50am
ui-library Skipped Skipped Aug 20, 2026 12:50am
zone-www-dot-com Skipped Skipped Aug 20, 2026 12:50am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0de5584f-a6e6-40fe-82a8-3d0bd9ce7c75

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@supabase

supabase Bot commented Aug 18, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@github-actions

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results (next)

passed  241 passed
flaky  2 flaky
skipped  5 skipped

Details

stats  248 tests across 29 suites
duration  4 minutes, 52 seconds
commit  22cfbf8

Flaky tests

Features › database.spec.ts › Database › Schema Visualizer › table actions work as expected
Features › table-editor.spec.ts › table editor › should show rls accordingly

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@github-actions

github-actions Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results (tanstack)

passed  243 passed
skipped  5 skipped

Details

stats  248 tests across 29 suites
duration  4 minutes, 2 seconds
commit  1008099

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@SaxonF
SaxonF force-pushed the feat/assistant-sql-blocks branch from 22cfbf8 to ce66b71 Compare August 18, 2026 04:19
@SaxonF
SaxonF force-pushed the feat/assistant-sql-blocks branch from ce66b71 to 7324f07 Compare August 18, 2026 04:21
@SaxonF
SaxonF force-pushed the feat/assistant-sql-blocks branch from 7324f07 to c76f0a2 Compare August 18, 2026 04:44
@SaxonF
SaxonF force-pushed the feat/assistant-sql-blocks branch from c76f0a2 to 0760bdc Compare August 18, 2026 05:08
@SaxonF
SaxonF force-pushed the feat/assistant-sql-blocks branch from 0760bdc to 64d9aad Compare August 18, 2026 06:00
@SaxonF
SaxonF force-pushed the feat/assistant-sql-blocks branch from 64d9aad to 21bc247 Compare August 18, 2026 06:16
joshenlim added a commit that referenced this pull request Aug 18, 2026
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Chore / dependency upgrade.

## What is the current behavior?

Studio is on AI SDK 6 (`ai` ^6.0.174, `@ai-sdk/react` ^3). Tool
approvals still use the v6 `needsApproval` flag on individual tools.

## What is the new behavior?

Upgrades Studio to AI SDK 7 (`ai` 7.0.59) and the matching `@ai-sdk/*`
packages. Aligns call sites with v7 names (`instructions`,
`isStepCount`, `onEnd`, `ToolExecutionOptions`).

This is the bottom of stack #49171. Later layers add a shared Confirm
card and AssistantQueryCell.

## Additional context

- Stack: #49167 → #49168 → #49169 → #49170
- `needsApproval` on tools is left as-is in this PR so the upgrade can
land independently. A follow-up can move those gates to `streamText({
toolApproval })` and `experimental_toolApprovalSecret`.
- Independent of the notebook preview stack
([#49112](#49112),
[#49159](#49159)), which should
merge first before we wrap notebook proposals in Confirm.

## Test plan

- [ ] `pnpm --filter studio test` for `lib/ai/tools/*` and assistant
generate path
- [ ] Assistant chat still streams and tool-approval SQL / Edge Function
still pause for confirm
- [ ] Evals still run with mock tools (`needsApproval: false` overrides)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Improvements**
* Updated AI-powered chat, onboarding, SQL, code completion, and recipe
generation workflows for more reliable responses.
* Streaming responses now better preserve reasoning and source
information where available.
* Improved tool privacy notices while preserving dynamically generated
tool descriptions.
* Refined AI response handling, including step limits and structured
policy results.
* **Bug Fixes**
* Improved compatibility across AI-powered tool interactions and
execution scenarios.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@charislam
charislam force-pushed the feat/assistant-sql-blocks branch from 2fe7751 to e18ebc1 Compare August 19, 2026 13:56
SaxonF and others added 2 commits August 20, 2026 10:37
Replace DisplayBlockRenderer in tool parts and markdown fences, and show the confirm footer for any manual SQL approval rather than only the last part of the last message.

Co-authored-by: Cursor <[email protected]>
@SaxonF
SaxonF force-pushed the feat/assistant-sql-blocks branch from e18ebc1 to 1008099 Compare August 20, 2026 00:41
@SaxonF
SaxonF merged commit fd8ccf8 into master Aug 20, 2026
42 of 61 checks passed
@SaxonF
SaxonF deleted the feat/assistant-sql-blocks branch August 20, 2026 01:35
SaxonF added a commit that referenced this pull request Aug 20, 2026
…#49168)

<img width="1512" height="862" alt="image"
src="https://github.com/user-attachments/assets/79a6d4dc-dcd2-489f-97d7-3ee7a0196b7d"
/>


## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Feature / UI refactor.

## What is the current behavior?

Assistant Edge Function approval nests `ConfirmFooter` under the
function block. `addToolApprovalResponse` is wired whenever state is
`approval-requested`, including automatic approvals.

## What is the new behavior?

Introduces a `Confirm` card that owns the frame, with the footer
attached below the body. Edge Function approval uses that card.
Interactive Approve/Deny only runs for manual `approval-requested` parts
(`!approval.isAutomatic`), matching the [AI SDK tool-approvals `useChat`
guidelines](https://ai-sdk.dev/docs/agents/tool-approvals).

SQL still uses `DisplayBlockRenderer` until #49170. `ConfirmFooter` is
inlined into `Confirm` so SQL can keep importing the named footer until
that PR.

## Additional context

Part of stack #49171. Base: `chore/ai-sdk-7` (#49167).

Notebook proposal Confirm wrapping is **not** in this stack — that file
lives on [#49159](#49159).
Follow up after that stack merges.

## Test plan

- [ ] Deploy-edge-function tool part shows Confirm with Skip / Deploy
- [ ] Existing-function replace warning still requires the second
confirm
- [ ] After approve, footer morphs to loading and buttons disable
- [ ] `Confirm.utils.test.ts` and `EdgeFunctionRenderer.test.tsx` pass

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added confirmation cards for AI-assisted actions, including approve
and cancel controls.
* Improved handling of manual approval requests for SQL execution,
notebook changes, and Edge Function deployment.
* Added support for customizing report and Edge Function block styling.

* **Bug Fixes**
* Automatic approvals no longer appear as pending manual confirmations.
  * Skipped SQL actions now provide clearer messaging.

* **Tests**
* Expanded coverage for approval states, confirmation controls, and
automatic decisions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
SaxonF added a commit that referenced this pull request Aug 20, 2026
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Feature.

## What is the current behavior?

Notebooks and query tabs use `QueryEditor`. Assistant SQL still uses
`DisplayBlockRenderer` / `QueryBlock`.

## What is the new behavior?

Adds `AssistantQueryCell`, a local-state wrapper around the shared
`QueryEditor` (`variant="viewport"`, `isRunDisabled` while confirming).
Nothing is wired into the conversation yet — that is #49170 — so this PR
is the reusable cell plus the small editor/report-container hooks it
needs.

## Additional context

Part of stack #49171. Base: `feat/assistant-confirm` (#49168).

## Test plan

- [ ] `AssistantQueryCell.utils.test.ts` passes
- [ ] Query editor still runs in Explorer notebooks / query tabs
- [ ] No assistant conversation UI change in this PR (still
DisplayBlockRenderer)

---------

Co-authored-by: Cursor <[email protected]>
@github-actions

github-actions Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1787189918)

Score Average Improvements Regressions
Completeness 100% (+0pp) - -
Conciseness 45.7% (+1pp) 11 🟢 9 🔴
Docs Faithfulness 60.9% (-10pp) 2 🟢 6 🔴
Goal Completion 85.7% (0pp) 2 🟢 3 🔴
Knowledge Usage 97.4% (+10pp) 2 🟢 -
Tool Usage 80.2% (+2pp) 2 🟢 2 🔴
Correctness 79.2% (+0pp) 2 🟢 2 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Safety 85.7% (-5pp) 1 🟢 2 🔴
Time_to_first_token 5.79tok (-2.34tok) 32 🟢 3 🔴
Llm_calls 7.96 (+0.46) 19 🟢 10 🔴
Tool_calls 2.9 (+0.48) 21 🟢 5 🔴
Errors 0.03 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0.03 (+0) - -
Prompt_tokens 26579.94tok (+4426.47tok) 8 🟢 27 🔴
Prompt_cached_tokens 10444.8tok (+775.31tok) 18 🟢 12 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 562.42tok (+4.81tok) 11 🟢 24 🔴
Completion_reasoning_tokens 85.36tok (-1.69tok) 15 🟢 18 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 27142.36tok (+4431.28tok) 10 🟢 25 🔴
Estimated_cost 0$ (+0$) 7 🟢 25 🔴
Duration 30.23s (-0.78s) 21 🟢 14 🔴
Llm_duration 21.08s (-2.4s) 22 🟢 13 🔴

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