GPT-6.1 Sol · Heavy
anonymous-add-configurable-device-limit-grafana-codex
Grafana · Go · M · 100–299 lines · 6 files
The generalist plus 9 specialist lens agents in parallel, then the same verify and dedup steps. Judge: Claude Haiku 5.5.
- Gold bugs found
- 2 of 2
- Comments published
- 4
- Comments matching a bug
- 2
- Comments not matching
- 2
- Cost of this PR
- $1.302
Published comments (4)
Missing device header bypasses the anonymous device limit — Requests without `X-Grafana-Device-Id` receive an anonymous identity even when all device slots are occupied because `TagDevice` returns nil for an empty header. Enforce device admission for these requests rather than treating a tagging no-op as successful admission.
Environment-only anonymous device limit configuration is ignored — Setting only `GF_AUTH_ANONYMOUS_DEVICE_LIMIT` leaves `AnonymousDeviceLimit` at zero because environment overrides apply only to existing INI keys, and `conf/defaults.ini` lacks `device_limit`. Add `device_limit = 0` to its anonymous-auth section so environment-only configuration works.
Rejected devices remain cached and bypass the device limit on retry — A rejected device can authenticate on retry because `tagDeviceUI` populates `localCache` before persistence, letting subsequent `TagDevice` calls skip the store check after `ErrDeviceLimitReached`. Cache only successfully persisted devices, or remove the cached entry before returning the error. **Also found in:** - `pkg/services/anonymous/anonimpl/client.go:44-46`
Non-atomic device admission allows concurrent requests to exceed the limit — Concurrent requests can both pass `CountDevices` and insert distinct devices, exceeding `deviceLimit`. Make counting and admission mutually exclusive across server instances using a database lock and a suitably isolated transaction.
Gold bugs found (2)
Gold bugs missed (0)
None.