Reapply route-driven agentic chat init

Summary

This reapplies the change reverted in !253931 (merged). The revert has no remaining justification, so this restores the original commit as it was.

Background

The original change, "Spike: make agentic chat init unconditional, stream adoption additive", updated connectToStream() in ee/app/assets/javascripts/ai/duo_agentic_chat/components/duo_agentic_chat_state_manager.vue. It initializes the chat view from the route unconditionally, then adopts an already-running websocket stream as a separate, additive step through a new adoptRunningStream() method.

It was reverted during incident 13926, on the hypothesis that it caused an elevated rate of gRPC results logged as workflow execution stopped for chat workflows by closing live chat websockets.

Why the revert is being undone

The revert was deployed to production on 2026-09-08 at 05:57 UTC. The stop rate did not move: it was 68.9% over the preceding 24 hours before the revert, and 62.8% over the three hours after it. Investigation has since pointed at a different cause unrelated to this code, so there is no evidence linking this change to the incident.

Behaviour notes for reviewers

When a user starts a blank chat, the chat still closes the websocket to avoid adopting a stale in-flight reply, and Workhorse translates that close into a server-side stop of the workflow. This is pre-existing behaviour and is not changed by this MR.

A follow-up is planned to scope stream adoption to a specific workflow id, so an abandoned in-flight turn can keep running instead of being stopped. That is out of scope here.

Changelog

No changelog entry. This restores prior behaviour with no user-facing change.

How to verify

Run the two affected Jest spec files:

yarn jest ee/spec/frontend/ai/duo_agentic_chat/components/duo_agentic_chat_state_manager_spec.js ee/spec/frontend/ai/duo_agentic_chat/components/duo_agentic_chat_history_view_spec.js

Both suites pass in full: 410 tests, no failures.

Merge request reports

Loading
Loading