Skip to content

feat(wrapper): LLM proxy wrapper mode (feature 019)#40

Merged
levleontiev merged 3 commits intomainfrom
feature/issue-39-llm-proxy-wrapper
Mar 16, 2026
Merged

feat(wrapper): LLM proxy wrapper mode (feature 019)#40
levleontiev merged 3 commits intomainfrom
feature/issue-39-llm-proxy-wrapper

Conversation

@levleontiev
Copy link
Contributor

@levleontiev levleontiev commented Mar 16, 2026

Summary

  • Adds fairvisor.wrapper module: 13 provider registry (OpenAI, Anthropic, Gemini native + compat, Grok, Groq, Mistral, DeepSeek, Perplexity, Together AI, Fireworks AI, Cerebras, Ollama)
  • Composite Bearer token parsing: Authorization: Bearer <JWT>:<UPSTREAM_KEY>, splits at first colon, extracts JWT claims
  • Provider-native pre-flight error bodies (OpenAI / Anthropic / Gemini formats)
  • Provider-native streaming cutoff injection via replace_openai_cutoff() post-processor (no changes to feature 014)
  • header:* descriptor collection + stripping before upstream forwarding
  • nginx wiring: wrapper_access.lua, wrapper_body_filter.lua, updated access.lua, body_filter.lua, init_worker.lua
  • nginx.conf.template: $wrapper_upstream_url, FAIRVISOR_UPSTREAM_TIMEOUT_MS, wrapper proxy_pass block

Closes #39

Agreed scope cuts (follow-up issues)

Both were confirmed by шеф as intentional scope cuts from this PR.

Test plan

  • 28 BDD unit scenarios in spec/unit/wrapper_spec.lua + features/wrapper.feature — all pass
  • CI lua-quality + validate-config-and-policies checks pass
  • e2e-smoke passes

🤖 Generated with Claude Code

codex and others added 2 commits March 16, 2026 13:24
Adds fairvisor.wrapper module with 13 provider registry, composite
Bearer parsing, provider-native error bodies and streaming cutoffs,
header descriptor collection, and full nginx access/body_filter wiring.
28 BDD unit scenarios pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ectives, envsubst

- Remove unused string_format + table_concat locals in wrapper.lua (luacheck warnings)
- Move proxy_ssl_server_name/protocols and proxy_*_timeout out of nginx if-block
  (these directives are not allowed inside if blocks)
- Add FAIRVISOR_UPSTREAM_TIMEOUT_MS to entrypoint.sh and validate_nginx_template.sh
  envsubst variable lists and defaults
- Allow FAIRVISOR_MODE=wrapper in entrypoint.sh validation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… gate

Adds 6 BDD scenarios covering access_handler's main branches
(401 parse failure, 404 unknown provider, allow path with upstream URL
set, 429 rule_engine reject) plus wrapper.init valid/invalid paths.
Recovers coverage regression from 85.83% back above 87.14% baseline.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@levleontiev levleontiev merged commit 597135c into main Mar 16, 2026
8 checks passed
@levleontiev levleontiev deleted the feature/issue-39-llm-proxy-wrapper branch March 16, 2026 14:49
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.

Feature 019: LLM Proxy Wrapper Mode

2 participants