fix(coding-agent): keep scoped-model reorder inert in implicit all-enabled state closes #3331

This commit is contained in:
Mario Zechner
2026-04-17 16:58:49 +02:00
parent 3cea63cf29
commit 0bb4ccf11f
2 changed files with 8 additions and 6 deletions

View File

@@ -4,6 +4,7 @@
### Fixed
- Fixed `/scoped-models` Alt+Up/Down to stay a no-op in the implicit `all enabled` state instead of materializing a full explicit enabled-model list and marking the selector dirty ([#3331](https://github.com/badlogic/pi-mono/issues/3331))
- Fixed flaky git package update notifications by waiting for captured git command stdio to fully drain before comparing local and remote commit SHAs ([#3027](https://github.com/badlogic/pi-mono/issues/3027))
- Fixed auto-retry transient error detection to treat `Network connection lost.` as retryable, so dropped provider connections retry instead of terminating the agent ([#3317](https://github.com/badlogic/pi-mono/issues/3317))
- Fixed compact interactive extension startup summaries to disambiguate package extensions and repeated local `index.ts` entries by using package-aware labels and the minimal parent path needed to make local entries unique ([#3308](https://github.com/badlogic/pi-mono/issues/3308))

View File

@@ -45,8 +45,9 @@ function clearAll(enabledIds: EnabledIds, allIds: string[], targetIds?: string[]
return enabledIds.filter((id) => !targets.has(id));
}
function move(enabledIds: EnabledIds, allIds: string[], id: string, delta: number): EnabledIds {
const list = enabledIds ?? [...allIds];
function move(enabledIds: EnabledIds, id: string, delta: number): EnabledIds {
if (enabledIds === null) return null;
const list = [...enabledIds];
const index = list.indexOf(id);
if (index < 0) return list;
const newIndex = index + delta;
@@ -238,15 +239,15 @@ export class ScopedModelsSelectorComponent extends Container implements Focusabl
// Alt+Up/Down - Reorder enabled models
if (matchesKey(data, Key.alt("up")) || matchesKey(data, Key.alt("down"))) {
if (this.enabledIds === null) return;
const item = this.filteredItems[this.selectedIndex];
if (item && isEnabled(this.enabledIds, item.fullId)) {
const delta = matchesKey(data, Key.alt("up")) ? -1 : 1;
const enabledList = this.enabledIds ?? this.allIds;
const currentIndex = enabledList.indexOf(item.fullId);
const currentIndex = this.enabledIds.indexOf(item.fullId);
const newIndex = currentIndex + delta;
// Only move if within bounds
if (newIndex >= 0 && newIndex < enabledList.length) {
this.enabledIds = move(this.enabledIds, this.allIds, item.fullId, delta);
if (newIndex >= 0 && newIndex < this.enabledIds.length) {
this.enabledIds = move(this.enabledIds, item.fullId, delta);
this.isDirty = true;
this.selectedIndex += delta;
this.refresh();