Summary
Loading and reopening a large Agent Host session can generate thousands of duplicate child-chat subscriptions, causing a sharp renderer/transport memory spike and hundreds of MB of AHP traffic.
Reproduction
Using the session Agent Host session migration (39 subagent chats):
- Open the session and wait for history/Changes to settle.
- Open another session.
- Reopen the original session.
Controlled runs with isolated copies of the same profile:
| Build |
AHP bytes |
Child-chat snapshots |
43c9cf468f20 (good Insiders) |
42.3 MB |
78 |
fc62850c022b (bad Insiders) |
343.2+ MB |
1,005 retained after rotation |
Bisect and root cause
A source-level bisect identified commit 38220eab177286ceaf47098a843396d351464247 (#331079):
| Source revision |
AHP bytes |
Child-chat snapshots |
Parent 30ad9a507bd |
42.9 MB |
85 |
38220eab177 |
367.7 MB |
864 |
The triggering change is the new synchronous external-changes scope check in AgentFeedbackService._isFileInSessionScope:
if (session.externalChanges?.get().some(file => isEqual(file.uri, resourceUri))) {
return true;
}
externalChanges is subscription-backed. Calling .get() while it is unobserved recomputes its dependencies for each visible changed-file editor, transiently acquiring and releasing all child-chat subscriptions. The target session has 39 child chats, so repeated file scope checks create a large overlapping subscribe/unsubscribe storm.
Line-level verification on 38220eab177:
- Removing only the new
externalChanges.get() check: 43.0 MB / 87 child snapshots (baseline restored).
- Removing the separate new subagent annotation-restore await instead: 375.1 MB / 866 child snapshots (still reproduces).
Confidence in this causal attribution is very high; the immediate-parent, child, and single-expression A/B tests were all run against the same profile and automated scenario.
Summary
Loading and reopening a large Agent Host session can generate thousands of duplicate child-chat subscriptions, causing a sharp renderer/transport memory spike and hundreds of MB of AHP traffic.
Reproduction
Using the session Agent Host session migration (39 subagent chats):
Controlled runs with isolated copies of the same profile:
43c9cf468f20(good Insiders)fc62850c022b(bad Insiders)Bisect and root cause
A source-level bisect identified commit
38220eab177286ceaf47098a843396d351464247(#331079):30ad9a507bd38220eab177The triggering change is the new synchronous external-changes scope check in
AgentFeedbackService._isFileInSessionScope:externalChangesis subscription-backed. Calling.get()while it is unobserved recomputes its dependencies for each visible changed-file editor, transiently acquiring and releasing all child-chat subscriptions. The target session has 39 child chats, so repeated file scope checks create a large overlapping subscribe/unsubscribe storm.Line-level verification on
38220eab177:externalChanges.get()check: 43.0 MB / 87 child snapshots (baseline restored).Confidence in this causal attribution is very high; the immediate-parent, child, and single-expression A/B tests were all run against the same profile and automated scenario.