Repository navigation
feat(cli): include supabase user id in feedback context payload - #6190
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e989ef387b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
e989ef3 to
145e21c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 145e21cf90
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Attach the gotrue user UUID to `supabase feedback add` submissions via the `submit_interfaces_feedback` RPC's optional user_id parameter, mirroring the project-ref convention: best-effort and never failing the submission. The id is sourced from the persisted telemetry identity (distinct_id in ~/.supabase/telemetry.json, stamped at login) — a synchronous in-memory read, so the command keeps its zero-auth posture and works logged-out (user_id omitted). Submit-side attribution is gated on telemetry consent: opted-out users submit anonymously. No deviceId fallback — user_id is semantically a gotrue UUID, not an anonymous device id. Because the RLS policies require a matching x-feedback-user-id header to read or delete a row that was submitted with a user_id, `feedback delete` now presents the persisted id on both the preview and the delete requests. Unlike submission, the header is NOT consent-gated — it is functional auth context, and gating it would strand rows submitted before a consent opt-out. Logged-out runs omit the header, which still matches all anonymous rows. Co-Authored-By: Claude Fable 5 <[email protected]>
145e21c to
d679b9a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d679b9a083
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| userId: | ||
| telemetryRuntime.consent === "granted" ? telemetryRuntime.identity.current() : undefined, |
There was a problem hiding this comment.
Validate the persisted identity before submitting it
When telemetry.json contains an empty or non-UUID distinct_id—which the telemetry schema accepts as any Schema.String, including legacy-imported or manually edited state—this forwards it as the UUID-valued user_id RPC argument. Postgres then rejects the request instead of merely omitting the optional attribution, so otherwise valid feedback cannot be submitted; validate the value as a UUID and omit it when invalid.
Useful? React with 👍 / 👎.
The not-found message listed the project-ref context gate as a possible cause but not the user-id gate added alongside it — a row submitted while logged in reports "not found" after logout until the user logs back in as the same account. Fold both context gates into one clause with their remediations. Co-Authored-By: Claude Fable 5 <[email protected]>
c4ae2b2
into
kanad-claude-2026-07-22/feedback-command
## Why Supabase CLI added `supabase feedback` commands recently to let agents / humans share feedback about our tooling. We also want to capture feedback from users of our MCP server (e.g. ChatGPT, Claude web, etc.) for when CLI isn't available. ## What New MCP tools under a new `feedback` feature group: - `submit_feedback` - `delete_feedback` The tools write to the prod `interfaces_feedback` table normally, or staging for any other API URL. This PR includes support for the stdio / `--http` server, other platforms can opt-in later (e.g. we can omit feedback tools on self-hosted so that it doesn't phone home). For the package implementation,`user_id` comes from the `X-Gotrue-Id` header on a Management API response, which the [CLI relies on too](https://github.com/supabase/cli/blob/8a549dffa6bc5c88069c61c1f55ef55ad9b82ae2/apps/cli/src/command-internal/identity-stitch.ts#L10-L20), but remote MCP can populate this ID a different way. The MCP client name and version go in `metadata`. I hide both tools in `read_only` mode, since even though this doesn't impact users' projects, the feedback mutates a remote table. ## How to test Start the [dev server](https://github.com/supabase/mcp/blob/bd2d33f1b401adbbf913b3f40eb460fd67e1f9ea/CONTRIBUTING.md#development-setup) with `--api-url https://api.supabase.green` and connect an MCP client. Then ask it to submit throwaway feedback: ```text Use the Supabase MCP to submit feedback saying "Test feedback from reviewing #474, please ignore". Show me the delete token. ``` Check the new row in the `interfaces_staging` branch of the [supabase project](https://supabase.com/dashboard/project/actixlblmrqglneypada/editor/18209?schema=public).Then delete it: ```text Delete that feedback using the delete token. ``` I ran a round trip with Claude Code in staging, see sample row: ```json {"idx":0,"id":488,"created_at":"2026-10-19 20:20:46.389158+00","feedback":"Test feedback from reviewing #474, please ignore","delete_token":"4f354c21-4498-4232-8d7c-21b280bfdc2e","user_agent":"supabase-mcp/0.14.0","user_id":"20e65d1b-489d-4b03-9e0b-e58f7b9aff45","project_ref":"wzukuhfteohjnlxczohs","metadata":"{\"source\": \"mcp\", \"client_name\": \"claude-code\", \"client_version\": \"2.1.303\"}"} ``` <img width="3000" height="348" alt="CleanShot 2026-10-19 at 4 20 53 PM@2x" src="https://github.com/user-attachments/assets/6c73d33d-1514-45aa-a2cb-6253aba912c3" /> <img width="644" height="299" alt="CleanShot 2026-10-19 at 4 23 08 PM@2x" src="https://github.com/user-attachments/assets/b29380c9-fc99-4b99-ac78-cb5acce8e7a9" /> ## Notes: Related: - [feat(cli): add feedback add and delete commands for quick CLI feedback (supabase/cli#5988)](supabase/cli#5988) - [feat(cli): include supabase user id in feedback context payload (supabase/cli#6190)](supabase/cli#6190) - [MCP feedback tools design](https://linear.app/supabase/document/mcp-feedback-tools-design-32196aac7d22) Follow-ups: - [AI-1335: Enable MCP feedback tools in the hosted MCP API](https://linear.app/supabase/issue/AI-1335/enable-mcp-feedback-tools-in-the-hosted-mcp-api) - [AI-1333: Pass MCP feedback operations in CLI-linked Studio](https://linear.app/supabase/issue/AI-1333/pass-mcp-feedback-operations-in-cli-linked-studio) - [AI-1336: Document the MCP feedback tools](https://linear.app/supabase/issue/AI-1336/document-the-mcp-feedback-tools) Closes AI-1017
Summary
Attach the gotrue user UUID to
supabase feedback addsubmissions via thesubmit_interfaces_feedbackRPC's optionaluser_idparameter, mirroring the project-ref convention: best-effort and never failing the submission.The id is sourced from the persisted telemetry identity (distinct_id in ~/.supabase/telemetry.json, stamped at login) — a synchronous in-memory read, so the command keeps its zero-auth posture and works logged-out (user_id omitted). Submit-side attribution is gated on telemetry consent: opted-out users submit anonymously. No deviceId fallback — user_id is semantically a gotrue UUID, not an anonymous device id.
Because the
interfaces_feedbackRLS policies require a matchingx-feedback-user-idheader to read or delete a row that was submitted with auser_id,feedback deletenow presents the persisted id on both the preview and the delete requests. Unlike submission, the header is not consent-gated — it is functional auth context, and gating it would strand rows submitted before a consent opt-out. Logged-out runs omit the header, which still matches all anonymous rows.Stacked on #5988 (base:
kanad-claude-2026-07-22/feedback-command); this is a clean reapplication of the change from #5998 onto the RPC-basedFeedbackClient.Linked issue
closes CLI-2008
🤖 Generated with Claude Code