Commit 47475c9
committed
fix: tear down AG-UI subscription on RUN_FINISHED and RUN_ERROR
The bridge's next handler reacted to RUN_FINISHED / RUN_ERROR by
updating flowStore state but did not unsubscribe or resolve the
runFlowAGUI promise. Resolution relied on the AG-UI observable
completing after the terminal event, which holds only when the SSE
stream closes cleanly. A keepalive after RUN_FINISHED, a buffered chunk
the reader has not consumed, or a server that does not close eagerly
all leave the observable open. The canvas then stays on
isBuilding=true and running-status nodes never revert.
The fix mirrors the existing teardown in the error: and complete:
callbacks: call subscription.unsubscribe() + finish() on the terminal
event itself so resolution does not depend on the SSE stream closing.
Both branches updated symmetrically since RUN_FINISHED has the same
hang risk as RUN_ERROR.
No new test scaffold for this fix: reproducing the hang requires a
long-lived fake SSE response plus the real flowStore singleton (pulls
@xyflow/react and friends), and the fix surface is four lines mirroring
the documented complete: pattern. Evidence for the bug comes from the
PR #13307 code review and the step 6 code-review pass that re-surfaced
the same risk on the success branch. All 29 controllers/API/agui tests
still pass.1 parent aea39cd commit 47475c9
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
147 | 154 | | |
148 | 155 | | |
149 | 156 | | |
150 | 157 | | |
151 | 158 | | |
152 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
153 | 164 | | |
154 | 165 | | |
155 | 166 | | |
| |||
0 commit comments