Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion apps/kimi-code/src/tui/controllers/session-event-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
TurnStartedEvent,
TurnStepCompletedEvent,
TurnStepInterruptedEvent,
TurnStepRetryingEvent,
TurnStepStartedEvent,
WarningEvent,
} from '@moonshot-ai/kimi-code-sdk';
Expand Down Expand Up @@ -245,7 +246,7 @@
case 'turn.step.started': this.handleStepBegin(event); break;
case 'turn.step.interrupted': this.handleStepInterrupted(event); break;
case 'turn.step.completed': this.handleStepCompleted(event); break;
case 'turn.step.retrying': break;
case 'turn.step.retrying': this.handleStepRetrying(event); break;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Surface retry notices for subagent retries

In subagent/AgentSwarm flows, handleEvent returns from routeChildAgentEvent(event) before this switch, and that route has no handling for turn.step.retrying, so a child agent that hits a 429 or other retryable provider error is still swallowed silently while the Agent card waits. Please either let retry events fall through or render the same retry status from the subagent route so the new user-facing feedback also covers delegated tasks.

Useful? React with 👍 / 👎.

case 'tool.progress': this.handleToolProgress(event); break;
case 'shell.output': this.host.handleShellOutput(event); break;
case 'shell.started': this.host.handleShellStarted(event); break;
Expand Down Expand Up @@ -367,6 +368,23 @@
});
}

private handleStepRetrying(event: TurnStepRetryingEvent): void {
const { failedAttempt, nextAttempt, maxAttempts, delayMs, statusCode } = event;

Check failure on line 372 in apps/kimi-code/src/tui/controllers/session-event-handler.ts

View workflow job for this annotation

GitHub Actions / lint

eslint(no-unused-vars)

Variable 'failedAttempt' is declared but never used. Unused variables should start with a '_'.
const delaySec = Math.round(delayMs / 1000);
const attemptLabel = `(${nextAttempt}/${maxAttempts})`;
if (statusCode === 429) {
this.host.showStatus(
`Rate limited (429), retrying in ${delaySec}s… ${attemptLabel}`,
'warning',
);
} else {
this.host.showStatus(
`Request failed, retrying in ${delaySec}s… ${attemptLabel}`,
'warning',
);
}
}

private handleStepCompleted(event: TurnStepCompletedEvent): void {
this.host.streamingUI.flushNow();
this.maybeShowDebugTiming(event);
Expand Down
Loading