fix(sms): mark missing-config errors as non-retryable; default bind to 127.0.0.1#19745
Merged
Conversation
Prevents pre-existing TWILIO_PHONE_NUMBER or SMS_WEBHOOK_URL values in the outer test environment from leaking into the assertion context. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closed
4 tasks
This was referenced May 4, 2026
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.
Salvage of #16278 by @briandevans onto current main.
Summary
Two security-adjacent fixes for the SMS adapter:
Default bind to 127.0.0.1 instead of 0.0.0.0. The SMS webhook receiver shouldn't be exposed to external networks by default. Users who need external exposure can still set
SMS_WEBHOOK_HOST=0.0.0.0, but the default is now localhost-only.Config-validation failures are non-retryable. When
TWILIO_PHONE_NUMBERorSMS_WEBHOOK_URLis missing,connect()returned False without marking the error non-retryable. The reconnect watcher kept retrying a config error that will never resolve. Call_set_fatal_error("sms_missing_*", msg, retryable=False)so the watcher removes the adapter from the retry rotation.Conflict resolution during salvage
Test file picked up additional tests from main; preserved both sets. The original PR's cherry-pick didn't apply the sms.py changes cleanly (silent conflict), so the code changes were re-applied manually. Also updated the existing
test_default_host_is_all_interfacestest to match the new127.0.0.1default.Changes
Validation
scripts/run_tests.sh tests/gateway/test_sms.py -> 39 passed
Original PR: #16278
Fixes: #16258