Skip to content

fix(sms-bridge): classify OpenCode error envelopes - #42

Merged
xnoto merged 2 commits into
mainfrom
fix/sms-bridge-classify-opencode-error-envelope
Sep 5, 2026
Merged

fix(sms-bridge): classify OpenCode error envelopes#42
xnoto merged 2 commits into
mainfrom
fix/sms-bridge-classify-opencode-error-envelope

Conversation

@xnoto

@xnoto xnoto commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Distinguish a structurally valid OpenCode V1 message envelope that reports info.error from malformed or textless non-error responses. The bridge now records the new static, PII-safe code opencode-response-error, rather than collapsing the envelope into opencode-response-invalid.

The latest approved-source SMS test reached bounded ingress and worker stages but stopped at stage=opencode with the existing generic invalid-response code. Upstream v1.18.23's processor persists a provider/runtime failure into the assistant message and returns a normal message envelope; this change makes that documented envelope observable without carrying upstream error text, identifiers, or payload data into bridge exceptions, logs, or storage.

This is a diagnostic-classification repair only. It does not claim to repair the underlying provider-side failure or to produce an outbound SMS on an error turn.

Fixes #

None — owner-authorized bounded remediation; 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; the images pull-request workflow is the validation authority.
  • Generated or centrally distributed files were regenerated by their owning automation, not hand-edited — none apply; only source and its colocated unit tests changed.

The added unit case pins a valid {info, parts} envelope containing info.error, asserts exact opencode-response-error, and asserts a representative upstream error detail is not exposed. Existing malformed/no-text non-error cases remain opencode-response-invalid.

No local tests, container builds, OpenTofu, SOPS, cluster, or live-system operation was run or claimed.

Impact and rollout

Producer: makeitworkcloud/images/opencode-sms-bridge is the canonical image source. After an explicitly authorized merge, the normal main build publishes an immutable image tag.

Consumer: kustomize-cluster remains unchanged. A separate reviewed GitOps image-selection PR and explicit merge authorization would be required to select any published image; reconciliation, health, and a new approved-source SMS test remain separate stages.

Behavior: no routes, HTTP bodies, agent routing, model/provider selection, Secrets, or Twilio calls change. A valid upstream error envelope is now persisted as a distinct static code. The underlying provider-side cause remains unknown/blocker; do not infer or alter provider configuration from this classification alone.

Rollback: select the previously reviewed immutable bridge tag through the canonical GitOps workflow; do not retag images or patch live resources.

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; review the strict structural check, static-code-only branch, and PII-safety test before merge.

@xnoto
xnoto requested a review from a team as a code owner September 5, 2026 16:20
@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 e9130e6 into main Sep 5, 2026
4 checks passed
@xnoto
xnoto deleted the fix/sms-bridge-classify-opencode-error-envelope branch September 5, 2026 16:23
xnoto added a commit to makeitworkcloud/kustomize-cluster that referenced this pull request Sep 5, 2026
## Summary

Select
`ghcr.io/makeitworkcloud/opencode-sms-bridge:e9130e6ac0a4eb4bb7c47bea79807b873ce5a9cc`,
the immutable image published after [images PR
#42](makeitworkcloud/images#42). It
distinguishes a structurally valid OpenCode V1 error envelope from
malformed or textless non-error responses with the static PII-safe code
`opencode-response-error`.

**Verified producer evidence:** [images buildah run
33977700201](https://github.com/makeitworkcloud/images/actions/runs/33977700201)
passed checks, detected `opencode-sms-bridge`, built it, and completed
registry push for this immutable tag.

This PR changes only the bridge image tag. It changes no chart version,
route, routing/allowlist, Secret, Service, TunnelBinding, provider/model
configuration, or Argo sync policy.

Fixes #

None — owner-authorized diagnostic rollout; no driving issue supplied.

## Type of change

- [x] Bug fix
- [ ] Feature / enhancement
- [ ] Documentation
- [ ] Infrastructure (OpenTofu root or module)
- [x] 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. Repository PR CI is
the validation authority.
- [x] Generated or centrally distributed files were regenerated by their
owning automation, not hand-edited — none apply; this is a one-line
immutable image-pin change.

No local OpenTofu, SOPS, container build, cluster, or live-system
operation was run or claimed.

## Impact and rollout

**Producer:** `images` merged `e9130e6…`; its post-merge build and
registry push succeeded.

**Consumer:** `workloads/apps/opencode-sms-bridge-app.yaml` is the
canonical GitOps image-selection point. This PR proposes selection only.

**Delivery stages:** source is merged, published, and
producer-validated; GitOps selection is proposed and PR validation is
pending. An authorized merge runs `test` on `main`; only a successful
test triggers automatic root-sync submission. Root and child
reconciliation, resource health, and another approved-source SMS test
remain separate verification stages.

**Behavior boundary:** this rollout improves safe error classification
only. It does not claim to resolve the underlying provider-side failure
that produced the prior no-text error turn.

**Rollback:** use a reviewed GitOps PR to restore the prior immutable
tag `adb1e0e72729a7182b4a4929bd67e0275fba8173`; do not retag images or
patch live resources.

## Safety and secrets

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

AI-assisted change: an OpenCode agent materially produced this change;
review the producer evidence, one-line diff, and automatic post-merge
reconciliation behavior before merge.
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