Repository navigation
feat(operator): Add opt-in runOperatorSql tool - #1989
Merged
Merged
Conversation
Add the experimental operator-tools feature. When an app enables it, non-public Conversations get runOperatorSql, which runs one SQL statement against the app database and returns up to 200 rows. The tool skips Conversation privacy checks, so it is meant for isolated deployments such as Previews. The app decides where to enable it. Co-Authored-By: Daniel Griesser <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
1 screenshot change — 1 changed · 0 added · 0 removed Review screenshots in Frameshift
|
HazAT
marked this pull request as ready for review
September 30, 2026 10:29
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 77fa2ee. Configure here.
Operator SQL ran through the shared pool, so session commands such as BEGIN or SET stayed on the connection for later app queries. A statement list also ran in full but reported zero rows. Add queryIsolated to the SQL executor. It runs one named statement on its own connection and destroys that connection afterwards. The named statement uses the extended protocol, so Postgres rejects statement lists before any of them runs.
HazAT
approved these changes
Sep 30, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Preview deployments get their own Neon database branch, but nothing can operate on that data except the deployment itself. This lets the Preview's own Junior do it from a dashboard Conversation, so we can test data changes such as the Spaces backfill in #1988 without shell or Neon access.
This adds an experimental
operator-toolsfeature. When an app enables it, non-public Conversations get a deferredrunOperatorSqltool. It runs one SQL statement against the app database, with optional$1params, and returns up to 200 rows. Writes are allowed. Postgres SQLSTATE errors come back as input errors so the Agent can fix the statement.Core does not decide where the tool is safe. The app opts in.
junior-prodwill enable it only whenVERCEL_ENV === "preview"andJUNIOR_PREVIEW_OPERATOR=true. That change follows once this ships in a release, because an unknown experimental key fails app startup.Privacy. The tool skips every Conversation privacy check. A Neon Preview branch is a copy of production data, so the Agent can read private Conversations there. To keep results out of public views, the tool is absent from public Conversations. Tool payloads in private Conversations are already kept out of traces. The docs say never to enable this in production.
The Spaces backfill needs model calls, so SQL alone can't run it. #1988 will add a backfill operator tool behind the same flag after this lands.
via daniel.
--
View Junior Session [Sentry]