Draft: [Stack 2/3] Refactor mention template, CreateNoteService, and FlowTrigger
What does this MR do and why?
Preparatory refactors for the GitlabNote messaging adapter (!235039 (closed)). These changes are independently useful improvements that make no behavior changes visible to users.
Changes
Mention goal template (developer/mention.rb):
- Adds
%{note_url}variable — direct link to the specific note where the agent was mentioned - Adds
%{source_context}variable with<gitlab_context>tags for richer context - Wraps user input in
<conversation>tags for structured parsing - Path-neutral wording that works for both current RunService and future adapter paths
CreateNoteService (create_note_service.rb):
- Extracts
create_note,mark_started,mark_failedas public methods (previously only accessible through the#executeblock orchestration) mark_failednow sanitizes error messages withhtml_escape+truncate(200)to prevent Markdown injection and info leakage
FlowTrigger model (flow_trigger.rb):
- Adds
foundational_flow?predicate to encapsulate theai_catalog_item_consumer&.item&.foundational_flow_reference.present?chain
PostProcessService (post_process_service.rb):
- Passes
source_contextwith reply-in-thread guidance to all RunService mention callers
Related issues and MRs
- Issue: #599691 (closed)
- Stacked on: !235308 (closed) (redesigned
Adapters::Base) - Next in stack: !235039 (closed) (GitlabNote adapter)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
- I have evaluated the MR acceptance checklist for this MR.
Edited by Thomas Schmidt