Skip to content

Feature/0.1.1 model downgrade#4

Merged
kaissb merged 2 commits into
stagingfrom
feature/0.1.1-model-downgrade
Apr 9, 2026
Merged

Feature/0.1.1 model downgrade#4
kaissb merged 2 commits into
stagingfrom
feature/0.1.1-model-downgrade

Conversation

@kaissb

@kaissb kaissb commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds X-Oberwatch-Downgraded and X-Oberwatch-Original-Model response headers to all proxied requests where a model downgrade occurred. This allows clients and observability tools to detect when a cheaper model was substituted. Also adds an integration test script that verifies the headers end-to-end.

Changes

  • Set X-Oberwatch-Downgraded: true and X-Oberwatch-Original-Model: <model> in ModifyResponse for the standard reverse proxy path
  • Set the same headers in the Anthropic OpenAI-compat handler in provider_routing.go
  • Add scripts/dev/test-downgrade.sh — builds the binary, starts a mock upstream, sends a request that crosses the downgrade threshold, and asserts both headers are present

Testing

  • Added/updated tests
  • All tests pass (SVS) — 83.0% coverage
  • Linting passes (SVS) — 0 issues
  • Integration test script passes (bash scripts/dev/test-downgrade.sh)

Checklist

  • PR title follows Conventional Commits format (feat:, fix:, docs:, etc.)
  • One logical change per PR
  • No new dependencies added (or explicitly approved in description)
  • No sensitive data in code or logs
  • Doc comments added for new exported symbols

kaissb added 2 commits April 9, 2026 13:04
- Rewrite model field in request body when threshold crossed
- Walk downgrade chain to find cheaper alternative
- Add X-Oberwatch-Downgraded response headers
- Set Downgraded and OriginalModel on cost records
- Build binary and start mock upstream server
- Verify X-Oberwatch-Downgraded header present on downgraded request
- Verify X-Oberwatch-Original-Model header contains original model name
@kaissb
kaissb merged commit d7ef4f1 into staging Apr 9, 2026
5 checks passed
@kaissb
kaissb deleted the feature/0.1.1-model-downgrade branch April 9, 2026 17:54
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