@@ -399,18 +399,25 @@ func (r *RootCmd) mcpServer() *serpent.Command {
399
399
// new user message, and the status is "working" and not self-reported
400
400
// (meaning it came from the screen watcher), then it means one of two
401
401
// things:
402
- // 1. The AI agent is still working, so there is nothing to update.
403
- // 2. The AI agent stopped working, then the user has interacted with
404
- // the terminal directly. For now, we are ignoring these updates.
405
- // This risks missing cases where the user manually submits a new
406
- // prompt and the AI agent becomes active and does not update itself,
407
- // but it avoids spamming useless status updates as the user is
408
- // typing, so the tradeoff is worth it. In the future, if we can
409
- // reliably distinguish between user and AI agent activity, we can
410
- // change this.
402
+ //
403
+ // 1. The AI agent is not working; the user is interacting with the
404
+ // terminal directly.
405
+ // 2. The AI agent is working.
406
+ //
407
+ // At the moment, we have no way to tell the difference between these
408
+ // two states. In the future, if we can reliably distinguish between
409
+ // user and AI agent activity, we can change this.
410
+ //
411
+ // If this is our first update, we assume it is the AI agent working and
412
+ // accept the update.
413
+ //
414
+ // Otherwise we discard the update. This risks missing cases where the
415
+ // user manually submits a new prompt and the AI agent becomes active
416
+ // (and does not update itself), but it avoids spamming useless status
417
+ // updates as the user is typing, so the tradeoff is worth it.
411
418
if report .messageID > lastUserMessageID {
412
419
report .state = codersdk .WorkspaceAppStatusStateWorking
413
- } else if report .state == codersdk .WorkspaceAppStatusStateWorking && ! report .selfReported {
420
+ } else if report .state == codersdk .WorkspaceAppStatusStateWorking && ! report .selfReported && lastReport . state != "" {
414
421
return report , false
415
422
}
416
423
// Preserve previous message and URI if there was no message.
0 commit comments