Repository navigation
feat: bound run_notebook cost - #511
Conversation
Coverage Report for CI Build 42036110285Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.2%) to 98.02%Details
Uncovered Changes
Coverage Regressions3 previously-covered lines in 2 files lost coverage.
Coverage Stats💛 - Coveralls |
Stop after cancellation and charge named size-limit errors to the remaining run budget.
commit: |
Rodriguespn
left a comment
There was a problem hiding this comment.
Thx for addressing my comments. Left some more here. After that, I think we're aligned with our expectations for Notebooks through MCP.
Note: We'll have to update https://github.com/supabase/platform/pull/41193 to reflect these changes later. Also, left another comment on #514 to change the error message when the notebook has more than 50 cells
Rodriguespn
left a comment
There was a problem hiding this comment.
Approving, thanks for turning these around. I checked it against what we agreed on the
call.
The part of the third bullet point that isn't done here is counting the work the service does (a timed-out cell is still charged 0) and stopping pg-meta/Postgres once the 1 MB read limit is hit. I'm fine leaving both to a follow-up.
AI-1415 only covers wall time today (run deadline plus a per-cell statement timeout), so could we add these two to it, or open a separate ticket?
Also, a rebase and conflict resolution should fix the CI.
Nit, optional: "Later cells were skipped." is still added when the oversized cell is the last one.
…ok-cost # Conflicts: # packages/mcp-server-supabase/src/tools/destructive-sql.ts
|
Thanks Pedro! I've widened AI-1415 to cover both: counting the work errored cells cause, and stopping Postgres once the 1 MB read limit is hit. CI is green after merging main, and the last-cell wording nit is fixed in a follow-up commit. |
Stacked on #511. Adds an optional `cells` list (cell ids) to `run_notebook`, so an agent can re-run just the cell it fixed instead of the whole notebook. Leaving it out runs the whole notebook as before. Selected cells run in notebook order. There's no dependency resolution, so the agent should include any setup cell it needs. Duplicate ids are de-duped. Unknown or non-query ids are skipped, and each one comes back in the results as `{ cell_id, status: 'skipped', reason }` so the agent can spot a typo or stale id. An empty list, or a selection with no matching query cell, fails as a `ToolCallerError` before any prompt or query runs. The cell cap, result budget, confirmation prompt and `notebook_run` counts all apply to the selected cells, and skipped ids don't count toward any of them. An approval is tied to the selection it was given for, so approving one set of cells doesn't approve a different one. Selecting more than 50 query cells is refused with a message that tells the agent to call `run_notebook` again with the next 50 or fewer ids. Closes AI-1402
🤖 I have created a release *beep* *boop* --- <details><summary>mcp-server-supabase: 0.16.0</summary> ## [0.16.0](mcp-server-supabase-v0.15.0...mcp-server-supabase-v0.16.0) (2026-11-05) ### Features * bound run_notebook cost ([#511](#511)) ([e90d110](e90d110)) * **mcp-server-supabase:** run selected notebook cells ([#514](#514)) ([8d04248](8d04248)) * **notebooks:** add delete_notebook tool with elicitation confirmation ([#510](#510)) ([f36f74a](f36f74a)) * **notebooks:** enable create_notebook and run_notebook tools ([#509](#509)) ([addc4e5](addc4e5)) ### Bug Fixes * **feedback:** accept null project_id and surface the feedback length limit ([#521](#521)) ([994f56c](994f56c)) * hint agents to re-copy malformed project refs ([#522](#522)) ([0c650bf](0c650bf)) * **notebooks:** return caller errors for client-caused notebook refusals ([#512](#512)) ([5f0d393](5f0d393)) * **pg-meta:** report partition FKs once and add partition_of to list_tables ([#508](#508)) ([2c7fa82](2c7fa82)) * **pg-meta:** return complete check expressions for NOT VALID and NO INHERIT constraints ([#517](#517)) ([c54bb40](c54bb40)) * **sql:** skip destructive confirmation for planner-only EXPLAIN ([#519](#519)) ([95745e5](95745e5)) * tolerate non-URL edge function paths in api platform ([#438](#438)) ([00d07a4](00d07a4)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
This puts limits on how much one
run_notebookcall can do (AI-1353). A notebook with more than 50 query cells is now refused before any prompt or query runs, and the agent is told to split it. 50 is a starting value. Studio has no cell limit today.The run's existing ~1 MB result budget now stops execution. Once it's spent, later query cells come back as
skippedand don't run. A cell whose result is too big for what's left spends the rest of the budget, so the cells after it are skipped too (other errors don't spend budget). Log cells get the remaining budget asmax_result_bytes, same as database cells, through a new optional field onQueryLogsOptions. Hosted honours it (supabase/platform#41193). The local server keeps calling the public logs API without it and relies on the existing post-run size check.@supabase/mcp-server-supabase/platformnow exportsResultTooLargeError. A host that stops reading atmax_result_bytesthrows an error with that name, andrun_notebooktreats it like its own size check. supabase/platform#41193 throws it from both bounded reads, so this applies on hosted once the pin includes this PR.A database cell runs without confirmation only when every statement is a plain read (
select,values,table,show,explain, or awiththat doesn't insert/update/delete/merge), and those cells run read-only. Everything else, includingcall,do, transaction control andset, goes through confirmation and runs in the server's normal mode once accepted. Aselectthat calls a writing function still runs without a prompt and may fail at the database. This came out of the review of supabase/platform#38799.If the client cancels the request, no further cells run. The cell already in flight finishes. A run-level deadline is a follow-up in AI-1415.