Skip to content

feat: return GitLab work item comments from issue:show --with-comments - #376

Merged
mglaman merged 3 commits into
mainfrom
feat/gitlab-work-item-comments
Sep 4, 2026
Merged

feat: return GitLab work item comments from issue:show --with-comments#376
mglaman merged 3 commits into
mainfrom
feat/gitlab-work-item-comments

Conversation

@mglaman

@mglaman mglaman commented Sep 4, 2026

Copy link
Copy Markdown
Owner

What changed

drupalorg issue:show <ref> --with-comments now returns the discussion for GitLab work items, not only classic Drupal.org issues. Comments render in text, json, md, and llm output using the same number/author/created/body shape as Drupal.org comments, so agents parse both the same way.

A second, separate commit fixes a pre-existing output bug found while testing: Symfony Console treats <comment> as a built-in style and stripped those tags from every --format=llm response, including the existing Drupal.org comment thread. Formatted output is now written with OUTPUT_RAW.

Why

Closes #374. The AI contribution policy checkpoints merged in #375 tell agents to read the whole thread before writing code. For work item projects the flag was silently ignored, so the skills had to fall back to glab issue view --comments. That fallback is removed here.

How

  • GitLab\Client::getIssueNotes() reads the notes endpoint the client already posted slash commands to, following pagination at 100 per page in chronological order.
  • New GitLabNote entity. GetGitLabIssueAction takes a $withComments flag and drops system: true notes, matching the Drupal.org path that drops "System Message" comments. Replies from drupalbot are dropped too by default, because the work item's labels and assignees already reflect what the bot confirms. --include-bot-comments brings them back.
  • GitLabIssueResult carries comments, serialized under a comments key in JSON.
  • issue:show reads the flag before branching on ref type and renders comments in text mode for work items.
  • Skill text: the glab fallback is gone from the policy reference and the work-on-issue skill, and the main skill no longer says the flag is Drupal.org-only.

Testing notes

  • vendor/bin/phpunit: 219 tests pass. New GetGitLabIssueActionTest covers no notes request without the flag, system and bot note filtering, the --include-bot-comments opt-in, and JSON shape. Formatter tests cover the <comments> element and ## Comments heading, present and absent.
  • vendor/bin/phpcs src and vendor/bin/phpstan analyse src clean.
  • Live: php drupalorg issue:show ai_context#3586157 --with-comments --format=llm returns 14 comments, or 17 with --include-bot-comments; without --with-comments, none. php drupalorg issue:show 3383637 --with-comments --format=llm now shows the <comment> wrapper on all 16 Drupal.org comments, which it did not before the raw-output fix.

🤖 Generated with Claude Code

mglaman and others added 3 commits September 4, 2026 09:26
The llm formatter wraps each comment in <comment> elements, and JSON
output can carry the same text. Symfony Console treats <comment> as a
built-in style and strips the tags, so agents received comment bodies
with no enclosing element. Writing with OUTPUT_RAW preserves the
formatter output byte for byte.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The policy checkpoints in the bundled skills tell agents to read the
whole thread before writing code. For projects on GitLab work items the
flag was accepted and ignored, so agents fell back to glab or the user.

The GitLab client now reads the notes endpoint it already posted to,
following pagination. The action skips system notes to match the
Drupal.org path dropping "System Message" comments, and the result
carries the remaining notes in the same number/author/created/body
shape across text, json, md, and llm output. The skills drop the glab
fallback.

Closes #374

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ot-comments is passed

The work item's labels and assignees already reflect what the bot
confirms, so its replies are noise for an agent reading the thread.
The flag brings them back when a slash command result needs checking.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mglaman
mglaman merged commit c5c8e39 into main Sep 4, 2026
9 checks passed
@mglaman
mglaman deleted the feat/gitlab-work-item-comments branch September 4, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

issue:show --with-comments is silently ignored for GitLab work items

1 participant