fix(coding-agent): setWorkingMessage() now works in agent_start handlers

Extensions calling setWorkingMessage() in agent_start handlers previously
had no effect because the loading animation didn't exist yet. Now the
message is queued and applied once the loader is created.

Fixes #935
This commit is contained in:
Mario Zechner 2026-01-25 02:37:12 +01:00
parent 3e8eb956b3
commit 349c6420c7
2 changed files with 14 additions and 0 deletions

View file

@ -20,6 +20,7 @@
- Package filtering: selectively load resources from packages using object form in `packages` array ([#645](https://github.com/badlogic/pi-mono/issues/645))
- Glob pattern support with minimatch in package filters, top-level settings arrays, and pi manifest (e.g., `"!funky.json"`, `"*.ts"`) ([#645](https://github.com/badlogic/pi-mono/issues/645))
- `/reload` command to reload extensions, skills, prompts, and themes ([#645](https://github.com/badlogic/pi-mono/issues/645))
- `pi config` command with TUI to enable/disable package and top-level resources via patterns ([#938](https://github.com/badlogic/pi-mono/issues/938))
- CLI flags for `--skill`, `--prompt-template`, `--theme`, `--no-prompt-templates`, and `--no-themes` ([#645](https://github.com/badlogic/pi-mono/issues/645))
- Package deduplication: if same package appears in global and project settings, project wins ([#645](https://github.com/badlogic/pi-mono/issues/645))
- Unified collision reporting with `ResourceDiagnostic` type for all resource types ([#645](https://github.com/badlogic/pi-mono/issues/645))
@ -29,6 +30,7 @@
### Fixed
- Extension `setWorkingMessage()` calls in `agent_start` handlers now work correctly; previously the message was silently ignored because the loading animation didn't exist yet ([#935](https://github.com/badlogic/pi-mono/issues/935))
- Off-by-one error in bash output "earlier lines" count caused by counting spacing newline as hidden content ([#921](https://github.com/badlogic/pi-mono/issues/921))
### Changed
@ -42,6 +44,7 @@
- Auto-retry now handles "terminated" errors from Codex API mid-stream failures
- Follow-up queue (Alt+Enter) now sends full paste content instead of `[paste #N ...]` markers ([#912](https://github.com/badlogic/pi-mono/issues/912))
- Fixed Alt-Up not restoring messages queued during compaction ([#923](https://github.com/badlogic/pi-mono/pull/923) by [@aliou](https://github.com/aliou))
- Fixed session corruption when loading empty or invalid session files via `--session` flag ([#932](https://github.com/badlogic/pi-mono/issues/932) by [@armanddp](https://github.com/armanddp))
## [0.49.3] - 2026-01-22

View file

@ -163,6 +163,7 @@ export class InteractiveMode {
private isInitialized = false;
private onInputCallback?: (text: string) => void;
private loadingAnimation: Loader | undefined = undefined;
private pendingWorkingMessage: string | undefined = undefined;
private readonly defaultWorkingMessage = "Working...";
private lastSigintTime = 0;
@ -1337,6 +1338,9 @@ export class InteractiveMode {
`${this.defaultWorkingMessage} (${appKey(this.keybindings, "interrupt")} to interrupt)`,
);
}
} else {
// Queue message for when loadingAnimation is created (handles agent_start race)
this.pendingWorkingMessage = message;
}
},
setWidget: (key, content, options) => this.setExtensionWidget(key, content, options),
@ -1990,6 +1994,13 @@ export class InteractiveMode {
this.defaultWorkingMessage,
);
this.statusContainer.addChild(this.loadingAnimation);
// Apply any pending working message queued before loader existed
if (this.pendingWorkingMessage !== undefined) {
if (this.pendingWorkingMessage) {
this.loadingAnimation.setMessage(this.pendingWorkingMessage);
}
this.pendingWorkingMessage = undefined;
}
this.ui.requestRender();
break;