fix(coding-agent): guarded fork during streaming
- Blocked /fork while streaming to avoid split session logs. - Preserved queued and next-turn messages when forking.
This commit is contained in:
@@ -419,6 +419,10 @@ export class CommandController {
|
||||
}
|
||||
|
||||
async handleForkCommand(): Promise<void> {
|
||||
if (this.ctx.session.isStreaming) {
|
||||
this.ctx.showWarning("Wait for the current response to finish or abort it before forking.");
|
||||
return;
|
||||
}
|
||||
if (this.ctx.loadingAnimation) {
|
||||
this.ctx.loadingAnimation.stop();
|
||||
this.ctx.loadingAnimation = undefined;
|
||||
|
||||
@@ -212,11 +212,13 @@ export class InteractiveMode implements InteractiveModeContext {
|
||||
{ name: "login", description: "Login with OAuth provider" },
|
||||
{ name: "logout", description: "Logout from OAuth provider" },
|
||||
{ name: "new", description: "Start a new session" },
|
||||
{ name: "fork", description: "Duplicate current session into a new session" },
|
||||
{ name: "compact", description: "Manually compact the session context" },
|
||||
{ name: "handoff", description: "Hand off the session context to a new session" },
|
||||
{ name: "background", description: "Detach UI and continue running in background" },
|
||||
{ name: "bg", description: "Alias for /background" },
|
||||
{ name: "resume", description: "Resume a different session" },
|
||||
{ name: "debug", description: "Write debug log (TUI state and messages)" },
|
||||
{ name: "exit", description: "Exit the application" },
|
||||
];
|
||||
|
||||
|
||||
@@ -1710,11 +1710,6 @@ export class AgentSession {
|
||||
// Update agent session ID
|
||||
this.agent.sessionId = this.sessionManager.getSessionId();
|
||||
|
||||
// Clear queued messages (they would be duplicated otherwise)
|
||||
this._steeringMessages = [];
|
||||
this._followUpMessages = [];
|
||||
this._pendingNextTurnMessages = [];
|
||||
|
||||
// Emit session_switch event with reason "fork" to hooks
|
||||
if (this._extensionRunner) {
|
||||
await this._extensionRunner.emit({
|
||||
|
||||
Reference in New Issue
Block a user