Repository navigation
AI-3506: one unreachable shard no longer stops sessions and bridges on the others #2256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Loschcode
merged 9 commits into
main
from
laurentschaffner/ai-3506-one-unreachable-shard-stops-new
Nov 24, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f652bdc
fix(store): one shard down no longer stops sessions and calls on the …
8256c5e
fix(store): log a shard that did not answer at most once a minute
14ec5a3
fix(session): a voice session on its own new call asks no shard for i…
92fa1ee
fix(store): bound a peer shard's read and stop at the answer that set…
2263072
fix(api): answer 503 for a call a shard that is down may have placed
1cf18e8
fix(phone): a plan fetch while a shard is down is answered 503
ab6a0a0
fix(store): log a peer that fails after the answer that settled the read
92b1c32
fix(store): cancel the other shards' reads once one settles, and give…
34692c4
fix(api): ask again for an arriving call only while its caller may be…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| //go:build integration | ||
|
|
||
| package api | ||
|
|
||
| import ( | ||
| "cmp" | ||
| "log/slog" | ||
| "net/http" | ||
|
|
||
| "github.com/GetStream/Vision-Agents/acceleration/internal/phone" | ||
| "github.com/GetStream/Vision-Agents/acceleration/internal/phone/vendors" | ||
| "github.com/GetStream/Vision-Agents/acceleration/internal/store" | ||
| ) | ||
|
|
||
| // A vendor fetching a plan while a shard that may park it is down is told to fetch again, not | ||
| // that the call is not waiting: the bridge may be on that shard. | ||
| func (s *CallStatusSuite) TestAPlanFetchWhileAShardIsDownIsAnsweredForTheVendorToRetry() { | ||
| s.useApp(s.data.createApp()) | ||
| options := s.storeOptions | ||
| // Nothing answers on port 1. | ||
| options.Shards = map[string]string{ | ||
| "here": cmp.Or(options.ShardDSN, options.DSN), "gone": "postgres://postgres:postgres@127.0.0.1:1/gone?sslmode=disable", | ||
| } | ||
| served, err := store.OpenShards(options) | ||
| s.Require().NoError(err) | ||
| s.T().Cleanup(func() { s.NoError(served.Close()) }) | ||
| config, err := phone.DefaultConfig() | ||
| s.Require().NoError(err) | ||
| telephony, err := phone.NewService(phone.ServiceOptions{Registry: vendors.Registry(config), Store: served, Logger: slog.New(slog.DiscardHandler)}) | ||
| s.Require().NoError(err) | ||
| other, _, _ := s.otherNodeHolding(nil, s.sealer, slog.New(slog.DiscardHandler), func(o *Options) { | ||
| o.Store, o.Phone = served, telephony | ||
| }) | ||
|
|
||
| token := s.utils.uuid() | ||
| s.Equal(http.StatusServiceUnavailable, s.unauthenticatedClient.on(other).do(http.MethodGet, "/v1/phone/answer/"+token, nil, nil)) | ||
| s.Equal(http.StatusNotFound, s.unauthenticatedClient.do(http.MethodGet, "/v1/phone/answer/"+token, nil, nil), | ||
| "with every shard answering, it is not waiting") | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Should Fix] Peer-shard outage answers 503 to every video call start
Issue: While a peer shard is down, every call.session_started in the app, video calls included, is answered 503 for 45 seconds after the call's created_at. Stream retries webhooks for calls no phone number reaches.
Cause:
dispatchArrivingCallrunsCallResources.Selectat line 178, before the number lookup at line 203. The error branch at 184-188 returns 503. At ce41c39 a Select error was logged and answered 200.Fix: Look up the number first and return the 503 only when a number reaches the call. Otherwise keep the log-and-200. Or: keep the order and accept the 503 on video calls, which costs retry traffic on calls that never involve telephony.
Evidence