Read the session's token from the variable a command is given
!139 (merged) made the upstream step ask GitLab which model a session resolved to, so the record could name it. In CI the step never asked: the first two ratings after tag 0.35.0 still say model=default (sessions 11230518 on !130 (merged) and 11230592 on gitlab-org/gitlab!270724 (merged)).
Cause
The Duo CLI removes CI_JOB_TOKEN, GITLAB_OAUTH_TOKEN and DUO_WORKFLOW_SERVICE_TOKEN from the environment of every command a flow runs. That is the same in its 10.0.0, 10.2.0 and 10.3.0 source. The step read GITLAB_OAUTH_TOKEN, found nothing, and returned without asking. The job log of session 11230518 shows it: the step took 143 ms and printed nothing.
GitLab gives commands the same token as GITLAB_TOKEN. It is there so glab works inside a session: the glab config the job writes holds no token.
The change
FetchUpstream::SessionModel reads GITLAB_TOKEN. Nothing else about the request changes. upstream.rb is read from main at run time, so this needs no tag, and the tagged build_note already records the name the step leaves.
Only that variable is read. GIT_PASSWORD holds the same token, and the Duo CLI's built-in sandbox, which is off in CI today, would leave it in place after removing GITLAB_TOKEN. Falling back to it would work around a decision to withhold the API token from commands, so the step does not. The record would say default again.
Checked before opening this
| Link | Evidence |
|---|---|
A command gets the token as GITLAB_TOKEN |
The Duo CLI excludes only the three names above. Both projects' job logs pass GITLAB_TOKEN to the executor. |
| A command can reach gitlab.com | It is in the sandbox allowlist in both projects' job logs, and the same step downloads from the registries through the same proxy code. |
| GitLab accepts the token for this query | /api/graphql admits the ai_workflows scope and the query's fields declare it. GitLab's request spec runs duoWorkflowWorkflows(workflowId:) { nodes { … } } with a composite service account's token. |
| A session may read itself | The policy rule that lets a session's token update its session, which every run does, grants reading it in the same line. |
| GitLab has the name before the model is called | Session 11188107, which the gate ended before any model call, shows claude_sonnet_5_5_vertex. Session 11176369, which failed before it started, shows none. |
| The name is the model that rated | The rater has no model tag, so it uses the session's model, and GitLab records the name the service resolved. |
In a real CI session, before this was opened
Session 11232660 of GitLab's Developer flow ran this branch's code in this project's CI, behind the same executor, sandbox and proxy setup the MR Risk Labeler runs behind. It changed nothing. What a command saw there:
GITLAB_TOKEN set; same as GIT_PASSWORD: true; GITLAB_OAUTH_TOKEN absent
base https://gitlab.com; session 11232660; proxy localhost:3128 with credentials
HTTP 200: {"data":{"duoWorkflowWorkflows":{"nodes":[{"modelMetadataName":"claude_sonnet_5_5_vertex"}]}}}- The code on
main, given the token under the name it reads, leftclaude_sonnet_5_5_vertex. - This branch's code, with the environment untouched, left
claude_sonnet_5_5_vertex.
What that session cannot show: the same request as gitlab-bot with the MR Risk Labeler's own service account, or in gitlab-org/gitlab's image. The checklist below covers both.
make check passes: both flows match their sources, rubocop is clean, and 392, 364 and 118 examples pass.
After this merges
- !130 (merged) rated again: its record names the model, its
rules=is this merge or later, GitLab returns the same name for the record's session, and gitlab-bot approves on it. Seen on 2026-11-13: the record at 05:17:26 UTC saysrules=bb786de9611be91da2aaec78ced101fbde451cab,model=claude_sonnet_5_5_vertexandworkflow=11233291, GitLab holds the same name for that session, and gitlab-bot approved at 05:17:31 UTC. The upstream step took 420 ms, against 143 ms before. - A gitlab-org/gitlab rating made after this merge shows the same in test mode. That is the first evidence from that project's image and Duo CLI 10.2.0. Seen on gitlab-org/gitlab!270780 (merged), which the flow rated on its own: its note says rules
bb786de9, modelclaude_sonnet_5_5_vertexand workflow11233204, its labels carry thetest-prefix, and GitLab holds the same name for that session. - !134 (merged)'s description refreshed, at 05:19 UTC on 2026-11-13.
Not in this change
- Records already written keep
model=default. Each names its session, and GitLab still holds that session's model. - Nothing alerts if records fall back to
default. - A step could instead ask through the executor's own client (
gitlab_graphql), with no token in any command. That needs about 1 KB of flow definition, and 102 bytes are left.