A teammate writes glab mr view 123 in a terminal and sees a conflict warning. You save the same command's output into a handoff note, and there is no line about conflicts at all. The merge request did not change between those two reads. The CLI changed how it rendered the result when stdout was redirected. That gap is what issue #7865 reported.
Save the preview and look for the conflict line
Run this in the repository of an MR you can read, replacing 123 with its number.
glab mr view 123 > mr.txt
grep '^conflicts:' mr.txt
On a build containing GitLab CLI !4485, the saved preview tells you which of these three answers it has.
| Saved value | What you can tell the next reviewer |
|---|---|
true |
GitLab reports a conflict between the source and target branches. |
false |
GitLab reports no conflict. CI, approvals, and other requirements still have their own status. |
unknown |
GitLab is preparing or still running the check. Fetch a fresh result before making a decision based on conflicts. |
If the file has no conflict line, first check whether your CLI build includes the change. Handle a failed glab command separately as well. The shell can create an empty output file before the command succeeds.
Why a boolean gave the wrong answer
Consider a branch that receives a push while a reviewer is preparing a handoff. GitLab can return detailed_merge_status: checking alongside has_conflicts: false. Printing the boolean alone at that moment would make a check still in progress look conclusive.
The plain-text formatter starts with the reported boolean and replaces it with unknown when the detailed status is unchecked, checking, or preparing. The distinction shows up in a saved file at precisely the point where a reader can no longer see the interactive UI. Merge request API reference
Give scripts both inputs
Use the JSON fields for automation. The plain-text line is convenient for a person reading a log or a handoff, but the JSON lets a script make its own decision about a pending check.
glab mr view 123 --output json --jq '{detailed_merge_status, has_conflicts}'
For an illustrative response of {"detailed_merge_status":"checking","has_conflicts":false}, the script should report that the check is pending. If the result matters, retry for a bounded period and leave the result inconclusive if the check never finishes. Also handle a nonzero exit from glab before consuming the result. Even after the conflict check is complete, a script needs separate evidence for whatever merge requirements it cares about.
What the test had to distinguish
The regression suite calls the non-terminal formatter directly. It checks both confirmed boolean results. It then supplies each of the three pending statuses and checks that the formatter prints unknown, including an assertion that it omits false. That last check matters because a renderer could append an unknown line while leaving the old boolean in the same output. A reader or parser would still see conflicting answers.
The merge request also updates the command help. It records passing tests for the mr view package and passing CI. The change has merged upstream. Implementation and tests
AI disclosure: An AI agent drafted and fact-checked this article against the linked issue and merge request. AI also assisted with the linked code change.
Top comments (1)
The redirected-output ambiguity this article describes is exactly why JSON output in CLIs matters as a contract, not a convenience.
In agentdiet 0.11, 94 % of CI integrations consume
--jsonrather than text — so we treat text as the human view and JSON as the contract. A machine-readable field like"conflicts": truenever gets dropped by a shell redirect the way aconflicts:line in plain text can.