Report truncated Duo Workflow checkpoint ancestry

Problem

Workflow#walk_ancestry in ee/app/models/ai/duo_workflows/workflow.rb reconstructs channel values and message history from incremental blobs by walking the checkpoint header parent_ts chain. When an intermediate ancestor header is missing (a hole left by a checkpoint POST that never landed), the walk stopped silently. Only cycles raised an error. Reconstructed state and message history collapsed to the deltas after the hole with no signal anything was missing.

Solution

When the walk ends at a non-nil thread_ts that has no header, and at least one ancestor was already collected, report a new MissingAncestryError via Gitlab::ErrorTracking.track_exception, including the workflow_id and the missing thread_ts. Return the reachable suffix as before. Behavior is unchanged; only the reporting is new.

The fix doesn't raise. Existing holes in production data are permanent, and raising would make those workflows permanently unreadable. A chain that ends at a root checkpoint (parent_ts nil) reports nothing.

Reporting is deduplicated per missing thread_ts per model instance, because batch reads walk the chain once per checkpoint on a page. The companion gateway MR (gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!6747 (merged)) stops new holes from being created going forward.

Testing

New specs in ee/spec/models/ai/duo_workflows/workflow_spec.rb confirm the error reports once per missing ancestor across repeated walks, and that no report occurs for a chain ending at a root. The full workflow model spec passes (516 examples).

Issue

#627533 (closed)

Merge request reports

Loading
Loading