Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/fix-web-yolo-auto-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---

Fix yolo mode in the web app auto-approving plan reviews and sensitive file access.
18 changes: 3 additions & 15 deletions apps/kimi-web/src/composables/client/useWorkspaceState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1229,25 +1229,13 @@ export function useWorkspaceState(rawState: ExtendedState, deps: UseWorkspaceSta
});
}

/** Persist and apply a new permission mode; auto-approve pending approvals if switching to auto/yolo */
/** Persist and apply a new permission mode. Approval decisions are owned by
* the daemon (auto/yolo are resolved server-side), so any pending approvals
* are left for the user to answer explicitly. */
function setPermission(mode: PermissionMode): void {
rawState.permission = mode;
savePermissionToStorage(mode);
persistSessionProfile({ permissionMode: mode });

// If switching to auto/yolo, auto-approve any currently-pending approvals for the active session
if (mode === 'auto' || mode === 'yolo') {
const sid = rawState.activeSessionId;
if (sid) {
const approvals = [...(rawState.approvalsBySession[sid] ?? [])];
for (const a of approvals) {
void respondApproval(a.approvalId, {
decision: 'approved',
scope: mode === 'yolo' ? 'session' : undefined,
});
}
}
}
}

/** Dismiss a warning by index */
Expand Down
13 changes: 0 additions & 13 deletions apps/kimi-web/src/composables/useKimiWebClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,19 +730,6 @@ function connectEventsIfNeeded(): void {
) {
onSessionIdle(appEvent.sessionId, appEvent.status);
}

// Permission auto-approve: CLIENT-SIDE POLICY until the daemon exposes a
// permission endpoint. When permission is 'auto' or 'yolo' and an approval
// request arrives, immediately respond with 'approved'.
if (appEvent.type === 'approvalRequested') {
const perm = rawState.permission;
if (perm === 'auto' || perm === 'yolo') {
void workspaceState.respondApproval(appEvent.approval.approvalId, {
decision: 'approved',
scope: perm === 'yolo' ? 'session' : undefined,
});
}
}
},

onResync(sessionId: string, currentSeq: number, epoch?: string) {
Expand Down
Loading