Skip to content

Commit 1060c44

Browse files
joshspicerCopilot
andcommitted
Skip host customization apply when unchanged
Add equality check in _applyHostCustomizationsToAgents to avoid firing setHostCustomizations and downstream publishes when root config changes for non-customization keys (e.g. permissions). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent cd30712 commit 1060c44

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/vs/platform/agentHost/node/agentSideEffects.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
ToolResultContentType,
2727
buildSubagentSessionUri,
2828
getToolFileEdits,
29+
type CustomizationRef,
2930
type SessionState,
3031
type ToolResultContent,
3132
type URI as ProtocolURI,
@@ -77,6 +78,8 @@ export class AgentSideEffects extends Disposable {
7778
/** Serializes per-session diff computations to avoid races with stale previousDiffs. */
7879
private readonly _diffComputationSequencer = new SequencerByKey<string>();
7980
private _lastAgentInfos: readonly AgentInfo[] = [];
81+
/** Last customizations list passed to agents; compared before each {@link _applyHostCustomizationsToAgents} call to skip no-op updates. */
82+
private _lastAppliedCustomizations: readonly CustomizationRef[] = [];
8083
/** Per-session debounce timers for mid-turn diff computation. */
8184
private readonly _debouncedDiffTimers = this._register(new DisposableMap<string>());
8285
private static readonly _DIFF_DEBOUNCE_MS = 5000;
@@ -152,6 +155,10 @@ export class AgentSideEffects extends Disposable {
152155

153156
private _applyHostCustomizationsToAgents(): void {
154157
const customizations = this._configurationService.getRootValue(agentHostCustomizationConfigSchema, AgentHostConfigKey.Customizations) ?? [];
158+
if (equals(customizations, this._lastAppliedCustomizations)) {
159+
return;
160+
}
161+
this._lastAppliedCustomizations = customizations;
155162
for (const agent of this._options.agents.get()) {
156163
agent.setHostCustomizations?.([...customizations], () => {
157164
this._publishAgentInfos(this._options.agents.get());

0 commit comments

Comments
 (0)