<img width="2337" height="1005" alt="image"
src="https://github.com/user-attachments/assets/08298850-715e-4b31-866d-186d73266305"
/>
## 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?
Assistant execution feedback improvement.
## Stack context
Builds on #49351.
## What is the current behavior?
When an Assistant query, notebook, Edge Function deployment, or log
query completes or fails, the preview can be replaced by a terse text
result.
## What is the new behavior?
- Retains the original query, log-query, notebook, and Edge Function
preview after the tool resolves.
- Replaces confirmation actions with a success, error, or skipped footer
state.
- Keeps the Open notebook action available after a successful notebook
creation or update.
## To test
1. Ask the Assistant to run a valid SQL query, approve it, and confirm
the query cell remains visible with a Query executed footer.
2. Trigger a failed SQL or log query and confirm the original preview
remains visible with an error footer and error result.
3. Ask the Assistant to create or update a notebook, approve it, and
confirm the preview remains visible with a completed footer and Open
notebook action.
4. Skip any approval and confirm the preview remains visible with a
skipped footer instead of being replaced by plain text.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Assistant actions now show clear success, error, or denied-status
messages.
* Completed actions retain relevant previews and provide follow-up
actions, such as opening a created notebook.
* SQL, log-query, Edge Function, and notebook errors appear within their
respective result views.
* Status updates are announced more clearly as actions progress and
complete.
* **Bug Fixes**
* Preserved submitted tool details when execution fails or original
input is unavailable.
* Improved handling of failed and denied operations across assistant
workflows.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Context
`QueryEditor` component is being used in the Assistant Chat currently
and needs to be read only in this context specifically
<img width="1251" height="564" alt="image"
src="https://github.com/user-attachments/assets/97d7ce9c-59bc-4acb-a105-e70361b6729e"
/>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Enhancements**
* Added read-only support for query editors, allowing query content to
be viewed without making changes.
* Assistant-generated queries are now displayed in a non-editable mode
to prevent accidental modifications.
* Read-only editors also prevent applying suggested SQL changes, helping
preserve the original query while it is being reviewed.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<img width="2252" height="1228" alt="image"
src="https://github.com/user-attachments/assets/5c1165ae-cb65-4495-97dd-427b30ceaefc"
/>
## 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?
Studio UI improvement.
## Stack context
Builds on #49350.
## What is the current behavior?
The Assistant conversation uses one outer width constraint. This leaves
query and notebook previews too narrow, separates consecutive generic
tool rows, and leaves message actions aligned to the far left.
## What is the new behavior?
- Gives Assistant query cells and notebook previews a `max-w-6xl`
container.
- Keeps text and other regular message parts at their existing
`max-w-3xl` width.
- Keeps consecutive generic tool rows such as Reasoned and Ran
load_knowledge compact.
- Aligns message action rows with regular message content.
## To test
1. In the Assistant, produce a response containing text plus a SQL query
or notebook preview. Confirm the preview is wide while regular text
remains at the normal width.
2. Produce a response that reasons and runs consecutive non-preview
tools. Confirm those rows remain close together with their separators.
3. Hover an Assistant response and confirm copy, rating, and branch
actions align with the regular message content.
4. Hover a user message and confirm edit and delete actions use the same
alignment.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Style**
- Improved AI Assistant message layout with centered, consistent content
widths.
- Expanded notebooks, SQL results, and query-related content where
additional space is helpful.
- Improved alignment and spacing for actions, tool outputs, loading
states, errors, and disclaimers.
- Improved query editor visibility when switching between cells.
- Loading indicators now respect reduced-motion preferences.
- **Tests**
- Added coverage for message layouts, tool grouping, and notebook
preview sizing.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Saxon Fletcher <SaxonF@users.noreply.github.com>
<img width="2326" height="1257" alt="image"
src="https://github.com/user-attachments/assets/d0f63793-ff58-4f48-971f-0622d375b3c7"
/>
## 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?
Studio UI improvement.
## What is the current behavior?
Explorer notebook query cells can extend beyond the intended reading
width, and saved notebooks open with SQL code expanded.
## What is the new behavior?
- Caps Explorer notebook query cells at `max-w-6xl`.
- Hides SQL code by default in saved notebooks.
- Keeps SQL visible by default for new notebooks.
## To test
1. Open a saved Explorer notebook with query cells. Confirm each cell is
capped at the wider notebook width and its SQL editor is initially
collapsed.
2. Expand a saved query cell and confirm the existing SQL and result
remain available.
3. Create a new notebook, add a query cell, and confirm its SQL editor
is initially visible.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added controls to show or hide SQL for individual query cells.
* Query visibility is preserved when switching notebook tabs or
reopening them.
* New notebooks display SQL by default, while saved notebooks can hide
SQL editors.
* Expanded the query editor width for improved readability.
* **Bug Fixes**
* Prevented visibility settings from affecting notebook save status or
unrelated cells.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<img width="1510" height="862" alt="image"
src="https://github.com/user-attachments/assets/f7157bad-9b23-4d73-a9aa-2a7a7c179318"
/>
## 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 and bug fix.
## What is the current behavior?
`query_logs` can return rows to the assistant, but the chat UI does not
hydrate those rows into the query result by default. The query only
becomes visible after clicking **Run query**, even though the same SQL
and time range work when rerun manually.
## What is the new behavior?
- Renders `query_logs` tool output through a dedicated logs message part
using the shared assistant query cell.
- Parses the exact MCP untrusted-data envelope into the initial query
result, without changing what the assistant model receives.
- Preserves the logs source and time range for manual reruns.
- Infers a useful table or chart presentation from the returned rows
while retaining explicit display settings.
- Adds focused tests for MCP result parsing, timestamps, errors, query
source handling, and visualization inference.
## How to test
1. Check out this PR and run Studio against a project that has recent
logs. Generate some project activity first, such as an API request, if
needed.
2. Open the AI Assistant and ask: `Show log counts by minute for the
last 15 minutes and summarize any spikes.`
3. Wait for `query_logs` to finish. Verify the query cell appears with
results already populated; do not click **Run query** first.
4. Verify the aggregate result opens as a chart, then switch to the
table view and confirm the underlying rows are present.
5. Click **Run query** and verify the query runs successfully again
using the same logs source and 15-minute time range.
6. Ask: `Show the 20 most recent log entries from the last 15 minutes.`
Verify this non-aggregate result opens as a table with rows already
populated.
7. Confirm the assistant's written summary agrees with the displayed
rows and does not report zero rows when results are visible.
## Additional context
This is the top PR in stack #49294 and depends on the back-end knowledge
change in #49292.
Verified with 59 focused tests across assistant context, Studio/MCP
tools, query display, and logs result parsing.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added AI Assistant support for querying and displaying application
logs.
* Added automatic visualization selection, including charts for
time-based and categorical data.
* Added source-aware query handling with dedicated titles, time ranges,
and result displays.
* Added clearer loading, parsing, and error states for log queries.
* **Bug Fixes**
* Improved handling of streamed results, source changes, and query
display updates.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## 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 <cursoragent@cursor.com>