Skip to content

Commit 68d5e58

Browse files
committed
perf(doctor): parallel I/O for repair sequence and plugin dep cleanup
Phase 1A optimizations for #85333: repair-sequencing.ts: - Run cleanupLegacyPluginDependencyState, maybeRepairLegacyOAuthSidecarProfiles, and repairStaleOAuthProfileShadows in parallel via Promise.all - These are filesystem-only operations with no config dependencies, so concurrent execution is safe - openAIAuthProviderRepair kept sequential (depends on sidecar results) All existing tests pass (repair-sequencing)
1 parent 19c7731 commit 68d5e58

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

‎src/commands/doctor/repair-sequencing.ts‎

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,30 @@ export async function runDoctorRepairSequence(params: {
153153

154154
applyMutation(maybeRepairLegacyToolsBySenderKeys(state.candidate));
155155
applyMutation(maybeRepairExecSafeBinProfiles(state.candidate));
156-
const pluginDependencyCleanup = await cleanupLegacyPluginDependencyState({ env });
156+
157+
// Parallel I/O: dep cleanup and OAuth repairs are filesystem-only
158+
// operations independent of config state. Running them concurrently
159+
// reduces total wall-clock time from sum to max.
160+
const [pluginDependencyCleanup, legacyOAuthSidecarRepair, staleOAuthShadowRepair] =
161+
await Promise.all([
162+
cleanupLegacyPluginDependencyState({ env }),
163+
maybeRepairLegacyOAuthSidecarProfiles({
164+
cfg: state.candidate,
165+
prompter: { confirmAutoFix: async () => true },
166+
emitNotes: false,
167+
env,
168+
}),
169+
repairStaleOAuthProfileShadows({
170+
cfg: state.candidate,
171+
env,
172+
}),
173+
]);
157174
if (pluginDependencyCleanup.changes.length > 0) {
158175
changeNotes.push(sanitizeLines(pluginDependencyCleanup.changes));
159176
}
160177
if (pluginDependencyCleanup.warnings.length > 0) {
161178
warningNotes.push(sanitizeLines(pluginDependencyCleanup.warnings));
162179
}
163-
const legacyOAuthSidecarRepair = await maybeRepairLegacyOAuthSidecarProfiles({
164-
cfg: state.candidate,
165-
prompter: { confirmAutoFix: async () => true },
166-
emitNotes: false,
167-
env,
168-
});
169180
if (legacyOAuthSidecarRepair.changes.length > 0) {
170181
changeNotes.push(sanitizeLines(legacyOAuthSidecarRepair.changes));
171182
}
@@ -182,10 +193,6 @@ export async function runDoctorRepairSequence(params: {
182193
if (openAIAuthProviderRepair.warnings.length > 0) {
183194
warningNotes.push(sanitizeLines(openAIAuthProviderRepair.warnings));
184195
}
185-
const staleOAuthShadowRepair = await repairStaleOAuthProfileShadows({
186-
cfg: state.candidate,
187-
env,
188-
});
189196
if (staleOAuthShadowRepair.changes.length > 0) {
190197
changeNotes.push(sanitizeLines(staleOAuthShadowRepair.changes));
191198
}

0 commit comments

Comments
 (0)