Skip to content

feat(settings): add configurable app identity headers#132

Open
hanxuanliang wants to merge 2 commits intobubbuild:mainfrom
hanxuanliang:feat/app-identity-headers
Open

feat(settings): add configurable app identity headers#132
hanxuanliang wants to merge 2 commits intobubbuild:mainfrom
hanxuanliang:feat/app-identity-headers

Conversation

@hanxuanliang
Copy link

Summary

Add configurable app identity settings so forks can override the default Bub attribution headers without patching source code.

Previously, the runtime hardcoded HTTP-Referer: https://bub.build/ and X-Title: Bub in agent.py. That meant forks and white-label builds had to carry a source patch just to update branding.

What Changed

  • add BUB_APP_NAME and BUB_APP_URL to AgentSettings with the existing Bub defaults
  • build extra_headers from settings instead of a hardcoded constant in agent.py
  • allow empty or null config values to omit either header entirely
  • document the new settings in env.example and README.md
  • add regression coverage for default values, overrides, disabled values, and runtime header injection

Why

This keeps the public config provider-neutral while preserving the previous default behavior:

  • default installs still send Bub identity headers
  • forks can override branding in .env without carrying a source patch
  • the runtime continues to pass app identity metadata through the existing extra_headers path

Tests

Added regression coverage for:

  • default BUB_APP_NAME and BUB_APP_URL values
  • .env overrides for app identity
  • disabling headers with empty or null config
  • runtime propagation of configured headers, including model override paths

Verification

  • uv run ruff check .
  • uv run mypy src
  • uv run pytest -q

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