GeezerVison is showing github.com — quota-check reads the Turso mirrors via the CLI platform token, not the per-DB BWS tokens its job body names · Issue #6828 · developing-today/code
quota-check reads the Turso mirrors via the CLI platform token, not the per-DB BWS tokens its job body names #6828DescriptionCredential-scope smell, confirmed during the #5691 repoint (see TURSO-MIGRATION.md 2026-11-06 bullet-4 entry) and re-verified in the 2026-11-07 rename program (#6619).
~/tools/quota-check/JOB-BODY.md says the mirror reads use per-DB tokens by BWS name (turso.fleet-platform-rw-token / turso.fleet-mirror-rw-token, renamed 2026-11-07). In practice the reads go through ~/tools/bin/turso db shell <db>, which authenticates with the turso CLI's PLATFORM token — one credential that can reach every database in the org. So:
- The per-DB tokens named in the job body are decorative on this route; rotating or revoking them does not change quota-check's access.
- A quota-check run holds org-wide DB authority when it only needs read access to two DBs (agent_quota_records on fleet-platform, agent_mirror_token_usage_daily on fleet-mirror).
Fix direction: make the quota-check reads use the per-DB tokens over the libsql HTTP pipeline (the pattern runtime-db-export's turso_client.py already implements, including its direct-BWS fallback for broker staleness #6767), or explicitly accept and document the platform-token route in the job body so the named tokens stop implying a scope they do not enforce.
Acceptance criteria
- quota-check's mirror reads authenticate with the per-DB BWS tokens named in its job body (turso.fleet-platform-rw-token / turso.fleet-mirror-rw-token) over the libsql HTTP pipeline, OR the job body is explicitly corrected to document the platform-token route as accepted.
- If the per-DB route is adopted: revoking/rotating a per-DB token demonstrably changes quota-check's access to that DB only, and a quota-check run succeeds end-to-end on the new route.
- No quota-check run needs org-wide platform-token authority for its routine reads.
Activitydeveloping-today commented on Nov 7, 2026 dezren39 commented on Nov 7, 2026 Intake review
Related: #6619 / #5691 (the repoint work where this was confirmed). Pattern reference named in the issue: runtime-db-export's turso_client.py libsql HTTP pipeline, including its direct-BWS fallback for broker staleness (#6767).
Notes: this is a credential-scope smell, not an active leak — the platform token is the fleet's own CLI credential. Normal priority, medium effort (route change + verification, or a deliberate documented acceptance).
Risks: switching auth routes could break the scheduled quota-check run; verify a full run on the new route before closing.
Suggested approach: prefer the per-DB libsql route (least privilege, matches the job body's claim); only take the documentation route with an explicit recorded decision.
🤖 Agent note · handed off
developing-today commented on Nov 8, 2026 🤖 Agent note · parked
- Agent: queue worker (repo-worker-code, lane code-t)
- Session / ID: task 11406
- Found via: queue claim (resume at implementation_complete, lane code-u)
- Task: task 11406 (issue quota-check reads the Turso mirrors via the CLI platform token, not the per-DB BWS tokens its job body names #6828) verification largely done by lane code-t: helper ~/tools/quota-check/turso-mirror-read.py read fleet-platform (agent_quota_records, 11919 rows) and fleet-mirror (agent_mirror_token_usage_daily, 33842 rows) with their per-DB tokens; cross-token scope check passed both ways (each DB returns HTTP 401 with the other DB's token); JOB-BODY.md and the live go-plan-expiry-watch cron body both describe the helper route (read-back match). Remaining: one full quota-check run ON the helper route recording FRESH mirror reads in state.json — that run (go-plan-expiry-watch, started 2026-11-08T01:24:53Z) is in flight now.
- Expectation: parked 20 min; resume condition: state.json last_run_at advances past 2026-11-08T01:24:53Z with FRESH fleet-platform + fleet-mirror reads, then complete task 11406
- Links: issue quota-check reads the Turso mirrors via the CLI platform token, not the per-DB BWS tokens its job body names #6828; helper ~/tools/quota-check/turso-mirror-read.py
dezren39 commented on Nov 8, 2026 🤖 Agent note · done
- Agent: queue worker (repo-worker-code), lane code-e
- Session / ID: task 11406
- Found via: queue claim (resume at implementation_complete; prior work by lane code-u, verification by lane code-t)
- Task: Done — the final acceptance evidence is now in. The quota-check run that started 2026-11-08T01:24:53Z on the new helper route completed end-to-end: state.json records the fleet-platform read FRESH @2026-11-08T01:50:20Z (70%, muse-subscription row) and the fleet-mirror export including 2026-11-07, with snapshots appended through 01:50Z. Re-verified fresh this shift (lane code-e): each DB reads successfully only with its own per-DB token via ~/tools/quota-check/turso-mirror-read.py (fleet-platform agent_quota_records; fleet-mirror agent_mirror_token_usage_daily), and both cross-token reads fail HTTP 401 — scope is per-DB as intended. No token value appears in the helper or JOB-BODY.md (tokens referenced by name only; grep for token-shaped strings: none). Closing issue quota-check reads the Turso mirrors via the CLI platform token, not the per-DB BWS tokens its job body names #6828 with this evidence.
- Expectation: met — quota-check's routine mirror reads no longer need the org-wide Turso CLI platform token.
- Links: task 11406; helper ~/tools/quota-check/turso-mirror-read.py
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|