Skip to content

feat: add --disable-kompress-fallback to restore legacy PASSTHROUGH fallback#1185

Open
HMAKT99 wants to merge 1 commit into
chopratejas:mainfrom
HMAKT99:feat/disable-kompress-fallback-flag
Open

feat: add --disable-kompress-fallback to restore legacy PASSTHROUGH fallback#1185
HMAKT99 wants to merge 1 commit into
chopratejas:mainfrom
HMAKT99:feat/disable-kompress-fallback-flag

Conversation

@HMAKT99

@HMAKT99 HMAKT99 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Description

Follow-up to #1046. That PR stopped --disable-kompress from forcing
fallback_strategy = CompressionStrategy.PASSTHROUGH, so ContentRouter's rule-based
passes keep running when the ML model is off. As noted in review, that is a behaviour
change for callers who relied on the old passthrough-everything fallback.

This adds an opt-in --disable-kompress-fallback flag (env
HEADROOM_DISABLE_KOMPRESS_FALLBACK) that, together with --disable-kompress, restores
the previous behaviour by routing fall-through content to PASSTHROUGH. It defaults to
off, so the corrected behaviour from #1046 is unchanged unless a caller explicitly opts
back in. The flag is a no-op unless --disable-kompress is also set.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Performance improvement
  • Code refactoring (no functional changes)

Changes Made

  • headroom/proxy/models.py: added disable_kompress_fallback: bool = False to ProxyConfig.
  • headroom/proxy/server.py: when disable_kompress and disable_kompress_fallback are both set, restore router_config.fallback_strategy = CompressionStrategy.PASSTHROUGH (re-adding the CompressionStrategy import); wired the new field through the env factory, the __main__ argparse path (--disable-kompress-fallback), and the /health config payload.
  • headroom/cli/proxy.py: added the --disable-kompress-fallback Click option (with HEADROOM_DISABLE_KOMPRESS_FALLBACK envvar) and passed it into ProxyConfig.
  • tests/test_proxy_disable_kompress.py: added tests for the flag restoring PASSTHROUGH, for it being a no-op without --disable-kompress, and for the /health config payload exposing the field.
  • tests/test_cli_proxy_env.py: added a test that the env factory honours HEADROOM_DISABLE_KOMPRESS_FALLBACK.

Testing

  • Unit tests pass (pytest)
  • Linting passes (ruff check .)
  • Type checking passes (mypy headroom)
  • New tests added for new functionality
  • Manual testing performed

Test Output

$ pytest tests/test_proxy_disable_kompress.py -v
collected 5 items

tests/test_proxy_disable_kompress.py::test_disable_kompress_config_keeps_optimization_but_disables_ml_fallback PASSED [ 20%]
tests/test_proxy_disable_kompress.py::test_disable_kompress_defaults_to_existing_kompress_behavior PASSED [ 40%]
tests/test_proxy_disable_kompress.py::test_health_config_reports_disable_kompress_fallback PASSED [ 60%]
tests/test_proxy_disable_kompress.py::test_disable_kompress_fallback_restores_passthrough PASSED [ 80%]
tests/test_proxy_disable_kompress.py::test_disable_kompress_fallback_without_disable_kompress_is_noop PASSED [100%]

5 passed

$ ruff check headroom/proxy/server.py headroom/proxy/models.py headroom/cli/proxy.py tests/
All checks passed!

Real Behavior Proof

  • Environment: local clone, Python 3.13.7 venv, headroom core deps + fastapi/uvicorn/httpx[http2].
  • Exact command / steps: booted the app in-process with FastAPI TestClient across four flag combinations and inspected both the live ContentRouter config and the /health config payload.
  • Observed result: both flags -> enable_kompress=False and fallback_strategy=PASSTHROUGH (/health reports disable_kompress_fallback=true); --disable-kompress alone -> fallback_strategy stays KOMPRESS (the fix: --disable-kompress should not override fallback_strategy to PASSTHROUGH #1046 default, /health reports false); --disable-kompress-fallback alone -> no-op (enable_kompress=True, KOMPRESS); neither flag -> defaults (enable_kompress=True, KOMPRESS).
  • Not tested: full live-proxy /stats run against a real LLM backend.

Review Readiness

  • I have performed a self-review
  • This PR is ready for human review

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the CHANGELOG.md if applicable

Additional Notes

The flag is intentionally a no-op unless --disable-kompress is also set, mirroring where
the original override lived. Happy to add a short note to the docs/README flag list if you'd
like it documented there.

@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

PR governance

This PR follows the template and is marked ready for human review.

@github-actions github-actions Bot added the status: ready for review Pull request body is complete and the author marked it ready for human review label Jun 20, 2026
@HMAKT99 HMAKT99 force-pushed the feat/disable-kompress-fallback-flag branch from 09bb362 to 4677d83 Compare June 20, 2026 06:06
@github-actions github-actions Bot added status: needs author action Pull request body or readiness checklist still needs author updates status: ready for review Pull request body is complete and the author marked it ready for human review and removed status: ready for review Pull request body is complete and the author marked it ready for human review status: needs author action Pull request body or readiness checklist still needs author updates labels Jun 20, 2026
@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…allback

PR chopratejas#1046 stopped --disable-kompress from forcing
fallback_strategy=PASSTHROUGH so ContentRouter's rule-based passes keep
running. That was a behaviour change for callers who relied on the old
passthrough fallback.

Add an opt-in --disable-kompress-fallback flag (env
HEADROOM_DISABLE_KOMPRESS_FALLBACK) that, together with
--disable-kompress, restores the previous behaviour by routing
fall-through content to PASSTHROUGH. Defaults off, so the corrected
behaviour from chopratejas#1046 is unchanged unless explicitly opted in.
@HMAKT99 HMAKT99 force-pushed the feat/disable-kompress-fallback-flag branch from 4677d83 to 3e3f4cf Compare June 20, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: ready for review Pull request body is complete and the author marked it ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant