fix(sessions): Stop cloud task watcher restart loop#2661
Conversation
|
React Doctor could not complete this scan.
Reviewed by React Doctor for commit |
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
packages/ui/src/features/sessions/sessionServiceHost.test.ts:946-1015
**Prefer parameterised tests for the three new cases**
The three new `it` blocks test the same function with only the session fields and expected call assertions varying. Per the team's style preference, these should be written as `it.each`. Additionally, the `events` array on the first mock (`[{ type: "acp_message", ... }]`) is absent from the other two mocks and isn't checked by the guard — it's a superfluous part that makes the cases look non-parallel.
Reviews (1): Last reviewed commit: "stop cloud task watcher restart loop" | Re-trigger Greptile |
be60e34 to
019e28f
Compare
New commits pushed (delta classified non_linear_history) — stamphog approval dismissed; re-review running automatically.
There was a problem hiding this comment.
Targeted bug fix with clear intent and good test coverage. The guard is correctly scoped to the no-existing-watcher path, all three guard conditions are necessary and correct, and the tests cover the full boundary space including the "not yet hydrated" and "different run" cases that must continue to watch.

Problem
Sitting on a finished (terminal) cloud task spins the cloud-task watcher in a tight start/stop loop (~2x/sec): the terminal snapshot tears the watcher down and rewrites
session.configOptions, which re-fires theuseSessionConnectionreconcile effect, which re-subscribes and re-bootstraps. The result is console spam and a full log-history refetch every cycle.Changes
watchCloudTaskto skip re-watching a terminal run already hydrated in the storeHow did you test this?
Manually
Automatic notifications