fix(coding-agent): defer catalog refresh until after TUI startup

This commit is contained in:
Armin Ronacher
2026-07-21 18:25:38 +02:00
parent a82289637b
commit b142504125
3 changed files with 20 additions and 5 deletions
@@ -826,6 +826,13 @@ export class InteractiveMode {
async run(): Promise<void> {
await this.init();
if (!process.env.PI_OFFLINE) {
void this.session.modelRuntime
.refresh()
.then(() => this.updateAvailableProviderCount())
.catch(() => {});
}
// Start version check asynchronously
checkForNewPiVersion(this.version).then((newRelease) => {
if (newRelease) {
@@ -4352,10 +4359,13 @@ export class InteractiveMode {
}
}
/** Update the footer's available provider count from current model candidates */
private async updateAvailableProviderCount(): Promise<void> {
const models = await this.getModelCandidates();
const uniqueProviders = new Set(models.map((m) => m.provider));
/** Update the footer's available provider count from the current snapshot without refreshing catalogs. */
private updateAvailableProviderCount(): void {
const models =
this.session.scopedModels.length > 0
? this.session.scopedModels.map((scoped) => scoped.model)
: this.session.modelRuntime.getAvailableSnapshot();
const uniqueProviders = new Set(models.map((model) => model.provider));
this.footerDataProvider.setAvailableProviderCount(uniqueProviders.size);
}