Repository navigation
feat(studio): keep the Studio history server-side per user - #12991
Open
coffeerunhobby wants to merge 10 commits into
Open
coffeerunhobby wants to merge 10 commits into
coffeerunhobby wants to merge 10 commits into
Conversation
added 3 commits
October 31, 2026 09:46
The Studio keeps the record of every generation (prompt, model, params, result URLs, lineage) in localStorage only. The files are on the server, but the history is lost with a cleared browser, does not follow the user to another device, and never shows results made through the API. Persist it the way chat history is persisted (mudler#12663): - core/services/studiohistory: a GORM table studio_history_entries in the shared auth database, keyed by (user_id, entry_id), with the Studio's record stored opaquely, a server-assigned version, tombstones so a deletion reaches every browser, a cap of 1000 entries per type (the oldest become tombstones) and an import that never deletes. - /api/studio/history: list (with tombstones and an opaque per-account cacheKey), get, upsert, delete, clear per type, and import. Registered only when auth is on and the WebUI enabled; gated by a new studio_history feature, on by default like chat_history. - Studio add-on: probe the server once per load and, when it answers, merge with the same rules as the chat page, upload new results and send deletes. The browser cache is kept per account under the cacheKey, since add-ons are not told who is signed in. - Shared browsers: the entries kept under the old plain keys are imported once, into the first account that signs in, and then removed from the plain keys. A browser that has held an account's history shows and keeps nothing while the server cannot say whose it is (an error other than 404), so one account never sees another's prompts. - Offline: deletes are queued by id and sent on the next sync, which fetches the list again before merging, so a deleted entry does not come back. A Clear that fails is queued as the ids it removed, never as "delete the workspace", so a replay cannot delete results made on another device in between. Without auth nothing changes for the user: the list answers 200 with enabled: false (a 404 would be logged as an error by the browser on every Studio load) and the Studio keeps using localStorage. Favourites and 3D (IndexedDB) stay in the browser for now; the server already accepts threed entries. Docs: features/studio-history. Tests: store specs on SQLite and PostgreSQL, route and auth specs, Studio unit tests for the merge, the legacy import and the delete queue, and a Playwright spec (e2e/studio-history-sync.spec.js) that drives the Studio bundle against a stand-in server: save, delete, Clear, two accounts on one browser, a refused server, the one-time import, and no accounts (against the real route, with no console error). Assisted-by: Claude:claude-opus-5-5 Signed-off-by: coffeerunhobby <294crhwtf@mozmail.com>
master replaced the WebUI chat history (core/services/chathistory, /api/conversations, the chat_history feature) with server-side chats (mudler#12918). Studio history keeps its own store, routes and the studio_history feature, now next to FeatureChats instead of FeatureChatHistory. The comments and the docs page no longer point at the removed chat history, and the docs link to the deleted features/chat-history page is gone. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: coffeerunhobby <294crhwtf@mozmail.com>
useMediaHistory put back every entry made on the page that the synced cache lacked, for as long as the page lived: one deleted on another device came back on the next sync, and entries made under one account were carried into the next verified account's cache. Entries now count as pending only until saveRemote answers (an answer of "deleted elsewhere" also removes the entry). A sync never restores an id it saw deleted (deletedInLastSync), and nothing is kept when the cache key moves to another account. The rule is a pure function, keepPending, covered by the sync tests. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: coffeerunhobby <294crhwtf@mozmail.com>
Contributor
Author
|
Addressed in 948e98e: entries stay pending only until the server confirms them, tombstones from a sync are never restored, and nothing carries over when the account changes; two new tests cover the reviewer's scenario. |
added 7 commits
November 3, 2026 11:32
One conflict, in core/application/application.go: master reworded the studioFilesIndex comment and this branch added studioHistoryStore to the same struct block. Both kept. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: coffeerunhobby <294crhwtf@mozmail.com>
…studio-history # Conflicts: # core/application/application.go
The three swagger files conflicted because both sides added paths and definitions. They are regenerated with swag v1.16.6 and hold master's output plus the Studio history routes and schemas, with nothing else changed. Master raised the instruction count to 32 and this branch adds studio-history, so the instructions spec now expects 33.
Master's docs reorganisation (mudler#13178) moved the Studio, authentication and API discovery pages. The Studio History page moves next to Studio, under addons/catalogue/models-and-media, without a url field; its links use the new paths and its URL is added to docs/redirects.txt, as the docs README asks for a new page. The swagger files merged cleanly and equal master's output plus the Studio history routes and schemas.
master added the remotes routes (mudler#13235) at the end of core/http/routes/localai.go, where this branch adds RegisterStudioHistoryRoutes. Both functions are kept. master also added the remotes API instruction, so there are now 34 instructions; the count in api_instructions_test.go is raised from 33.
Signed-off-by: coffeerunhobby <294crhwtf@mozmail.com>
# Conflicts: # core/http/endpoints/localai/api_instructions_test.go
coffeerunhobby
force-pushed
the
feat/studio-history
branch
2 times, most recently
from
November 21, 2026 16:49
e7c7ed7 to
c7024da
Compare
mudler
reviewed
Nov 21, 2026
| {"POST", "/api/pii/redact", FeaturePIIFilter}, | ||
|
|
||
| // Studio History (server-side persistence of the Studio's generations) | ||
| {"GET", "/api/studio/history", FeatureStudioHistory}, |
Owner
There was a problem hiding this comment.
not sure how do I feel about this. What I'd do instead of having this in the core, is the addon to actually store the data ( in the addon storage ) per-user/generation.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The Studio keeps the record of every generation (prompt, model, parameters, result URLs, lineage) in
localStorageonly. The files are on the server, but the history is lost with a cleared browser, does notfollow the user to another device, and is invisible to a second browser of the same account.
This PR persists it per user on the server, the way chat history already is (#12663):
core/services/studiohistory): a GORM tablestudio_history_entriesin the shared authdatabase, keyed by
(user_id, entry_id). The Studio's record is stored opaquely, with a server-assignedversion, tombstones so a deletion reaches every browser, a cap of 1000 entries per type (the oldest become
tombstones) and an import that never deletes. Specs run on SQLite and PostgreSQL.
/api/studio/history): list (with tombstones and an opaque per-accountcacheKey), get, upsert,delete, clear per type, and import. Registered when auth is on and the WebUI enabled, behind a new
studio_historyfeature that is on by default likechat_history. Without auth, only the list isregistered and answers
200 {"enabled": false}: a 404 would be logged by the browser as an error on everyStudio load.
same rules as the chat page, uploads new results and sends deletes. Add-ons are not told who is signed in,
so the browser cache is kept per account under the
cacheKey.Shared browsers and offline
browser, and then removed from the plain keys, so a second account never receives them.
is (signed out, permission revoked, offline), so one person never sees another's prompts.
merging. A Clear that fails is queued as the ids it removed, never as "delete the workspace", so a replay
cannot delete results made on another device in between.
Notes for Reviewers
localStorage.IndexedDB blobs, not URLs, so syncing only its record would show it elsewhere without the model. The
server already accepts
threedentries for when the 3D page keeps its models as files.docs/content/features/studio-history.md(new),studio.md,api-discovery.md. Swaggerregenerated with swag v1.16.6 (additions only).
Tests
go test -tags auth ./core/services/studiohistory/(store specs, SQLite and PostgreSQL)go test -tags auth ./core/http/routes/ -run '^TestRoutes$' -args -ginkgo.focus="Studio history endpoints"(16 specs: auth, per-user isolation, the feature gate, no store)cd addons/studio/ui && npm test(merge rules, legacy import, delete queue)e2e/studio-history-sync.spec.js(7 tests: save and another browser, delete and reload, Clear,two accounts on one browser, a refused server, the one-time import, no accounts against the real route
with no console error), plus every existing
studio-*andmedia-historyspec: 174/174.Signed commits