Skip to content

fix(preview): count the app's own 403/404 as routed - #57

Merged
mayur-tolexo merged 1 commit into
mainfrom
fix/preview-wait-app-404
Oct 17, 2026
Merged

mayur-tolexo merged 1 commit into
mainfrom
fix/preview-wait-app-404

Conversation

@mayur-tolexo

@mayur-tolexo mayur-tolexo commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Why

get_port_url / get_url wait until a fresh preview URL is routed, and they took any 403 or 404 to mean "not yet". That is right for the edge's own answers in the first seconds after a port is exposed, but an app can answer 403 or 404 at its root too: an API-only server with no / route, or a sign-in-gated page. Against such an app the wait ran out its whole timeout (60 s by default) and then raised, even though the URL had been live all along.

What

The edge adds an upstream header to every response the app produced and never to its own refusals. A 403 or 404 carrying that header now counts as routed; one without it keeps the wait going. Nothing else changes: other statuses still count as routed, and a connection error still means not yet. The async client matches. A patch changeset is included.

Example

A FastAPI app with only GET /api exposed on port 3000: sandbox.get_url(3000) used to raise "was not routable"; it now returns the URL as soon as the route is live.

Testing: new tests for the edge-vs-app rule, sync and async; the existing not-routed and timeout tests still pass. ruff check, ruff format --check, mypy and pytest pass.

The JS SDK gets the same change in NeevCloudAI/neev-sdk-js#71.

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a27cc348-04b9-4bb0-8c7e-16c7353eeb59
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

get_url/get_port_url treated every 403 or 404 as "not routed yet", so an
app that answers 404 or 403 at its root (an API-only server, a sign-in page)
made the wait run out its whole timeout and raise, though the URL was live.
The edge marks every response the app produced with an upstream header and
never marks its own refusals, so a marked 403/404 now counts as routed. The
async client matches.
@mayur-tolexo
mayur-tolexo force-pushed the fix/preview-wait-app-404 branch from 0984a0d to 7e32281 Compare October 17, 2026 05:42
@mayur-tolexo
mayur-tolexo merged commit 1919014 into main Oct 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant