Repository navigation
fix(showcase): raise /api/smoke upstream timeout from 25s to 45s - #4089
Merged
Merged
Conversation
jpr5
requested review from
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
April 19, 2026 03:26
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📣 Social Copy GeneratorGenerate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.
|
Cold-start on showcase packages with heavy Python agents (agno in particular) consistently lands just over the 25s budget, producing 502s on first probe with latency_ms: 25001 and stage: "timeout". Raise the upstream AbortSignal.timeout on /api/smoke from 25s to 45s across all 16 showcase packages that exercise the full agent round-trip, and bump Next.js maxDuration from 30s to 60s so the route can actually run that long. Also bumps the create-integration template so new packages inherit the new budget. Tail-latency beyond 45s will still alert — which is the intent. Evidence: agno 502 alerts tonight at 18:40 PDT and 19:42 PDT, both with latency_ms: 25001, stage: "timeout" on /api/smoke. /api/health already 200 on both probes — pure cold-start boundary issue.
jpr5
force-pushed
the
fix/smoke-timeout-45s
branch
from
April 19, 2026 03:56
f46283a to
df83668
Compare
jpr5
added a commit
that referenced
this pull request
Apr 19, 2026
The agno agent occasionally drops the terminal SSE event (TEXT_MESSAGE_END / RUN_FINISHED / RUN_ERROR) after emitting TEXT_MESSAGE_CONTENT, leaving the stream open until the client timeout fires. This surfaced as ~20+ /api/smoke 502s per night with stage="timeout" despite the agent producing valid output. Raising the timeout (PR #4089, 25s to 45s) does not help — any finite timeout still 502s because the stream never closes on the affected requests. Instead, read the SSE stream incrementally and bail as soon as we see a TEXT_MESSAGE_CONTENT event containing "OK", canceling the reader rather than awaiting a stream close that may never come. Verified against production: curl -m 35 https://showcase-agno-production.up.railway.app/api/smoke Before: 20+ seconds, 502 (stage:"timeout") After (simulated via node fetch with same logic): 7-16 seconds, 200 ok Only the agno production endpoint exhibits this behavior; spring-ai, langroid, llamaindex, pydantic-ai, and mastra all close their streams cleanly in under 1.5s, so their identical \`await res.text()\` smoke routes are not vulnerable in practice and are left untouched. A deeper fix belongs in the agno SDK's AGUI interface (it appears to not guarantee a terminal event when the model emits its final token without subsequent activity). Follow-up tracked separately.
4 of 5 tasks
zeekay
pushed a commit
to Dream-AI-4444/CopilotKit
that referenced
this pull request
Sep 11, 2026
…ilotKit#4089) ## Summary Cold-start 502s on showcase package smoke probes (notably `agno`) consistently land just over the 25s upstream budget. The Next.js `/api/smoke` route uses `AbortSignal.timeout(25000)` to call its own `/api/copilotkit` which proxies to the Python agent which calls the LLM. On cold start, the end-to-end round-trip takes >25s and the probe aborts with `latency_ms: 25001, stage: "timeout"`, returning 502. This PR raises the upstream budget from **25s -> 45s** across all showcase packages that exercise a full agent round-trip on smoke, and bumps Next.js `maxDuration` from 30s -> 60s so the route can actually run that long. The `create-integration` template is bumped too so new packages inherit the new budget. The 3 `langgraph-*` routes have a different (lightweight health probe) pattern and `ms-agent-dotnet` is already at 50s — their `maxDuration` is bumped for consistency but their abort budgets are left alone. **Evidence — agno 502 alerts tonight (PDT):** - 18:40 PDT attempt 1 — HTTP 502 on `/api/smoke`, self-recovered - 19:42 PDT attempt 2 — HTTP 502 on `/api/smoke`, `/api/health` already 200 Both probes had `latency_ms: 25001, stage: "timeout"` — a textbook cold-start boundary trip. ## Why 45s (not 60s or 90s) The alert tells us the cold path lands **just over** 25s. 45s gives ~20s of headroom — enough to absorb cold starts without making slow failures look like slow successes. Tail latency beyond 45s would still alert, which is the intent. If we see tail probes >45s, we'll revisit with a post-deploy warmup ping. ## Files changed (17) - 16 `showcase/packages/*/src/app/api/smoke/route.ts` (13 with both abort + maxDuration bumped, 3 langgraph-* with only maxDuration bumped, ms-agent-dotnet untouched) - `showcase/scripts/create-integration/index.ts` template (new packages inherit the new budget) ## Test plan - [ ] Deploy to Railway, observe agno `/api/smoke` no longer 502s on cold start - [ ] Confirm other showcase services still smoke-pass - [ ] If cold path drifts beyond 45s for any service, add a post-deploy warmup step (deferred) Do not merge yet — pending user review.
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.
Summary
Cold-start 502s on showcase package smoke probes (notably
agno) consistently land just over the 25s upstream budget. The Next.js/api/smokeroute usesAbortSignal.timeout(25000)to call its own/api/copilotkitwhich proxies to the Python agent which calls the LLM. On cold start, the end-to-end round-trip takes >25s and the probe aborts withlatency_ms: 25001, stage: "timeout", returning 502.This PR raises the upstream budget from 25s -> 45s across all showcase packages that exercise a full agent round-trip on smoke, and bumps Next.js
maxDurationfrom 30s -> 60s so the route can actually run that long. Thecreate-integrationtemplate is bumped too so new packages inherit the new budget.The 3
langgraph-*routes have a different (lightweight health probe) pattern andms-agent-dotnetis already at 50s — theirmaxDurationis bumped for consistency but their abort budgets are left alone.Evidence — agno 502 alerts tonight (PDT):
/api/smoke, self-recovered/api/smoke,/api/healthalready 200Both probes had
latency_ms: 25001, stage: "timeout"— a textbook cold-start boundary trip.Why 45s (not 60s or 90s)
The alert tells us the cold path lands just over 25s. 45s gives ~20s of headroom — enough to absorb cold starts without making slow failures look like slow successes. Tail latency beyond 45s would still alert, which is the intent. If we see tail probes >45s, we'll revisit with a post-deploy warmup ping.
Files changed (17)
showcase/packages/*/src/app/api/smoke/route.ts(13 with both abort + maxDuration bumped, 3 langgraph-* with only maxDuration bumped, ms-agent-dotnet untouched)showcase/scripts/create-integration/index.tstemplate (new packages inherit the new budget)Test plan
/api/smokeno longer 502s on cold startDo not merge yet — pending user review.