Matt Rossman
87681812a0
fix(studio): assistant get_active_incidents url in prod (#51047)
The Assistant's `get_active_incidents` tool has [failed in prod 99.8% of
the time over the past 60
days](https://supabase.slack.com/archives/C051L8U2EJF/p1790712805774689),
so users reporting outages get told it couldn't check incident status.
The failures never showed up as errors, which is why nobody noticed.
The Assistant now includes the `/dashboard` base path when it calls its
own API routes, so the tool stops hitting a 404 in prod
([`/api/incident-status`](https://supabase.com/api/incident-status) is a
404,
[`/dashboard/api/incident-status`](https://supabase.com/dashboard/api/incident-status)
is a 200). The tool also throws on a failed fetch now instead of
returning an `{ error }` result. That way failures show up as span
errors in Braintrust and as a failed tool call in the UI. The model
still gets the error message and tells the user it couldn't check.
When the fetch fails (in dashboard):
| Before (prod) | After (local, path temporarily broken) |
| --- | --- |
| <img width="1036" height="784" alt="CleanShot 2026-09-29 at 5 08 49
PM@2x"
src="https://github.com/user-attachments/assets/4539f968-4aa6-49a5-8c7f-7911b6b497a0"
/> | <img width="1026" height="716" alt="CleanShot 2026-09-29 at 5 08 06
PM@2x"
src="https://github.com/user-attachments/assets/7c9a565c-efe1-4d1a-901b-e440bbb5a739"
/> |
When the fetch fails (in Braintrust):
| Before (prod) | After (local, path temporarily broken) |
| --- | --- |
| <img width="2218" height="920" alt="CleanShot 2026-09-29 at 5 19 07
PM@2x"
src="https://github.com/user-attachments/assets/87860568-b50f-49ee-98fd-4c82f14d1913"
/> | <img width="2218" height="920" alt="CleanShot 2026-09-29 at 5 19 10
PM@2x"
src="https://github.com/user-attachments/assets/64f58d47-e083-464e-b8d0-8b9c57710a05"
/> |
When the fetch works (local):
| Dashboard | Braintrust |
| --- | --- |
| <img width="1054" height="808" alt="CleanShot 2026-09-29 at 5 20 58
PM@2x"
src="https://github.com/user-attachments/assets/1c9e4cf8-79f0-48e6-b95a-1694fc00a9f9"
/> | <img width="2918" height="1144" alt="CleanShot 2026-09-30 at 9 07
03 AM@2x"
src="https://github.com/user-attachments/assets/0d2b9685-57a9-4028-a451-272b3de8e23a"
/> |
Ran it locally with tracing on. Here's a [successful
call](https://www.braintrust.dev/app/supabase.io/p/Assistant/logs?r=251bcd44-c55b-44bb-9ce2-b034b26f8832),
and one with the path temporarily broken, which now [logs a span
error](https://www.braintrust.dev/app/supabase.io/p/Assistant/logs?r=637f2dc8-f65b-4d65-9d86-0511b36e8685).
Local dev has no base path, so the prod URL is covered by the new
`getBasePathURL` tests.
Closes AI-1272
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Incident lookups now report fetch, HTTP, parsing, and validation
errors rather than returning an empty incident result.
* AI SQL generation now accounts for the configured site base path when
building its service URL.
* **Improvements**
* Site URLs now handle trailing slashes and existing base paths
consistently, avoiding duplicate path segments.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-10-05 09:37:51 -04:00
..
2026-09-21 10:53:14 +10:00
2026-10-05 09:37:51 -04:00
2026-09-28 11:36:29 -04:00
2026-09-17 12:18:48 +02:00
2026-09-08 18:26:41 +08:00
2026-07-25 00:00:37 +10:00
2026-09-29 15:28:49 -04:00
2026-09-29 07:53:28 -04:00
2026-09-02 19:02:37 +08:00
2026-03-19 11:43:02 +11:00
2026-04-07 20:34:10 -04:00
2025-07-03 12:41:11 +02:00
2026-09-28 18:21:34 +03:00
2026-10-01 12:04:07 +10:00
2026-10-01 12:04:07 +10:00
2026-04-27 17:42:34 +08:00
2025-10-22 08:57:49 -04:00
2026-09-17 12:18:48 +02:00
2026-09-17 12:18:48 +02:00
2026-07-22 13:57:03 +02:00
2026-04-07 20:34:10 -04:00
2026-05-06 14:52:36 +02:00
2026-05-06 14:52:36 +02:00
2026-03-23 21:20:47 +00:00
2026-09-10 16:45:54 +08:00
2026-04-07 20:34:10 -04:00
2026-08-18 15:33:04 +08:00
2026-08-18 15:33:04 +08:00
2026-04-07 20:34:10 -04:00
2026-05-04 13:08:06 -04:00
2026-08-04 09:02:40 -04:00
2026-08-04 09:02:40 -04:00
2026-04-07 20:34:10 -04:00
2026-06-04 07:41:28 -06:00
2026-09-08 16:40:36 +01:00
2026-08-24 17:23:25 +10:00
2026-10-05 09:37:51 -04:00
2026-10-05 09:37:51 -04:00
2026-09-28 11:36:29 -04:00
2026-04-07 20:34:10 -04:00
2025-06-27 11:10:25 +02:00
2026-09-30 12:59:36 +08:00
2026-09-30 12:59:36 +08:00
2026-07-08 14:52:59 +08:00
2026-07-08 14:52:59 +08:00
2026-04-07 20:34:10 -04:00
2025-08-14 21:23:08 +02:00
2026-08-07 13:40:18 +07:00
2026-08-07 13:40:18 +07:00
2026-05-04 07:08:35 -06:00
2026-04-06 13:52:53 +00:00
2026-04-08 16:54:31 +02:00
2026-04-08 16:54:31 +02:00
2026-04-07 20:34:10 -04:00
2024-07-17 13:27:00 +08:00
2026-09-15 10:07:49 +10:00
2026-09-15 10:07:49 +10:00
2026-06-25 11:08:26 -04:00
2026-07-08 14:52:59 +08:00
2026-07-08 14:52:59 +08:00
2026-03-09 15:25:05 +07:00
2026-03-09 15:25:05 +07:00
2026-07-06 17:38:03 +08:00
2026-07-06 17:38:03 +08:00
2026-08-14 14:56:23 +02:00
2026-03-11 13:55:20 +01:00
2026-04-07 20:34:10 -04:00
2023-11-15 12:38:55 +01:00
2026-04-07 20:34:10 -04:00
2026-04-07 20:34:10 -04:00
2026-05-13 14:57:08 -04:00
2026-09-10 16:45:54 +08:00
2026-04-07 20:34:10 -04:00
2026-05-27 15:19:54 +08:00
2026-09-10 16:45:54 +08:00
2026-09-10 16:45:54 +08:00
2026-04-27 17:42:34 +08:00
2026-04-02 11:09:18 +11:00
2026-06-09 08:25:29 -06:00
2024-11-22 16:42:12 +08:00
2026-06-09 08:25:29 -06:00
2026-04-02 11:09:18 +11:00
2025-10-22 08:57:49 -04:00
2025-10-22 08:57:49 -04:00
2026-05-04 13:08:06 -04:00
2026-08-18 11:27:09 +08:00
2026-07-08 14:52:59 +08:00
2026-07-08 14:52:59 +08:00
2026-07-08 14:52:59 +08:00
2025-10-22 08:57:49 -04:00
2025-10-22 08:57:49 -04:00
2026-04-07 20:34:10 -04:00
2026-01-22 11:17:49 -05:00
2026-09-15 11:43:24 +02:00
2026-09-15 09:38:36 -06:00
2026-10-05 18:36:13 +11:00
2026-10-05 18:36:13 +11:00
2026-09-25 15:38:23 +08:00
2026-09-25 15:38:23 +08:00
2026-06-18 15:34:56 +08:00
2026-06-18 15:34:56 +08:00
2026-05-04 16:21:47 +08:00
2026-05-04 16:21:47 +08:00
2026-04-07 20:34:10 -04:00
2026-04-07 20:34:10 -04:00
2026-04-07 20:34:10 -04:00
2026-04-27 17:42:34 +08:00
2026-05-13 14:57:08 -04:00
2026-07-02 11:47:13 +02:00
2026-07-31 15:37:05 -07:00
2026-09-21 10:53:14 +10:00
2026-09-02 19:02:37 +08:00
2026-07-10 17:35:27 +08:00
2026-03-30 10:58:37 +02:00
2026-05-13 14:57:08 -04:00
2026-09-10 16:45:54 +08:00
2026-04-27 17:42:34 +08:00
2026-02-11 09:50:11 +01:00
2023-11-15 12:38:55 +01:00
2026-09-14 16:01:46 +08:00
2026-09-14 16:01:46 +08:00