Who writes the rows? A permission model for the BQAA coding-agent mod
An admin installs the mod once. After that, every developer's machine writes agent events to one BigQuery table. This study compares seven ways to grant that write, and recommends a phased path.
Citation key: "mod" is plugins/bigquery-agent-analytics-mod and "tracing" is plugins/bigquery-agent-analytics-tracing. A reference such as config.ts L12 links to that line at commit 5566d7f. A judgement carries an italic lead-in; everything else is a sourced fact or a stated assumption. Product docs: BigQuery Agent Analytics.
Eight numbered sections, two comparison tables, open questions for the PM, and 73 linked sources.
01 / The short answer
1. The short answer
Yes, there are better options than the three in the issue. The writer runs on machines the admin does not control. Whatever credential it uses, the developer holds too, and no client-side setting can stop them using it outside the mod. So there are only two real levers: make each developer's own write right as small as possible, or move the write right off the laptop and give developers a right that can only submit events.
Now: one Google group, bound once, with a narrow role (option F). The admin binds a group such as bqaa-writers@example.com on a dataset that holds only the events table, with a custom role that can add rows but cannot read them or delete the table. It does not stop a member from overwriting the rows. Developers keep signing in with their own Google account, as today. Joiners and leavers become group changes, not IAM changes.
Later, for customers who need developers to have no table access at all, so no way to overwrite rows either: a central ingestion path (option D). The cheapest is a Pub/Sub topic with a BigQuery subscription; developers can only publish. If the row's user_id must be trustworthy, use a small Cloud Run service behind Identity-Aware Proxy (IAP) that stamps the verified email.
Never ship service-account keys (option C). Impersonating a shared service account (B) avoids long-lived service-account keys but adds nothing over a group grant unless a policy demands it. Workload Identity Federation (E) covers CI and companies whose people have no Google accounts.
Step 1 needs small mod changes: a configurable "how to get access" message, an auto-create switch the admin can set, a setup step that authorizes the reporting views, and new docs. Step 2 adds a second transport that both live sends and the replay of parked rows must use; the queue, retries and dead-letter files stay as they are.
02 / How credentials work today
2. How credentials work today
The BQAA coding-agent mod runs inside each developer's coding-agent CLI. Hooks build rows; a background writer sends them. The facts that matter for permissions:
Transport. The writer sends batches with tabledata.insertAll, BigQuery's legacy streaming API, as plain HTTPS. A Google client library is not available inside a mod, and the Storage Write API needs gRPC, which the mod's fetch does not speak (mod bigquery.ts L1–4, README L199–201).
Token source. First BQAA_ACCESS_TOKEN, if set, re-read every five minutes. Otherwise the command in the accessTokenCommand option or BQAA_ACCESS_TOKEN_COMMAND, by default gcloud auth application-default print-access-token. The command runs with no shell and a 15-second limit. The token stays in memory for 45 minutes, and a 401 gets one fresh token and one retry (config.ts L12, L108–109, L170, L195–197; writer.ts L670–701, L307–327).
So, with the default command, the writer is whoever Application Default Credentials (ADC) name on that machine. After gcloud auth application-default login, that is the developer's own Google account. If GOOGLE_APPLICATION_CREDENTIALS points at a key file, it is that service account. If ADC was set up with --impersonate-service-account, it is the impersonated account (gcloud reference; impersonation with ADC).
Permissions it needs. insertAll needs bigquery.tables.updateData and bigquery.tables.get on the table, and bigquery.datasets.get on the dataset. It is not a job, so it needs no bigquery.jobs.create (insertAll reference). The test fixture's refusal names the first: "Permission bigquery.tables.updateData denied" (credentials.test.ts L29–32). Auto-create is on by default: on a 404 the writer creates the table, which needs bigquery.tables.create on the dataset (config.ts L198; writer.ts L355–366; bigquery.ts L36–44).
What every setup path grants.roles/bigquery.dataEditor on the dataset. The mod's own "to fix" notice asks for it (writer.ts L526–529), as do the mod README (L216–217) and setup.sh L120–122. The tracing bootstrap binds it with bq add-iam-policy-binding -d and also grants project-level roles/bigquery.jobUser "for verification queries" (tracing setup_gcp_prereqs.py L329–358; USER_GUIDE L211–219).
What the table holds. Prompts, the model's visible answers, tool arguments and tool results, each cut to maxPayloadChars. The README's advice: "Treat the dataset like the transcripts it mirrors" (README L583–587).
Who the row says wrote it.user_id comes from BQAA_USER_ID, then the login name, so the client asserts it (config.ts L180). The opt-in userIdFromCredentials replaces it with the verified email of the token's account, looked up at Google's token-information endpoint. That is best effort: when the lookup fails, or the token carries no verified email, the row keeps the configured name (writer.ts L617–621; README L269–273; config.ts L200; writer.ts L606–636).
One table, three writers. The DDL keeps the columns of ADK's BQAA plugin, so ADK agents, the tracing plugin and the mod can share one table (agent_events_ddl.sql L1–5). Whatever we decide here applies to all three.
The tracing plugin's advice. On a workstation, use the developer's own identity. For a service account, impersonate it through ADC (the caller needs roles/iam.serviceAccountTokenCreator); a JSON key is "least preferred"; Workload Identity Federation is for CI (USER_GUIDE L64–105).
Judgement: today's default is option 1 of the issue with a wide role. Every developer's own account holds dataEditor on the dataset, so every developer can read every other developer's transcripts.
Where the right to write the table lives, in today's setup and in the two central designs
Direct writetoday; also A, B, C, E, F
Developer machinea token for the developer (A, F), a service account (B, C) or a federated identity (E)
→
BigQuery APItabledata.insertAll
→
agent_eventsone shared table
Pub/Sub (D2)publish only
Developer machinesame ADC token, publish right only
→
Pub/Sub topicone topic, BigQuery subscription
→
agent_eventswritten by the subscription's identity
Cloud Run (D1)submit only
Developer machineID token, invoke right only
→
Ingestion serviceCloud Run, optionally behind IAP; its own service account
→
agent_eventsone shared table
The box with the heavy border is where the identity that can write the table lives.
03 / Why the issue's three options hurt
3. Why the three options in the issue are each uncomfortable
1. "Every user has to be given write access to the table"
Today, "write access" means roles/bigquery.dataEditor on the dataset. That role is far more than append. Granted on a table, it lets the holder "get (query), export, replicate, and update table data" and "delete the table" (BigQuery access control). Granted on a dataset, it covers every table in it and adds creating tables. So each developer can read and export every other developer's prompts and tool output, rewrite or delete rows with a query (given any project where they can run query jobs, which the tracing bootstrap also grants), delete the table, and create new ones. No predefined role that can be granted to people adds rows without also reading them. A per-person binding also means one IAM change for every joiner and every leaver. One allow policy holds at most 1,500 principals, and that limit "cannot be changed" (IAM quotas).
2. "Every user has to be given ServiceUser permission on the service account"
The role that lets a person mint tokens for a service account, and use gcloud's --impersonate-service-account flag, is Service Account Token Creator (roles/iam.serviceAccountTokenCreator). Service Account User (roles/iam.serviceAccountUser) holds only iam.serviceAccounts.actAs, get and list, plus two project-read permissions, and no token permission: that is the output of gcloud iam roles describe roles/iam.serviceAccountUser (run 2026-10-15) and Google's IAM roles reference. actAs lets a person attach the account to a resource, such as a VM or a Cloud Run service, and Google says the role "does not allow principals to create short-lived credentials" (service account permissions). So option 2 in practice means Token Creator, and the worry stands. With Token Creator, every developer can take on the account's full power, at any time, from any machine. The blast radius is the account's role, for every developer. BigQuery also sees one identity for everyone, so only the client-asserted user_id tells developers apart.
3. "Some long-lived credentials have to be saved in the config file"
A service-account key is a bearer secret. By default it never expires (restricting service accounts). Many organizations block key creation by policy, and organizations created since May 2024 do so by default (option C below). Copied to every laptop, it can be read by the developer, by the coding agent itself and by every tool the agent runs. Anyone who copies it can act as the account from anywhere until an admin deletes the key, and deleting it breaks every machine at once.
Judgement: all three put a write credential on every machine. They differ in which credential, how long it lives and how much it can do. The real alternatives either shrink what that credential can do (F), or swap it for a right that can only submit events (D).
04 / The options, one by one
4. The options, one by one
Each option lists its IAM roles, what the admin does, what each developer does, setup, blast radius, user experience (UX), operations burden and cost. "Blast radius" asks what a leaked credential, or a developer acting in bad faith, can do: add rows, change or delete rows, delete the table, or read other people's events. Examples use my-project, dataset agent_analytics and table agent_events.
Option A
Per-user grants on the dataset or table
Each developer's own Google account gets a role on the events table or its dataset. This is what the mod and the tracing plugin document today.
IAM roles
Today: roles/bigquery.dataEditor on the dataset. Narrower: the same role on the table only, or a write-only custom role (see option F). A table-only grant needs testing, because insertAll also checks bigquery.datasets.get on the dataset.
roles/bigquery.jobUser is not needed to write: insertAll is not a job (insertAll reference). It is needed only to run queries, which is why the tracing bootstrap grants it "for verification queries".
Admin flow
One binding per developer, added when they join and removed when they leave. The admin needs the right to change the table's or dataset's IAM policy.
Developer flow
Run gcloud auth application-default login once. That is already the mod's default.
The dataset-level form the tracing bootstrap runs today; repeat for every developer.
Blast radius
With dataEditor on the dataset, a leaked credential or a developer acting in bad faith can add forged rows under any user_id, read and export every developer's events, rewrite or delete rows with a query (given any project where they can run query jobs), delete the table, and create tables in the dataset (BigQuery access control). The credential that leaks is the person's whole Google account, which exists anyway; this option adds rights to it, not a new secret.
UX
Best. Nothing new for developers.
Operations
Grows with headcount. Offboarding depends on someone removing the binding. One allow policy holds at most 1,500 principals (IAM quotas).
Cost
No new infrastructure. Ingestion is billed as legacy streaming inserts at $0.01 per 200 MiB, with each row counted as at least 1 KB (BigQuery pricing, Iowa).
Judgement: fine for one developer or a small, trusted team. As an organization's default, a dataset-wide dataEditor grant shows everyone's transcripts to everyone.
Option B
Developers impersonate a shared service account
A service account such as bqaa-writer@my-project.iam.gserviceaccount.com holds the write role. Developers get the right to mint short-lived tokens for it.
IAM roles
On the service account itself, not on the project: roles/iam.serviceAccountTokenCreator for a group of developers. gcloud iam roles describe (run 2026-10-15, matching Google's IAM roles reference) lists its permissions as iam.serviceAccounts.get, getAccessToken, getOpenIdToken, implicitDelegation, list, signBlob and signJwt, plus resourcemanager.projects.get and list. roles/iam.serviceAccountUser lists only iam.serviceAccounts.actAs, get and list, plus the same two project permissions. None of those mints a token, so it cannot impersonate; actAs is for attaching the account to resources (service account permissions).
Granted on the project, either role covers every service account in the project, so bind it on the one account. The account itself gets the write role on the dataset.
Admin flow
Create the account, grant it the write role, and grant Token Creator on it to a group. Each step happens once; after that, the admin manages the group.
Developer flow
Point the mod at an impersonated token. The narrowest way is the mod's own token command, which uses the gcloud CLI sign-in (gcloud auth login):
The accessTokenCommand option takes the same text (config.ts L170).
The tracing guide suggests gcloud auth application-default login --impersonate-service-account=… instead (USER_GUIDE L91–94). That changes ADC for every tool on the machine, not just the mod.
Setup
gcloud iam service-accounts create bqaa-writer --project=my-project
# today's grant; or the write-only custom role from option F
bq add-iam-policy-binding -d \
--member='serviceAccount:bqaa-writer@my-project.iam.gserviceaccount.com' \
--role='roles/bigquery.dataEditor' \
'my-project:agent_analytics'
gcloud iam service-accounts add-iam-policy-binding \
bqaa-writer@my-project.iam.gserviceaccount.com \
--member='group:bqaa-writers@example.com' \
--role='roles/iam.serviceAccountTokenCreator'
Token lifetime
Impersonated access tokens last one hour by default. They last up to 12 hours only if the org policy constraint constraints/iam.allowServiceAccountCredentialLifetimeExtension allows it (gcloud reference). No long-lived service-account key sits on the laptop. The one-hour tokens are minted from the developer's gcloud sign-in, a renewable user credential that gcloud keeps and reuses: "If valid credentials for an account are already available from a prior authorization, the account is set to active without rerunning the flow" (gcloud auth login reference).
Blast radius
Whatever the account can do, every token holder can do, from any machine. Whoever holds a developer's stored gcloud sign-in can keep minting tokens until that sign-in or the Token Creator grant is revoked. If the account holds dataEditor on the dataset, every developer can read, rewrite and delete everything. BigQuery sees the account as the caller. Cloud Audit Logs entries made with an impersonated token also name the person, under serviceAccountDelegationInfo; the token-minting call itself is logged only if IAM Data Access audit logs are on (audit log examples). The table cannot tell developers apart.
UX
One config line per machine, which the admin can push with the mod's options. Each developer still signs in to gcloud.
Operations
One account and one group. The account becomes a shared, high-value identity to watch.
Cost
No new infrastructure. Same ingestion price as A.
Judgement: no smaller blast radius than binding the same role to a group directly (F), and weaker attribution. Use it only where a policy says data roles must be held by service accounts.
Option C
A service-account key in the config file
An admin creates a JSON key for a writer account and installs it on every machine.
IAM roles
The account gets the write role. An admin with the right to create keys (for example roles/iam.serviceAccountKeyAdmin) makes the key. Developers need no role.
How the mod would use it
The mod cannot sign with a key itself: a mod has a digest function but no signing (README L209–214). The usual route is GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json. The default token command then prints a token for the key's account (gcloud reference).
Admin flow
Create the key, push the file to every machine, rotate it on a schedule, and replace it everywhere after any suspected leak.
Developer flow
None.
Setup
gcloud iam service-accounts keys create key.json \
--iam-account=bqaa-writer@my-project.iam.gserviceaccount.com
# then, on every machine:
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
Blast radius
The file is the account. It works from any machine, for anyone, until an admin deletes it. By default it never expires; an expiry needs the org policy constraint constraints/iam.serviceAccountKeyExpiryHours, which applies only to new keys (restricting service accounts).
It sits where the developer, the coding agent and every tool the agent runs can read it. The mod's redaction is pattern-based, and its README warns that "Patterns cannot catch every secret" (README L665). If Google finds the key exposed in public, the default response is to disable it (constraints/iam.serviceAccountKeyExposureResponse), which stops every machine at once (constraints reference). Every row comes from one account, so there is no attribution.
Org policy
Key creation can be blocked with iam.disableServiceAccountKeyCreation or its managed version, iam.managed.disableServiceAccountKeyCreation. Organizations created on or after 3 May 2024 block it by default as part of Google's secure-by-default baseline (secure-by-default organizations). In those organizations, this option needs a policy exception first.
UX
Easiest for developers: nothing to do.
Operations
The heaviest: distribution, rotation, leak response, and an outage for everyone when the key is revoked.
Cost
No new infrastructure. Same ingestion price as A.
Judgement: do not use it. Every other option avoids a long-lived shared secret, and this one would put it on every machine that runs a coding agent.
Option D1 · central ingestion
A Cloud Run ingestion service
A small HTTPS service on Cloud Run (or a Cloud Run function) accepts event batches and writes them. It runs as its own service account, the only principal that can write the table. Developers hold no BigQuery role at all.
IAM roles
Without IAP: developers, through a group, get roles/run.invoker on that one service (Cloud Run docs).
With IAP: developers get roles/iap.httpsResourceAccessor, and the IAP service agent, service-PROJECT_NUMBER@gcp-sa-iap.iam.gserviceaccount.com, gets roles/run.invoker (IAP for Cloud Run).
Either way, the service's own account gets the write role on the table, and developers get no BigQuery role.
Authentication
Cloud Run documents only Google-signed ID tokens for calling a private service. The developer page says "you must pass a valid ID token for a user with the run.routes.invoke permission" (Authenticate developers). The service-identity page uses OAuth 2.0 access tokens "to call most Google API Client Libraries" and ID tokens "to call other Cloud Run services" (service identity). The Cloud Run functions page says "Identities must provide an ID token for authentication" (Cloud Run functions authentication), and the service-to-service page tells federated callers to request an ID token rather than an access token (service-to-service authentication). No Cloud Run page checked says access tokens are accepted, so D1 cannot reuse the mod's access-token command; it needs new ID-token work. The developer page also shows gcloud auth print-identity-token, but warns that such tokens "lack an audience claim, which makes them susceptible to replay attacks", and points production callers to service-account ID tokens with an audience (Authenticate developers).
For per-person identity in production, turn on IAP for the service. IAP then passes a signed JWT in x-goog-iap-jwt-assertion, whose email claim the service can trust (IAP signed headers). Command-line callers need extra setup: a custom desktop OAuth client on IAP's programmatic-access allowlist and an ID token for it, and "Only Google Identities are supported for user account programmatic access in IAP" (IAP programmatic authentication).
Without IAP, developers can impersonate a submit-only service account to get audience-bound ID tokens. Then the service cannot tell developers apart. Federated workloads (option E) get ID tokens the same way, through a service account.
Admin flow
Build and deploy the service, create its account, grant it the write role, and bind the developer group as invoker, or as IAP user when IAP is on. Then manage the group.
Developer flow
Sign in once: gcloud, or an IAP sign-in helper. The endpoint URL arrives with the mod's options.
Setup
gcloud run deploy bqaa-ingest --image=IMAGE --region=us-central1 \
--service-account=bqaa-ingest@my-project.iam.gserviceaccount.com \
--no-allow-unauthenticated
gcloud run services add-iam-policy-binding bqaa-ingest --region=us-central1 \
--member='group:bqaa-writers@example.com' \
--role='roles/run.invoker'
Checks the schema and the size of each batch, applies per-person rate limits, stamps user_id from the verified identity, and writes with event_id as the deduplication key. It answers with per-row errors that the mod's writer can classify, as it does insertAll answers today.
Blast radius
A leaked developer credential can submit events as that developer, through the service's checks and limits. It cannot read, change or delete rows. With IAP, rows cannot be forged under another person's name. Only people who can deploy the service, or act as its account, reach the write identity.
UX
Same as today after sign-in. The new host must be allowed by any organization web-fetch policy on the host CLI (README L829–830).
Operations
The highest of the real options: a production service to deploy, patch, monitor, scale and keep in step with the schema. During an outage, the mod's dead-letter files hold the rows, and replay must go through the same endpoint (section 07, Phase 2).
Cost
Cloud Run's request-based billing has a monthly free tier of 2 million requests, 180,000 vCPU-seconds and 360,000 GiB-seconds. Requests past that cost $0.40 per million, and requests denied by IAM are not billed (Cloud Run pricing). The service can write with the Storage Write API (gRPC), whose first 2 TiB a month are free (BigQuery pricing).
Judgement: the strongest model, and with IAP the only one in which user_id can be trusted. Worth its operating cost when a customer needs verified attribution or server-side checks.
Option D2 · central ingestion
A Pub/Sub topic with a BigQuery subscription
The mod publishes each row as a message to one Pub/Sub topic. A BigQuery subscription writes the messages into the events table. There is no code to run.
IAM roles
Developers, through a group: roles/pubsub.publisher on the one topic. It holds only pubsub.topics.publish (Pub/Sub access control). Developers need no BigQuery role.
Writer: by default the Pub/Sub service agent, service-PROJECT_NUMBER@gcp-sa-pubsub.iam.gserviceaccount.com, or a service account named with --bigquery-service-account-email. It needs roles/bigquery.dataEditor, which the Pub/Sub docs allow on the project or on the table alone. A table grant is enough here, unlike insertAll in F, because the subscription writes through the Storage Write API, which lists bigquery.tables.updateData and no dataset permission (Storage Write API). Prefer the named account: with the service-agent default, the docs warn that "any user who has permission to create a subscription in your project can write to the BigQuery table" (BigQuery subscriptions). With a named account, the service agent needs Token Creator on it, and whoever creates the subscription needs actAs on it.
Authentication
The OAuth access token the mod already gets works as is: publishing is an ordinary Google API call (topics.publish). No new sign-in.
Admin flow
Create the topic, a dedicated writer account with its table role, and the BigQuery subscription, plus a dead-letter topic and a subscription that holds what lands there. Bind the developer group as publisher. Name an owner for failed rows. Then manage the group.
# 1. the topic, and the developers' publish right
gcloud pubsub topics create bqaa-events --project=my-project
gcloud pubsub topics add-iam-policy-binding bqaa-events --project=my-project \
--member='group:bqaa-writers@example.com' \
--role='roles/pubsub.publisher'
# 2. a dedicated writer account for the subscription
gcloud iam service-accounts create bqaa-pubsub-writer --project=my-project
bq add-iam-policy-binding \
--member='serviceAccount:bqaa-pubsub-writer@my-project.iam.gserviceaccount.com' \
--role='roles/bigquery.dataEditor' \
'my-project:agent_analytics.agent_events'
gcloud iam service-accounts add-iam-policy-binding \
bqaa-pubsub-writer@my-project.iam.gserviceaccount.com \
--member='serviceAccount:service-PROJECT_NUMBER@gcp-sa-pubsub.iam.gserviceaccount.com' \
--role='roles/iam.serviceAccountTokenCreator'
# 3. dead letters: a topic with no subscription drops what it receives,
# so a hold subscription keeps failed rows for replay
gcloud pubsub topics create bqaa-events-dead --project=my-project
gcloud pubsub subscriptions create bqaa-events-dead-hold --project=my-project \
--topic=bqaa-events-dead \
--message-retention-duration=31d --expiration-period=never
gcloud pubsub topics add-iam-policy-binding bqaa-events-dead --project=my-project \
--member='serviceAccount:service-PROJECT_NUMBER@gcp-sa-pubsub.iam.gserviceaccount.com' \
--role='roles/pubsub.publisher'
# 4. the BigQuery subscription, then the service agent's grant on it
gcloud pubsub subscriptions create bqaa-events-bq --project=my-project \
--topic=bqaa-events \
--bigquery-table=my-project:agent_analytics.agent_events \
--use-table-schema \
--bigquery-service-account-email=bqaa-pubsub-writer@my-project.iam.gserviceaccount.com \
--dead-letter-topic=bqaa-events-dead --max-delivery-attempts=5
gcloud pubsub subscriptions add-iam-policy-binding bqaa-events-bq --project=my-project \
--member='serviceAccount:service-PROJECT_NUMBER@gcp-sa-pubsub.iam.gserviceaccount.com' \
--role='roles/pubsub.subscriber'
Flags from the gcloud reference. Google's samples warn that "messages published to a topic with no subscriptions are lost", and the service agent needs the two dead-letter grants above (dead-letter topics). The hold subscription keeps failed rows for at most 31 days, the maximum retention; --expiration-period=never stops it from expiring while nobody reads it.
Blast radius
A leaked credential or a developer acting in bad faith can publish messages: forged events under any user_id, or a flood that costs money. They cannot read, change or delete rows. Nothing about the publisher reaches the row, and Pub/Sub "does not currently write Data Access audit logs for message operations, such as Publish" (Pub/Sub audit logging). So a forged row cannot be traced to its sender afterwards.
Delivery and schema
Pub/Sub delivers at least once, and the subscription writes through the Storage Write API (gRPC) (BigQuery subscriptions overview). A row can land twice; the mod already gives each row an event_id for exact deduplication in SQL (bigquery.ts L22–23).
With --use-table-schema, JSON message fields map to table columns. JSON-type columns must arrive as "valid, JSON in an escaped string" (BigQuery subscriptions), which is how the mod already sends content, attributes and latency_ms (rows.ts L29–32). The mod sends timestamp as an ISO 8601 string (rows.ts L85); whether the subscription accepts that for a TIMESTAMP column needs a spike.
Do not use --write-metadata: it puts message attributes into a column named attributes, which BQAA already uses (gcloud reference).
UX
Same as today. The host pubsub.googleapis.com must be allowed by any organization web-fetch policy on the host CLI.
Operations
Low: fully managed, but failed rows need an owner. Owner: TBD (Haiyuan to assign).
Retention: the hold subscription in the setup keeps failed rows for up to 31 days and never expires. The alternative is message retention on the dead-letter topic itself, also up to 31 days, which "allows any attached subscription to seek" back to those messages (gcloud topics create; replay).
Alerting: alert when subscription/dead_letter_message_count on bqaa-events-bq rises above zero, which means rows are failing. Alert too when subscription/oldest_unacked_message_age_by_region on bqaa-events-dead-hold passes a few days, so replay happens well before day 31. The Pub/Sub docs name the first metric for dead-letter monitoring and recommend the by_region backlog metrics for alerting (Pub/Sub monitoring).
Replay: each forwarded message names its failure in the CloudPubSubDeadLetterSourceDeliveryErrorMessage attribute, which export subscriptions such as BigQuery ones set (dead-letter topics). The owner fixes the cause, for example a missing column, then republishes the held messages to bqaa-events.
A new column must reach the table before the mod sends it, or the subscription must drop unknown fields.
Cost
BigQuery subscriptions cost $50 per TiB, with "no additional BigQuery data ingestion charges", and their first 10 GiB is not free. Publishing costs $40 per TiB after the first 10 GiB a month (Pub/Sub pricing).
Judgement: the cheapest way to take table access away from developers. Choose it over D1 when a best-effort user_id is acceptable.
Option E
Workload Identity Federation, and its workforce twin
Not a new place for the write right, but a way to give it, without keys, to identities that are not Google accounts.
What it covers
Workload identity federation lets workloads outside Google Cloud, such as CI runners on GitHub Actions or machines in another cloud, use "federated identities instead of a service account key" (Workload Identity Federation). Workforce identity federation lets a company's own identity provider, such as Okta, sign its people in to Google Cloud without Google accounts (Workforce Identity Federation).
IAM roles
For F and D2, grant the narrow role or the publish right directly to federated principals. Google recommends this "direct resource access" over impersonating a service account (Workload Identity Federation).
D1 is different. Cloud Run needs a Google-signed ID token, and a federated workload gets one only through a service account: Cloud Run's docs tell such callers to "call generateIdToken instead" of generateAccessToken (service-to-service authentication). Google's tutorial grants the federated principal roles/iam.workloadIdentityUser on a service account that holds roles/run.invoker (Cloud Run and Workload Identity Federation). The service then sees that account, not the workload, so user_id stays client-asserted. The per-person IAP design does not carry over to workforce identities either: IAP's command-line path supports only Google identities (IAP programmatic authentication).
Identifiers look like principal://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/subject/SUBJECT for one workload, or principalSet://iam.googleapis.com/locations/global/workforcePools/POOL_ID/group/GROUP_ID for a workforce group (principal identifiers). The tracing bootstrap's checks already accept principal:// and principalSet:// members, though its bq binding step was not tried with them (setup_gcp_prereqs.py L29–36). BigQuery supports federated identities: its API has no known limitations, and the listed gaps are console features and some data-loading connectors (supported services).
Admin flow
Create a pool and a provider once, with an attribute condition that limits which repositories or people can get tokens. Then grant roles to the pool's principals or groups.
Setup
# a pool and an OIDC provider for one CI system, limited to one repository
gcloud iam workload-identity-pools create ci-pool --location=global
gcloud iam workload-identity-pools providers create-oidc ci-provider \
--location=global --workload-identity-pool=ci-pool \
--issuer-uri='https://token.actions.githubusercontent.com' \
--attribute-mapping='google.subject=assertion.sub,attribute.repository=assertion.repository' \
--attribute-condition="assertion.repository=='my-org/my-repo'"
# on the runner: a credential file that holds no secret; it reads the
# job's OIDC token from the file the CI job writes it to
gcloud iam workload-identity-pools create-cred-config \
projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/ci-pool/providers/ci-provider \
--credential-source-file=/path/to/oidc-token --output-file=credentials.json
# one direct grant, here the publish right from D2
gcloud pubsub topics add-iam-policy-binding bqaa-events --project=my-project \
--member='principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/ci-pool/attribute.repository/my-org/my-repo' \
--role='roles/pubsub.publisher'
# for D1 only: the same workloads may act as a submit-only account,
# which holds roles/run.invoker on the service
gcloud iam service-accounts add-iam-policy-binding \
bqaa-submit@my-project.iam.gserviceaccount.com \
--member='principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/ci-pool/attribute.repository/my-org/my-repo' \
--role='roles/iam.workloadIdentityUser'
CI: point GOOGLE_APPLICATION_CREDENTIALS at the credential configuration file, so the mod's default token command can print a federated token (not tried for this study). For D1, the job mints an ID token for the service account instead. People: sign in to gcloud through the company's identity provider; no Google account is needed.
Blast radius
The credential configuration file "doesn't contain a private key and doesn't need to be kept confidential" (federation with other providers). Federated tokens are short-lived, and an attribute condition limits which repositories or people can get one. What a token can do is whatever you granted, so pair this with F or D.
UX, operations, cost
One-time setup per identity provider or CI system. No key rotation and no infrastructure to run.
Judgement: use it for CI and for customers whose people have no Google accounts. It combines with F and D2 directly, and with D1 only through a service account; it does not replace them.
Option F
One Google group, bound once, with a narrow scope
Option A done properly. The admin creates one Google group and binds it once. After that, access is group membership.
IAM roles
One custom role, "BQAA event writer", with exactly the three permissions insertAll lists: bigquery.tables.updateData, bigquery.tables.get and bigquery.datasets.get (insertAll reference). No predefined role that can be granted to people adds rows without also reading them, so a custom role is the only way to stay write-only (BigQuery access control). Write-only here means it cannot read rows. It is not append-only; see the blast radius below.
Bind it once, to group:bqaa-writers@example.com, on a dataset that holds only the events table; setup.sh already keeps the views in a separate dataset (setup.sh L7–9). A binding on the table alone may not be enough, because insertAll also checks bigquery.datasets.get on the dataset.
No jobUser, and no right to create tables: the admin pre-creates the table with setup.sh. The writer tries to create the table only after a 404 (writer.ts L355–366), so with the table in place auto-create never runs, and the role would refuse it anyway. Auto-create can be switched off only through the BQAA_AUTO_CREATE_TABLE environment variable, not a mod option (config.ts L198; README L181–190). Where custom roles are not allowed, roles/bigquery.dataEditor on that dataset is the fallback, with reading and deleting included.
Scoping that helps
A dataset of its own: no reach into other tables.
No other way in. The no-read promise holds only if developers get no BigQuery read from elsewhere. Basic roles reach data: "granting access to a project also grants access to datasets within it", and BigQuery gives a project's Viewers roles/bigquery.dataViewer, and its Editors roles/bigquery.dataEditor, on datasets created while they hold those roles; Owners can delete any dataset (basic roles in BigQuery). Data roles granted on the project, folder or organization reach every dataset below, because "resources inherit the allow policies of the parent resource" (resource hierarchy). So keep developers off basic Viewer, Editor and Owner on the events project and off project-wide data roles such as roles/bigquery.dataViewer, and check the events dataset's own access list for grants those defaults left behind.
Readers use views. setup.sh puts the views in a separate reporting dataset, then only tells the admin to authorize them on the source dataset (setup.sh L120–122). That step must happen: an authorized view lets readers "run queries on it, but they can't access the source dataset directly" (authorized views). Authorizing the whole reporting dataset covers both views at once. Then readers never touch the table, and writers need nothing in the reporting dataset.
IAM Conditions attach to organization, folder, project and dataset bindings, not to table bindings. A request.time condition gives contractors expiring access (IAM Conditions in BigQuery).
Per-person reads, if wanted: a view or row access policy that filters on SESSION_USER(), which returns the caller's email, or a federated caller's principal identifier (security functions). It works only for rows whose user_id holds the verified email. Even with userIdFromCredentials on, a failed lookup leaves the configured name in a row, so such a filter can miss that person's rows (writer.ts L617–621; README L269–273). It also shows that person any row someone else wrote under their email, because user_id is whatever the writer sent. Row access policies limit reads, not writes, and views are read-only (views).
Admin flow
Once: create the group, the custom role and the binding. After that, add and remove people in the group, or sync the group from the company's identity provider.
gcloud iam roles create bqaaEventWriter --project=my-project \
--title='BQAA event writer' \
--permissions=bigquery.tables.updateData,bigquery.tables.get,bigquery.datasets.get
bq add-iam-policy-binding -d \
--member='group:bqaa-writers@example.com' \
--role='projects/my-project/roles/bqaaEventWriter' \
'my-project:agent_analytics'
# readers: authorize the reporting dataset on the events dataset, so its
# views can read the table while the readers themselves cannot
bq show --format=prettyjson my-project:agent_analytics > agent_analytics.json
# add this entry to the "access" list in agent_analytics.json:
# {"dataset": {"dataset": {"project_id": "my-project",
# "dataset_id": "agent_analytics_reporting"},
# "target_types": "VIEWS"}}
bq update --source agent_analytics.json my-project:agent_analytics
bq add-iam-policy-binding -d \
--member='group:bqaa-readers@example.com' \
--role='roles/bigquery.dataViewer' \
'my-project:agent_analytics_reporting'
Then add people to the groups. The authorization steps are Google's procedure for authorized datasets; the two datasets must be in the same location (authorized views). setup.sh creates the reporting dataset (default <dataset>_reporting) and only prints this step (setup.sh L120–122). Readers also need roles/bigquery.jobUser in some project to run queries, as that output says.
Blast radius
A leaked credential or a member acting in bad faith can add forged rows under any user_id, and read table metadata such as the schema. They cannot read or export rows, and they cannot delete or create tables; deleting a table needs bigquery.tables.delete (manage tables), which the role leaves out.
The role is not append-only. Google lists bigquery.tables.updateData as the permission "to write data to a new table, overwrite a table, or append data to a table", with bigquery.jobs.create "to run a query job" (Write query results). So a member who can run query jobs in any project, a personal one included, can very likely replace or empty the table's rows with a query that overwrites it. Withholding jobUser in the events project does not stop that. TRUNCATE TABLE has no documented permission list (DML syntax) and may work the same way. Load and copy jobs that overwrite a table are documented as also needing bigquery.tables.create and bigquery.tables.update, which the role lacks (batch loading; manage tables).
Time travel can restore changed or deleted rows from up to seven days back by default (time travel). If developers must not be able to destroy rows, use central ingestion (D). The spike in section 06 should try the overwrite paths before anyone relies on this paragraph.
UX
Same as today. The mod's "no permission" notice should say "ask to join bqaa-writers@…" instead of naming dataEditor on the dataset.
Operations
One binding, ever. Membership follows the company's joiner and leaver process. Group changes are eventually consistent: "Typically several minutes, potentially hours or longer", and adding a person propagates faster than removing one (access change propagation).
Cost
Nothing beyond today.
Judgement: the right default now. It needs no new infrastructure and no secret, and its blast radius is far smaller than today's dataset-wide dataEditor: nobody reads anybody else's transcripts. It does not stop a member from overwriting rows; customers who need that go to D.
05 / Comparison
5. Comparison
Pros and cons of the seven options
Option
Pros
Cons
Use when
A. Per-user grants
Nothing new for developers. No new infrastructure or secret.
One IAM change per person; at most 1,500 principals per policy. Today's role lets everyone read all transcripts and delete the table.
One developer, or a small trusted team.
B. Impersonate a service account
No long-lived service-account key; one-hour tokens, minted from each developer's renewable gcloud sign-in. One place to change the account's role.
Every developer can become the account, so no smaller blast radius than F. BigQuery sees one identity for everyone.
A policy requires data roles to be held by service accounts.
C. Key in the config
Zero developer setup.
A shared bearer secret on every laptop, readable by the agent and its tools. Revocation breaks everyone. Often blocked by policy.
Never, for this mod.
D1. Cloud Run ingestion
Developers have no table access. Server-side checks and rate limits. With IAP, a trustworthy user_id.
A production service to run. ID-token or IAP sign-in work in the mod. A new host for web-fetch policies.
Verified attribution or validation is required.
D2. Pub/Sub ingestion
Developers can only publish. No code to run. Same access token as today.
user_id stays client-asserted. At-least-once delivery, so deduplicate on event_id. Column mapping needs a spike.
Developers must not touch the table; best-effort attribution is fine.
E. Workload Identity Federation
No keys for CI or for people without Google accounts. Short-lived tokens; attribute conditions.
Setup per identity provider or CI system. Narrows nothing by itself. With D1, callers act through a service account, so the service cannot tell them apart.
CI agents, or customers whose people have no Google accounts.
F. One group, narrow scope
One binding, ever. Offboarding through the group. With the custom role, no reading rows and no deleting the table. Nothing new for developers.
Members can add forged rows and, from any project where they can run query jobs, very likely overwrite or empty the table. Needs the right to create custom roles, and someone to run the group.
The default, now.
Blast radius at a glance: what a leaked developer credential, or a developer acting in bad faith, can do
Option
Who can write the table
New secret on laptops
Read others' events
Change or delete rows, or the table
user_id verified
Service to run
A. Per-user grants (today's role)
Every developer, directly
No
Yes
Yes
No
No
B. Impersonate a service account
Every developer, as the account
No key; one-hour tokens, minted from the developer's renewable gcloud sign-in
If the account can; with dataEditor, yes
If the account can; with dataEditor, yes
No
No
C. Key in the config
Anyone holding the file
Yes; never expires by default
If the account can
If the account can
No
No
D1. Cloud Run ingestion
Only the service's account
No
No
No
Yes, with IAP
Yes
D2. Pub/Sub ingestion
Only the subscription's writer account
No
No
No
No
No; managed
E. Workload Identity Federation
The federated identities you grant
No; the config file holds no secret
As granted
As granted
Not by itself
No
F. One group, narrow scope
Group members, directly
No
No, if no basic or project-wide role grants it
Very likely can overwrite or empty the rows with a query job; cannot delete the table
No
No
"user_id verified" means a person cannot write a row under someone else's name. userIdFromCredentials labels rows with the verified email when the token lookup works, and with the configured name when it does not. Anyone who can write the table can still insert rows under another name.
Judgement: cost does not decide this. For a 100-developer team, every option's ingestion bill rounds to a few dollars a month or less (see the cost estimate below). The deciding questions are who can read transcripts, who can destroy data, whether user_id must be trustworthy, and who will operate what.
Cost estimate
These are assumptions, not measurements: 100 developers, 2,000 rows each per working day, 2 KB per row on average, and 22 working days a month. The mod's fixture rows average 958 bytes; real rows with long tool output are larger. That is about 8.8 GB, or 8.2 GiB, a month (computed).
Direct write (A, B, C, E, F): legacy streaming inserts at $0.01 per 200 MiB come to about $0.42 a month (computed from BigQuery pricing, Iowa).
Pub/Sub (D2): the BigQuery subscription at $50 per TiB comes to about $0.40 a month. Publishing stays inside Pub/Sub's free 10 GiB a month (computed from Pub/Sub pricing).
Cloud Run (D1): if every developer's writer sent a batch every five seconds for four hours a working day, that is about 6.3 million requests a month: about $1.73 for requests past the free 2 million, plus CPU and memory time past the free tier (computed from Cloud Run pricing). The service's own writes through the Storage Write API (gRPC) fall inside its free 2 TiB.
06 / Recommendation
6. Recommendation: group grant now, central ingestion later, keys never
Now: make option F the documented default for any shared install. One Google group and one binding of a write-only custom role, on a dataset that holds only the events table, which the admin pre-creates. Readers on the views in the reporting dataset that setup.sh builds, once the admin authorizes them. Developers keep their own ADC sign-in. No impersonation, no keys, no project-level jobUser for writers.
Now, as a PM decision: whether shared installs record a verified user_id. Turning on userIdFromCredentials costs no code, but it writes a personal email into every row, and it is best effort: when the token lookup fails or finds no verified email, the row keeps the configured name.
Later, when a customer needs developers to have no table access, or rows that developers cannot overwrite: add the Pub/Sub transport (D2). Offer Cloud Run behind IAP (D1) only to customers who also need a trustworthy user_id or server-side checks.
Whenever CI or non-Google identities appear: add Workload Identity Federation (E) on top of F or D2, by granting the same narrow role or publish right to the federated principals. With D1, federated callers go through a submit-only service account instead, and the service sees that account, not them.
Never: service-account keys (C). Impersonation (B) stays a documented fallback for organizations whose policy requires a service account to hold data roles.
Why this order
F removes the worst exposure today, which is every developer reading every transcript and being able to delete the table. It changes nothing for developers, adds no infrastructure and no secret, and replaces per-person IAM changes with group membership. It is also mostly documentation and setup.
F cannot stop a group member from adding forged rows, or from overwriting the table with a query job: the permission that adds rows also overwrites them (Write query results). Only a central path removes that right from laptops. D2 does it with no code to run and with the token the mod already has, so it is the natural second step. D1 adds the one thing D2 lacks, a trustworthy user_id, at the price of running a service.
B gives every developer the service account's power, so it shrinks nothing that F does not, and it hides who wrote what behind one identity. C adds a shared secret with no expiry to every laptop that runs a coding agent.
Rough sizing
Estimates, not measurements, to show the order of magnitude. They assume one engineer who knows the mod, a sandbox Google Cloud project with admin rights, code review included, and no customer policy that blocks the design.
Rough size of each phase, with what the estimate assumes
Phase
Work
Rough size
Assumes
Now: F
Mod: accessHelp and autoCreateTable options, a notice for a refused create, tests. setup.sh: writers group and view authorization. Tracing bootstrap: custom role, opt-in jobUser. Docs.
About 1 to 2 weeks
The changes listed in section 07, Phase 1.
Spike for F
The test run listed below.
1 to 3 days
A sandbox dataset and two test accounts: an admin and a group member.
Each existing install
The six migration steps in section 07.
Hours of admin time, plus IAM propagation
Propagation is "typically several minutes, potentially hours or longer" for group changes (access change propagation).
Later: D2
Mod: transport option, publish requests and their classifier, a batch cap that allows for base64, backfill through the transport, tests. Setup: topic, subscriptions, dead letters, alerts. Spike: column mapping and a dead-letter replay drill.
About 3 to 5 weeks
The mapping spike passes without schema changes.
Later: D1
An ingestion service (checks, identity stamping, writes, per-row answers), its deployment and monitoring. Mod: endpoint transport, ID-token sign-in (an IAP helper or service-account tokens), backfill through the endpoint. Cloud Run documents only ID tokens, so none of today's token code carries over.
About 1 to 2 months, plus ongoing operations
A team agrees to run the service; the IAP OAuth client can be set up.
E, per CI system
Pool, provider, credential file, one grant, one test run.
1 to 2 days each
The CI system issues OIDC tokens.
Spike and test run
Owner: TBD (Haiyuan to assign). One run in a sandbox project should settle what this page could not check:
insertAll with F's three-permission role, bound on the dataset and, separately, on the table alone.
The overwrite paths for that role: a query job that overwrites the table, TRUNCATE TABLE, and DML UPDATE and DELETE.
The effective-access check in section 07: grant listing, a denied bq head, and Policy Troubleshooter on the table.
For D2: the column mapping (the ISO 8601 timestamp, the JSON columns, content_parts), and a dead-letter replay drill.
For D1, if pursued: a call with an access token, to confirm the refusal the docs imply, and the IAP command-line sign-in.
For E: whether the mod's default token command prints a token from a federated credential file.
Judgement: if only one thing changes this quarter, it should be the default grant: from dataEditor for each person to a write-only role held by one group.
07 / What changes in the mod
7. What changes in the mod
Phase 1: group grant (small changes)
The "no permission" notice. Today it says "ask for roles/bigquery.dataEditor on PROJECT:DATASET" (writer.ts L526–529). Add an option the admin sets, for example accessHelp = "ask to join bqaa-writers@example.com", and show it instead. Without it, name the permission on the table, not a dataset-wide role. Update the test that pins today's text (credentials.test.ts L135–153).
Auto-create. Writers in a shared install should not create tables, and F's role cannot. Today the switch is the BQAA_AUTO_CREATE_TABLE environment variable, which README lists as "environment only" (config.ts L198; README L181–190). Options the admin pushes cannot turn it off. Add an autoCreateTable option, on by default, that shared installs set off. Until then auto-create is harmless when the admin pre-creates the table, because the writer only tries after a 404 (writer.ts L355–366). When a create attempt is refused, show the same permission notice rather than only a recorded error (writer.ts L704–716).
Setup.setup.sh ends by telling writers to get dataEditor on the dataset (setup.sh L115–122). Add an optional writers-group setting that creates the custom role and binds it on the events dataset, printed in --dry-run like every other step. Also make it authorize the reporting views on the events dataset, which today it only asks the admin to do. Authorizing the whole reporting dataset covers both views; the two datasets must be in the same location, and the admin needs bigquery.datasets.update on the events dataset (authorized views).
Tracing bootstrap and docs. Give setup_gcp_prereqs.py the same write-only custom-role choice, and make its project-level jobUser grant opt-in, since it serves only verification queries (tracing L329–358). Update the mod README (L197–217) and the tracing guide's IAM table (USER_GUIDE L211–246) to match.
Verified user_id, if the PM wants it. Shared installs could turn on userIdFromCredentials (config.ts L200). It needs no new code, but it is a privacy decision. It is also best effort: a failed lookup, or a token with no verified email, leaves the configured name in the row (writer.ts L617–621; README L269–273). And anyone with write access can still insert rows under another name.
Moving an existing install to F
Teams already running the mod hold today's grants. Add the new access before removing the old, so writes never stop:
Add. Create the custom role and the group binding (option F), and put the current writers in the group. Group changes can take "several minutes, potentially hours or longer" to apply (access change propagation).
Remove per-person grants. Take each developer's dataEditor off the events dataset:
Remove project-level grants made for writers. The tracing bootstrap grants roles/bigquery.jobUser on the project "for verification queries", and with --runtime-auto-create-dataset also roles/bigquery.user (tracing setup_gcp_prereqs.py L346–378). The second is wider: on a project it also "allows the creation of new datasets", and the creator becomes their owner (BigQuery access control). Remove both unless people need them for other work. With jobUser gone from this project, a member can still run query jobs in any other project where they have it.
Tidy the dataset. Move any other tables out of the events dataset, authorize the reporting views, and point readers at them. Turning auto-create off still means setting the environment variable on each machine until the option exists (Phase 1, item 2).
Check what people can actually do. List the grants that remain on the dataset, the table and the project:
Look for leftover per-person, basic or project-wide BigQuery roles. After the changes propagate, test with one developer's account: a session's rows are sent (/bqaa-status counts them, README L568–572), and reading the table (bq head -n 1 'my-project:agent_analytics.agent_events') is denied. Do not test deletion by deleting. Ask Policy Troubleshooter about the table itself:
gcloud policy-intelligence troubleshoot-policy iam \
//bigquery.googleapis.com/projects/my-project/datasets/agent_analytics/tables/agent_events \
--principal-email=dev@example.com \
--permission=bigquery.tables.delete
Run it again with --permission=bigquery.tables.getData; both should report no access. The table's full resource name is from Google's resource name formats list. Policy Troubleshooter weighs allow, deny and principal access boundary policies, but it takes one person's email, not a group, and it can only weigh the policies that the person running it may view (Policy Troubleshooter). It does not test the query-overwrite path; the spike in section 06 covers that.
Replay. Rows refused during the switch wait in the mod's dead-letter files, and /bqaa-backfill sends them once access works (README L250–251). That works under F as it is, because replay still uses insertAll (writer.ts L950). A later move to D1 or D2 needs the Phase 2 writer change first, or parked rows are stranded.
Phase 2: a second transport
A transport option. In config.ts: bigquery (today), pubsub (a topic name) or endpoint (a URL).
Pub/Sub requests. In bigquery.ts, beside the insertAll helpers: a publish URL (https://pubsub.googleapis.com/v1/projects/PROJECT/topics/TOPIC:publish), a body with each row base64-encoded in data and event_id as an attribute, and a classifier for publish answers. Pub/Sub takes up to 1,000 messages and 10 MB per request (Pub/Sub quotas). Base64 adds a third, so the batch byte cap must fall: today's 3 MiB batch would grow to about 4 MiB, which is the mod fetch's request limit (config.ts L185–189).
Endpoint requests. The same rows as JSON to the service URL. Cloud Run documents only ID tokens (D1), so this is new work, not a reuse of today's token command. The token changes from an access token to an ID token: from an IAP sign-in helper for per-person identity, or an audience-bound token from a submit-only service account. Plain gcloud auth print-identity-token tokens are for development only (D1).
The writer. Both send paths must use the selected transport. Live delivery is deliver() (writer.ts L289–379). Replay is backfillFile(), which posts parked rows to insertAll on its own (writer.ts L912–994, the call at L950). Replay runs 15 seconds after a session starts, after BigQuery recovers, and on /bqaa-backfill (register.ts L305–309; writer.ts L391–396; register.ts L535–548). Under D1 or D2 developers hold no BigQuery access, so a replay left on insertAll would be refused and parked rows would be stranded. The bounded queue, retries and the dead-letter file format stay as they are.
Docs. Say that the new host must be allowed by any organization web-fetch policy.
08 / Open questions for the PM
8. Open questions for the PM
Each answer changes the design. The first five matter most.
Who is "the admin"? The person who installs the CLI and the mod, the owner of the BigQuery project, and the person who manages Google groups are often three different people. Which of them runs setup, and which step needs whom?
Do developers have Google identities? That means Google Workspace or Cloud Identity accounts, plus the gcloud CLI on each machine. If not, we need workforce identity federation (E), or a central path with a different sign-in.
Which organization policies must we live with? Key creation turned off, which is the default for organizations created since May 2024 (secure-by-default organizations). Domain restricted sharing, under which "only principals that belong to allowed domains or organizations can be granted IAM roles"; it is also on by default in new organizations (restricting domains). VPC Service Controls around BigQuery, which deny access from the internet by default, so writes from laptops need an ingress rule or access level (VPC Service Controls). Also the right to create custom roles, and the host CLI's web-fetch allowlist.
May developers read each other's events? Today they can, because the table mirrors transcripts. If not, who reads: a small analyst group, through views?
Must user_id be trustworthy? Chargeback, compliance and per-person dashboards need it; usage trends may not. The answer decides between D2 and D1, and whether shared installs turn on userIdFromCredentials, which puts a personal email in every row.
One table per company, per team, or per project? Where does it live, who pays for ingestion, and do grants cross projects or organizations?
Where must the data stay? The dataset location defaults to US (config.ts L10). With D, the Pub/Sub message storage policy or the Cloud Run region must match too.
Who may delete rows? For example, one person's events on request. Under F, members cannot read rows or delete the table, but they can very likely overwrite or empty it with a query job. Only D leaves row destruction to admins alone. Either way, somebody must own deletion requests.
Will we run a service for customers? D1 is code that someone deploys, patches and supports. Some customers will want everything in their own project with nothing to operate, which favours F or D2.
Are CI and headless agents in scope for the first release? If so, E is part of the first release, not a later one.
Should ADK's BQAA plugin and the tracing plugin follow the same model? They write the same table, so a shared answer and shared setup tooling would be simpler for customers.
What this study assumed or did not verify
Assumptions and gaps
No option was set up or tested against a live Google Cloud project for this study. IAM facts come from Google's documentation and from the built-in references of gcloud 559.0.0 and bq 2.1.28, read on 2026-10-15.
Assumption: an admin can push the mod's options (project, dataset, token command, and any new option) to every machine through the host CLI's organization management. The README mentions organization-managed installs (README L829–836); pushing options that way was not tested.
The custom writer role in option F was not tried. The spike in section 06 should confirm that insertAll succeeds with only the listed permissions, and that a refused create shows up as expected.
Pub/Sub's mapping of agent_events columns was not tried: the TIMESTAMP column, the three JSON columns and the repeated content_parts record. The spike in section 06 should confirm it before D2 is promised.
The IAP sign-in flow for a CLI client was not tried, and the mod has no sign-in helper today.
Volume and cost figures are estimates from stated assumptions, not measurements. The mod's fixture rows average 958 bytes (computed from sample-rows.jsonl, 26 rows); real rows with long tool output are larger.
The DML reference lists no per-statement permissions, and TRUNCATE TABLE has none documented. Overwriting a table through a query job is documented for bigquery.tables.updateData. Which of these paths actually work for F's role was not tested.
A table-only binding was not tested. The insertAll reference lists bigquery.datasets.get on the dataset, which is why option F binds on a dedicated dataset.
Google's pages disagree on which key-creation constraint new organizations enforce by default: the secure-by-default page lists the managed iam.managed.disableServiceAccountKeyCreation, while other pages name the legacy iam.disableServiceAccountKeyCreation. Both block new keys.
Prices are Iowa (us-central1) list prices, read on 2026-10-15. The BigQuery pricing page lists no US multi-region price for ingestion.
Whether gcloud's application-default token command prints a token from a federated credential file (option E) was not tried.
Whether bq add-iam-policy-binding accepts principal:// or principalSet:// members was not tried. Its built-in help lists only user, group, service-account, domain and all-users members, which is why option E's example binds with gcloud.
Cloud Run's pages say an ID token is required ("you must pass a valid ID token"; "Identities must provide an ID token for authentication"), and none of the pages checked says access tokens are accepted. No live call was made to confirm that a service refuses an access token.