Title: [FEATURE] Consume the naked upstream HTTP status code from any-sdk and remove response-text munging · Issue #681 · stackql/stackql · GitHub
Open Graph Title: [FEATURE] Consume the naked upstream HTTP status code from any-sdk and remove response-text munging · Issue #681 · stackql/stackql
X Title: [FEATURE] Consume the naked upstream HTTP status code from any-sdk and remove response-text munging · Issue #681 · stackql/stackql
Description: Description The issue #670 fix (MCP tools surface upstream HTTP errors instead of empty result sets, with 404 exempted as database-semantics "zero rows") currently recovers the upstream status by parsing any-sdk's error message text, bec...
Open Graph Description: Description The issue #670 fix (MCP tools surface upstream HTTP errors instead of empty result sets, with 404 exempted as database-semantics "zero rows") currently recovers the upstream status by p...
X Description: Description The issue #670 fix (MCP tools surface upstream HTTP errors instead of empty result sets, with 404 exempted as database-semantics "zero rows") currently recovers the upstream s...
Opengraph URL: https://github.com/stackql/stackql/issues/681
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[FEATURE] Consume the naked upstream HTTP status code from any-sdk and remove response-text munging","articleBody":"## Description\n\nThe issue #670 fix (MCP tools surface upstream HTTP errors instead of empty result sets, with 404 exempted as database-semantics \"zero rows\") currently recovers the upstream status by parsing any-sdk's error message text, because the status code is not carried through the any-sdk invoker boundary (`providerinvoker.Result` is just `{Body, Messages}`):\n\n- `internal/stackql/execution` (`isUpstreamNotFound`): the structured fragment regex `(?i)status code:?\\s*(\\d{3})` is authoritative when present (a 403 whose body mentions \"not found\" is still an error); unstructured bodies (HTML / XML / plain text published verbatim) fall back to a loose, any-case match:\n\n~~~go\nvar upstreamNotFoundLooseRegex = regexp.MustCompile(`(?i)\\b404\\b|not\\s+found`)\n~~~\n\n- `internal/stackql/mcpbackend` (`classifyBackendError`): the same fragment regex classifies MCP tool errors as `upstream http error: {\"http_status\": N, \"retryable\": bool}` (408/429/5xx retryable).\n\nThis works for mainstream provider error shapes but is fragile by construction: the status is only present when any-sdk happens to format it into the text, and the loose fallback trades precision for safety (a false positive restores the historical empty-result behaviour, which is the safe direction).\n\n## Proposal\n\nOnce \u003clink to any-sdk issue\u003e lands and the any-sdk dependency is bumped:\n\n1. Read `StatusCode` from the invoker result in `internal/stackql/execution` (`monoValentExecution.GetExecutor`): exempt 404 by value, error on other 4xx/5xx under strict upstream error semantics (MCP only).\n2. Classify by value in `internal/stackql/mcpbackend` (`classifyBackendError`), keeping the wire contract (`http_status`, `retryable`) unchanged.\n3. Delete `upstreamStatusCodeRegex` (both copies), `upstreamNotFoundLooseRegex` and the text handling in `isUpstreamNotFound`.\n\nThe behaviour contract is already pinned by robot scenarios in `test/robot/functional/mcp.robot` and stays unchanged as the regression net:\n\n~~~text\nMCP HTTP Upstream 403 Surfaces As Non Retryable Tool Error\nMCP HTTP Upstream 429 Surfaces As Retryable Tool Error\nMCP HTTP Upstream 404 Returns Empty Result Set\n~~~\n\n## Depends on\n\n[\u003clink to any-sdk issue\u003e](https://github.com/stackql/any-sdk/issues/115), plus the next any-sdk release/bump.\n","author":{"url":"https://github.com/jeffreyaven","@type":"Person","name":"jeffreyaven"},"datePublished":"2026-07-03T09:50:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/681/stackql/issues/681"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:44b5b2af-0a0e-8415-3366-bcd43f8bcd49 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8168:1880B3:273409B:37D9669:6A50FC58 |
| html-safe-nonce | 7914cf615f2dec0b03ef10f5b2a6b335b812b8d1cb51b0c118c9ae615856839c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTY4OjE4ODBCMzoyNzM0MDlCOjM3RDk2Njk6NkE1MEZDNTgiLCJ2aXNpdG9yX2lkIjoiMTM5OTc5NTU0Nzk1OTc4NjU4NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8d717c30abb961223c4e26cc6e0b0bc088de3ad9cff68f78e9381c432286e6a6 |
| hovercard-subject-tag | issue:4802424440 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/stackql/stackql/681/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4ca93bf4a5d455bd8941eb4fae51cf9cd086662b81509f6dd9e7b14e2ad99d5b/stackql/stackql/issues/681 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4ca93bf4a5d455bd8941eb4fae51cf9cd086662b81509f6dd9e7b14e2ad99d5b/stackql/stackql/issues/681 |
| og:image:alt | Description The issue #670 fix (MCP tools surface upstream HTTP errors instead of empty result sets, with 404 exempted as database-semantics "zero rows") currently recovers the upstream status by p... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jeffreyaven |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5266e58c17a510c403505cc811606465e90a881d2007ee7df1c4800d5c659838 |
| turbo-cache-control | no-preview |
| go-import | github.com/stackql/stackql git https://github.com/stackql/stackql.git |
| octolytics-dimension-user_id | 95105302 |
| octolytics-dimension-user_login | stackql |
| octolytics-dimension-repository_id | 443987542 |
| octolytics-dimension-repository_nwo | stackql/stackql |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 443987542 |
| octolytics-dimension-repository_network_root_nwo | stackql/stackql |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8d836581d020676cc0ef4a83cd2fe17e4af02c3d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width