Repository navigation
Conversation
There was a problem hiding this comment.
Builder reviewed your changes — looks good ✅
Review Details
Code Review Summary
PR #9564 adds a BigQuery job label (agent_native_workload=alert) to submissions only when the server-side usage context identifies the query as an Analytics alert. The change addresses the attribution gap without changing dashboard or unattributed job payloads; the accompanying specs exercise both the isolated submission path and the real alert-batch evaluator. The implementation is narrowly scoped and places the label in the BigQuery job configuration where expected.
Risk assessment: Standard. Two independent reviews found no confirmed bugs, security issues, or performance regressions. The server-owned attribution signal and tests covering concurrent alert/dashboard/unattributed contexts are good safeguards against accidentally labeling dashboard costs. No actionable findings.
🧪 Browser testing: Skipped — PR only modifies backend code and tests, with no UI impact.
Visual recap — generation failedRecap authentication failed — |
Problem
Analytics alert batches use the same SQL wrapper as dashboards. Cost reporting cannot reliably distinguish their intent from query text alone, so a SQL-shape classifier can move genuine dashboard costs into the alert category.
Approach
Record the workload when Analytics submits the BigQuery job. This adds
configuration.labels.agent_native_workload=alertonly when the existing server-owned usage context identifies an alert. Dashboard and unattributed submissions receive no new label, even if their SQL contains an alert marker. The label carries no user, organization, dashboard or panel identifiers.Safety and operations
The change preserves job IDs, SQL, query results, credentials, cache/resume behavior and billed-byte caps. Labels describe the submitting app's context; they are not an independent attestation against other holders of the same warehouse credentials.
This PR records provenance for newly created jobs. A separate warehouse-classifier patch is prepared locally and is not included or published here. Existing jobs are not relabelled, October attribution remains unresolved, and no cost reduction or measured savings is claimed. No warehouse query, historical backfill or production promotion ran during this work.
Verification
Review focus
The label must come only from server-owned alert context at submission. Confirm the producer-to-provider path and concurrent negative controls preserve that boundary without altering query execution.