Skip to content

Link Hackbot's Bugzilla comments to their run with front matter - #7433

Open
kyoshino wants to merge 3 commits into
mozilla:masterfrom
kyoshino:claude/hackbot-feedback-system-66a0ee
Open

kyoshino wants to merge 3 commits into
mozilla:masterfrom
kyoshino:claude/hackbot-feedback-system-66a0ee

Conversation

@kyoshino

@kyoshino kyoshino commented Nov 9, 2026

Copy link
Copy Markdown

For Bug 2086124.

Important

Deploy this only once mozilla/bmo#2819 is in production and BMO's hackbot_user param names the account hackbot-api posts as. Until then, Bugzilla shows the block as plain text at the top of every Hackbot comment.

hackbot-api now puts a front matter block at the top of every Bugzilla comment it posts:

---
hackbot:
  run: <run ID>
  action: <action ID>
  agent: <agent name>
  url: https://hackbot.moz.tools/runs/<run ID>
---

BMO's Hackbot extension hides the block from readers, bugmail, webhooks and Pulse, and shows the agent and a link to the run in the comment header instead. REST raw_text keeps it. This is what native feedback (bug 2086122) will attach to.

  • The block is added at apply time in bugzilla_handler.py, so a model can't write or change it, and the Hackbot UI and Slack never show it.
  • ApplyContext carries the action ID (RunAction.ref). When a field update and a comment are merged into one PUT, it carries the comment's ID.
  • The block is left out when the action has no ID (summaries recorded before action IDs) or a value isn't an identifier, because BMO would show it as text.
  • Agent text posted without our block starts on a new line when it begins with ---, so BMO can't read a block the model wrote as metadata. That covers the case above, a comment inside update_bug's changes, attachment comments and new-bug descriptions.
  • The feedback footer is unchanged; that change belongs to bug 2086122.

Testing

  • hackbot-api tests pass (424), including new ones for the block, the merged-comment ID, and agent-written blocks.
  • Pre-commit hooks pass on the changed files.
  • On a local BMO with the extension, a comment that starts with a newline keeps it, and the block below it isn't read as metadata.

🤖 Generated with Claude Code

hackbot-api now puts a front matter block at the top of every Bugzilla
comment it posts: the run, the action, the agent and a link to the run in
the Hackbot UI. BMO's Hackbot extension hides the block and shows the agent
and the link in the comment header instead (bug 2086124).

The block is added at apply time, so a model can't write or change it, and
the Hackbot UI and Slack never show it. ApplyContext carries the action ID;
a field update merged with a comment carries the comment's ID. The block is
left out when the action has no ID (older summaries) or a value isn't an
identifier, since BMO would show it as text.

Agent text posted without our block (those comments, a comment inside
update_bug's changes, attachment comments and new-bug descriptions) starts
on a new line when it begins with a rule, so BMO can't read a block the
model wrote as metadata.
@kyoshino
kyoshino requested a review from a team as a code owner November 9, 2026 06:01
@kyoshino

kyoshino commented Nov 9, 2026

Copy link
Copy Markdown
Author

It seems that the test failure is related to GitHub’s downtime, in the same way as the pull request to BMO. Please rerun the test once the issue has been resolved.

@suhaibmujahid suhaibmujahid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! It looks great. I left some simple comments.

- The front matter's `action` is now the RunAction row ID, which every
  action has, instead of the recorder's ref.
- Drop the runtime identifier check: run IDs, row IDs and registered agent
  names always satisfy BMO's parser, and a new test keeps agent names that
  way.
- Simplify UpdateBugHandler's comment handling, and rename comment_id to
  comment_action_id and _unparsed to _escape_front_matter.

This branch has not been deployed

No deployments
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.

3 participants