mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #653] [Issue]: Spotify DJ agent disconnects after saving the agent following the paste-fallback OAuth flow #307
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#307
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @LightD31 on GitHub (May 10, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/653
Summary
Saving the Spotify DJ agent in the agent editor wipes its OAuth tokens off disk, so the agent appears disconnected on the next
/api/spotify/statusread. Most visibly affects users who connected via the paste-fallback flow and then click Save (or Save & close from the unsaved-changes banner).Expected behavior
After connecting the Spotify DJ agent (popup or paste fallback), saving the editor — with or without other edits — should preserve the connection. The connection indicator should keep showing Connected to Spotify both immediately and after closing/reopening the editor.
Actual behavior
After connecting via the paste fallback and then saving the agent, the next status read returns disconnected and the editor shows the Connect Spotify Account button again. The user has to reconnect each time they save the agent. The popup path is technically vulnerable to the same wipe but is much less likely to trip in normal use because the popup auto-closes and users typically don't make further edits.
Root cause (for context):
handleSaveinpackages/client/src/components/agents/AgentEditor.tsxbuilds the newsettingspayload from form fields only, and the server'sagents.storage.updatereplaces thesettingsJSON wholesale rather than merging — so token fields the form doesn't know about (spotifyAccessToken,spotifyRefreshToken,spotifyExpiresAt,spotifyScope) are dropped. The connect-time save in the same component already spreads existing settings; the mainhandleSavedid not.Steps to reproduce
/api/spotify/status) — agent reports disconnected.Environment
Logs, screenshots, or video
No server-side error is logged — the wipe is silent because the editor's PATCH is a valid update with a settings object that simply omits the token fields. The disappearance is visible only by re-reading
/api/spotify/status.Additional context
Fix in flight: PR #652 (draft) — preserves the four token fields in
handleSaveand invalidates theagentsReact Query cache after the three out-of-band Spotify mutations the editor performs directly (exchange, popup-poll connected branch,disconnect). Server semantics (agents.storage.updatewholesale-replace) intentionally left untouched to keep the patch focused.Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: