Resume workplan with original goal on context request

What does this MR do and why?

On resume, if the workplan flow is paused at its context_gate, the resume goal becomes the workflow's original goal instead of the "no answers, use your best assumptions" fallback. This lets research read the updated work item description again.

The gate is read from the latest request entry in the checkpoint's ui_chat_log, so an earlier context request that was already acted on does not keep forcing the original goal.

Changes:

  • ee/app/services/ai/duo_workflows/resume_workplan_service.rb: new CONTEXT_GATE constant and paused_gate. goal_message returns workflow.goal when paused_gate == CONTEXT_GATE, otherwise the existing reply_message, which is unchanged.
  • ee/spec/services/ai/duo_workflows/resume_workplan_service_spec.rb: new context "when the flow paused to request more context" (resumes with the original goal), and a nested context where the flow later paused on a question (resumes with the Q/A replies).

Companion MR (merged): gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!7084 (merged)

Why

The companion MR added a context_gate human input component to the workplan/v1 flow. Research and planner stop with a needs_context decision that routes to it. When it pauses, it writes a request entry with component_name: context_gate to the checkpoint's ui_chat_log.

An earlier version of this MR checked the latest flow note for a missing json:duo-question block. That cannot tell a context request from a progress comment, and the flow can stop with needs_context without posting a note at all (it is told not to repost if the description is unchanged). The gate name comes from the flow graph, not from the LLM.

Trade-off: context_gate is now a contract between the two repos, and renaming it in ai-gateway breaks this check. Each resume does one checkpoint read (latest_ui_chat_log, already memoized on the workflow).

This is behind the default-off duo_workplan_async_flow feature flag, so no changelog.

References

gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!7084 (merged)

Screenshots or screen recordings

Not applicable, no UI change.

How to set up and validate locally

  1. bin/rspec ee/spec/services/ai/duo_workflows/resume_workplan_service_spec.rb
  2. Use an ai-gateway main that includes the companion MR (gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!7084 (merged))
  3. Enable the duo_workplan_async_flow feature flag for the root group
  4. Generate a workplan on a work item with a one-line description
  5. Expect a plain comment asking to expand the description
  6. Update the description, then click Resume
  7. Expect research to run again (check Automate > Agent sessions)

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

🤖 Generated with Claude Code

Edited by Stefanos Xanthopoulos

Merge request reports

Loading
Loading