Skip to content

bug(frontend): duplicate auto-save on mount — controller and ChatInterface both register independent save intervals #3750

@mrveiss

Description

@mrveiss

Summary

`ChatInterface.vue` registers two independent auto-save intervals on every mount, causing every session to be saved twice per cycle.

Root Cause

`onMounted` in `ChatInterface.vue:822-829` calls both:

```ts
// Call 1 — ChatController interval (30s default, leaked — see related issue)
if (store.settings.autoSave) {
controller.enableAutoSave()
}

// Call 2 — local Vue interval (120s, properly managed)
enableAutoSave()
```

Both check `store.settings.autoSave && store.currentSessionId` and both call `controller.saveChatSession()`. When they fire at the same time, two identical `POST /api/chats/{id}/save` requests hit the backend simultaneously.

Evidence

Backend log for session `82feb428-c4fa-4e4d-ab89-f94c7ca056b2` shows two simultaneous saves at every interval tick:

```
2026-04-07 13:24:59 POST /api/chats/.../save 200 OK
2026-04-07 13:24:59 POST /api/chats/.../save 200 OK ← duplicate same second
2026-04-07 13:25:59 POST /api/chats/.../save 200 OK
2026-04-07 13:25:59 POST /api/chats/.../save 200 OK ← duplicate same second
```

Fix

Remove the `controller.enableAutoSave()` call from `onMounted`. The local `enableAutoSave()` (120s, properly managed with `clearInterval` guard) is sufficient. The controller method is redundant and also leaks its interval (see related issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions