fix(sms-bridge): enumerate PII-safe static OpenCode error codes - #35
Merged
Conversation
Image CI passedPre-commit validation passed. View the workflow run. |
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
error_codevalues onBridgeErrorfor theopencode-sms-bridge's OpenCode stage:
opencode-request-failed(HTTP/URL/OSErrorrequest errors),
opencode-response-invalid(invalid or missing response shapesand JSON), and
opencode-input-invalid(empty prompt text), alongside theexisting
twilio-send-failedandokoutcomes.BridgeErrornow always carries a bounded staticerror_code, defaulting toopencode-response-invalidand coercing any non-bounded value, so unclassifiedfailures can never persist or log free-form text.
process_joblogs and persists the boundederror_codein place of the coarseopencode-faileddetail code. No raw exception text, response/request bodies,URLs, session or message IDs, credentials, or provider details appear in logs or
the persisted
detail_code. Unsupported-media behavior is unchanged.and coercion, and
process_jobpersistence of the bounded code; all existingtests are preserved.
Fixes #
None — owner-requested PII-safety hardening; no driving issue supplied.
Type of change
Validation
buildahworkflow runs pre-commit (including Gitleaks), changed-image detection,and the non-publishing bridge image build. Result will be recorded on the PR.
automation, not hand-edited — none changed; only
opencode-sms-bridge/server.pyand
opencode-sms-bridge/test_server.pywere edited.No local tests, container builds, OpenTofu, SOPS, state, or live-system
operations were run or claimed. CI is the validation authority.
Impact and rollout
Producer changed:
makeitworkcloud/images/opencode-sms-bridgeis thecanonical bridge-image source. An approved merge automatically publishes a new
immutable GHCR image tag. This PR neither publishes nor deploys anything itself.
Consumer unchanged:
kustomize-clustercontinues to select its currentlypinned image; this PR makes no GitOps or image-selection change. After an
approved merge and publication, a separate reviewed GitOps PR and explicit
confirmation are required before image selection, Argo reconciliation, health
verification, and a new approved-source SMS test.
Behavior boundary: worker job rows that previously failed with the coarse
opencode-faileddetail now persist the boundedopencode-request-failed,opencode-response-invalid, oropencode-input-invalidcode, and thejob_failedlog line carries the sameerror_code. Any consumer of the oldliteral
opencode-failedvalue must be updated before relying on the new codes.Rollback: if a later selected image regresses, use the canonical GitOps
workflow to select a reviewed immutable image tag. Do not overwrite image tags
or alter live state manually.
Safety and secrets
kubeconfigs, tokens, or private endpoints.
or claimed — plans come from pull-request checks.
AI-assisted change: an OpenCode agent materially produced this change; reviewers
should verify the bounded error-code enumeration, the safe default and coercion,
the
process_jobpersistence path, and CI results before merge.