Workplan: saving a plan fires the work_item_agent_plan_read internal event

Summary

The updateWorkItemAgentPlan mutation (and previously workItemEnableAiPlanning) selects content and contentHtml in its response via WorkItemAgentPlanFragment. Both field resolvers in ee/app/graphql/types/work_items/widgets/agent_plan_type.rb call track_agent_plan_read, so every save of a workplan is also counted as a read in the work_item_agent_plan_read internal event.

The per-request SafeRequestStore guard deduplicates within a request, but a mutation request is still counted as a read.

Proposal

Decide whether saves should count as reads. If not, suppress the tracking when the fields are resolved as part of a mutation response (for example, by checking the query context), or track reads only on query operations.

Context

Raised as an optional follow-up during review of !253657 (merged) (see !253657 (comment 3799953133)).

Feature is behind the default-off workplan feature flag.

Edited by 🤖 GitLab Bot 🤖