This document is the single source of truth for how executor and reviewer read GitLab merge requests and discussions in orchestrator runs.
- Applies to all providers (
claude,opencode,codex) and both roles (executor/reviewer). - Trigger: user prompt mentions GitLab/MR/merge request/review comments/discussions.
- Tooling source:
glabCLI for GitLab reads. - Agents must not reinterpret read-only constraints.
- Allowed: read-only GitLab operations (
mr view,mr diff,mr view --comments,glab apiGET for MR notes/discussions, pipelines read). - Forbidden: any mutating GitLab actions in orchestrator rounds, including:
- creating/updating/closing/reopening MR;
- posting/editing/deleting notes/comments;
- approving/unapproving, assigning/reassigning, labeling;
- pushing commits, rebasing, merging from CLI.
- If user explicitly asks for a mutating GitLab action, it must be handled as a separate explicit task, not as part of read-only investigate/plan/review flow.
# Current branch MR
glab mr view
# Explicit MR id/iid/url
glab mr view <mr>
# Diff
glab mr diff <mr>
# Quick comments/activity view in CLI output
glab mr view <mr> --commentsglab 1.53.0 does not provide glab mr note list <mr> read command.
Use read-only API endpoints instead:
# Option A: from inside the target repository (uses current repo placeholders)
glab api "projects/:fullpath/merge_requests/<iid>/notes?per_page=100"
glab api "projects/:fullpath/merge_requests/<iid>/discussions?per_page=100"
# Option B: explicit GitLab host and URL-encoded project path
glab api --hostname <gitlab-host> "projects/<urlencoded_group%2Fproject>/merge_requests/<iid>/notes?per_page=100"
glab api --hostname <gitlab-host> "projects/<urlencoded_group%2Fproject>/merge_requests/<iid>/discussions?per_page=100"Practical way to get <iid> and <group/project>:
glab mr view <mr> --output jsonglab pipeline list
glab pipeline statusIf MR description contains TASK-<id> or a Notion URL, read task context:
notion task view <id>When GitLab MR review/study is requested:
- Verify CLI availability:
glab --helpglab auth status
- Apply bounded retries to every required GitLab read command:
- retry policy is mandatory and deterministic:
- max attempts:
5 - per-attempt timeout:
60s - pause between attempts:
5s
- max attempts:
- within each attempt:
- run the canonical read-only
glabcommand for the current step; - use a 60s per-attempt timeout (
timeout 60s glab ...or an equivalent tool timeout); - record whether the command result was
okorfailed.
- run the canonical read-only
- success condition: the command exits successfully and returns usable data for the current step.
- if a step has a documented fallback, apply the same retry policy to each fallback command.
- retry policy is mandatory and deterministic:
- Resolve target MR:
- if argument provided, use it;
- otherwise use MR for current branch (
glab mr view).
- Read MR metadata:
glab mr view <mr>
- Read diff:
glab mr diff <mr>
- Read notes/discussions:
- first try
glab mr view <mr> --commentsfor quick context; - then fetch full notes/discussions via API:
- from inside the target repository:
glab api "projects/:fullpath/merge_requests/<iid>/notes?per_page=100"glab api "projects/:fullpath/merge_requests/<iid>/discussions?per_page=100"
- or with explicit host/project:
glab api --hostname <gitlab-host> "projects/<urlencoded_group%2Fproject>/merge_requests/<iid>/notes?per_page=100"glab api --hostname <gitlab-host> "projects/<urlencoded_group%2Fproject>/merge_requests/<iid>/discussions?per_page=100"
- from inside the target repository:
- first try
- Parse and report:
- title, author, target branch, CI/pipeline status;
- changed files;
- comments/notes, including open vs resolved concerns where detectable;
- key reviewer concerns already raised (avoid duplicating already-addressed points).
- For each changed file, read full file in repo (not only diff hunks) before final conclusions.
- In outbox, explicitly list:
- exact GitLab commands run;
- attempt counters (
attempt X/5) for each GitLab read command; - command result per attempt:
ok/failed; - short stderr/stdout tail for failures;
- MR identity used (current branch or explicit
<mr>); - what was read from notes/discussions;
- what could not be verified (if any).
- Do not perform or suggest hidden mutating actions under read-only workflow.
- Independently verify executor claims using the same canonical read-only commands where possible.
- Validate that:
- conclusions are based on MR metadata + diff + notes, not only self-report;
- open concerns in notes/discussions are accounted for in conclusions;
- required GitLab read commands used the mandatory 5-attempt / 60s-timeout retry policy;
- no mutating GitLab action was performed.
- If MR cannot be resolved/read after the bounded retry policy (
glabauth/network/not found), report exact failing command, attempt count, timeout/failure status, and error. - Under investigation/planning flows, continue only if task remains meaningful without MR data; otherwise mark as blocked with concrete unblock requirements.
- Typical unblock actions:
- Fix GitLab auth for
glab. - Provide explicit MR id/url.
- Confirm repository/remote visibility for current environment.
- Fix GitLab auth for