> Replaces #4864: same change as one commit, because a commit message
there failed commitlint and fixing it would need a force-push.
## Description
`sql/create_proxy_telemetry_v2.sql` created an `anon_select` policy and
`GRANT SELECT ... TO anon` on the raw telemetry table. The anon key is
meant to be public, so anyone holding it could read every raw row. The
Supabase beacon was removed in #1526, so the script is now marked legacy
and keeps only the INSERT path that older releases still use. The SELECT
policy and grant are gone. The script now runs `DROP POLICY IF EXISTS
"anon_select"` and `REVOKE SELECT ... FROM anon`, and drops
`anon_insert` before creating it, so re-running the whole script on a
project created with the old version removes the read access.
`run-all-plugins.sh` (dev launcher) silently exported
`HEADROOM_LICENSE_DEV=1`, turning off licence verification, whenever
`~/.headroom/plugins.env` was missing. It now keeps a `HEADROOM_LICENSE`
already in the environment and otherwise exits with a message.
Closes #
## Type of Change
- [x] 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
- `sql/create_proxy_telemetry_v2.sql`: legacy header; anon INSERT only;
idempotent policy section that drops the old read policy and revokes
SELECT.
- `run-all-plugins.sh`: no `HEADROOM_LICENSE_DEV` fallback.
- `tests/test_sql_anon_access.py`: static checks (there is no SQL
harness in the repo) that no policy or grant gives anon SELECT/ALL on
the raw table, INSERT is still granted, the DROP POLICY / REVOKE run as
live statements, and the dev script does not export
`HEADROOM_LICENSE_DEV`.
## Testing
- [x] Unit tests pass (`pytest`)
- [x] Linting passes (`ruff check .`)
- [x] Type checking passes (`mypy headroom`)
- [x] New tests added for new functionality
- [ ] Manual testing performed
### Test Output
```text
$ pytest -q tests/test_sql_anon_access.py
2 passed
# same tests against origin/main files
2 failed
```
## Real Behavior Proof
- Not run against Postgres: a local Postgres container run was attempted
but Docker was unavailable on the test machine. Not run against the live
Supabase project; if it still exists, someone with access needs to
re-run this script (or the DROP POLICY / REVOKE pair) once. This PR does
not change any deployed database.
## Runtime Rollout Safety
- Rollout-managed feature(s): none
- Minimum rollout channel: n/a
- Stable/default behavior changed: no runtime change; setup SQL and a
dev script only.
- Kill switch / disable path: n/a
- Unsafe override required: no
- Qualification impact: none
- Rollback path: revert this commit.
## Review Readiness
- [x] I have performed a self-review
- [x] This PR is ready for human review
## Checklist
- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [x] I did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- devin-review-badge-begin -->
---
<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4867"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Adds two orthogonal identity fields to the anonymous telemetry beacon so we
can segment usage by integration surface and deployment shape:
- headroom_stack: how Headroom is invoked (proxy, wrap_claude, wrap_codex,
adapter_ts_openai, adapter_ts_anthropic, etc.). Resolved from HEADROOM_STACK
env, HEADROOM_AGENT_TYPE fallback, or aggregated request-header counts.
- install_mode: how the proxy is deployed (wrapped / persistent / on_demand).
Detected from HEADROOM_AGENT_TYPE plus DeploymentManifest lookup.
TS SDK adapters now tag every request with X-Headroom-Stack; a FastAPI
middleware buckets the counts and surfaces them via /stats so the beacon can
report requests_by_stack for mixed-integration sessions.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>