Skip to content

fix(sms-bridge): enumerate PII-safe static OpenCode error codes - #35

Merged
xnoto merged 3 commits into
mainfrom
fix/sms-bridge-enumerate-opencode-errors
Sep 5, 2026
Merged

fix(sms-bridge): enumerate PII-safe static OpenCode error codes#35
xnoto merged 3 commits into
mainfrom
fix/sms-bridge-enumerate-opencode-errors

Conversation

@xnoto

@xnoto xnoto commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Enumerate PII-safe static error_code values on BridgeError for the
    opencode-sms-bridge's OpenCode stage: opencode-request-failed (HTTP/URL/OSError
    request errors), opencode-response-invalid (invalid or missing response shapes
    and JSON), and opencode-input-invalid (empty prompt text), alongside the
    existing twilio-send-failed and ok outcomes.
  • BridgeError now always carries a bounded static error_code, defaulting to
    opencode-response-invalid and coercing any non-bounded value, so unclassified
    failures can never persist or log free-form text.
  • process_job logs and persists the bounded error_code in place of the coarse
    opencode-failed detail 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.
  • Focused unit coverage adds the bounded request-error mapping, the safe default
    and coercion, and process_job persistence of the bounded code; all existing
    tests are preserved.

Fixes #

None — owner-requested PII-safety hardening; no driving issue supplied.

Type of change

  • Bug fix
  • Feature / enhancement
  • Documentation
  • Infrastructure (OpenTofu root or module)
  • GitOps desired state (manifests, kustomize, charts, SOPS/KSOPS secrets)
  • Container image
  • CI / reusable workflow
  • Refactor / cleanup
  • Breaking change

Validation

  • Required pull-request checks pass — pending at PR creation; the pull-request
    buildah workflow runs pre-commit (including Gitleaks), changed-image detection,
    and the non-publishing bridge image build. Result will be recorded on the PR.
  • Generated or centrally distributed files were regenerated by their owning
    automation, not hand-edited — none changed; only opencode-sms-bridge/server.py
    and opencode-sms-bridge/test_server.py were 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-bridge is the
canonical 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-cluster continues to select its currently
pinned 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-failed detail now persist the bounded opencode-request-failed,
opencode-response-invalid, or opencode-input-invalid code, and the
job_failed log line carries the same error_code. Any consumer of the old
literal opencode-failed value 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

  • Contains no plaintext secrets, decrypted SOPS values, state files,
    kubeconfigs, tokens, or private endpoints.
  • No local OpenTofu init/plan/apply/destroy/import/state operations were run
    or claimed — plans come from pull-request checks.
  • Breaking or irreversible effects are described above with rollback notes.

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_job persistence path, and CI results before merge.

@xnoto
xnoto requested a review from a team as a code owner September 5, 2026 05:12
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

Image CI passed

Pre-commit validation passed. View the workflow run.

@xnoto
xnoto merged commit 956f2c8 into main Sep 5, 2026
3 checks passed
@xnoto
xnoto deleted the fix/sms-bridge-enumerate-opencode-errors branch September 5, 2026 05:17
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