mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #652] [MERGED] Fix Spotify disconnect when saving the agent after the paste-fallback OAuth flow #4712
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#4712
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?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/652
Author: @LightD31
Created: 5/10/2026
Status: ✅ Merged
Merged: 5/10/2026
Merged by: @Romuromylus
Base:
main← Head:fix/spotify-token-preservation📝 Commits (3)
326dd01Ajout de la préservation des champs OAuth pour Spotify et invalidation des requêtes après les mises à jour5ad6124Close save-vs-refetch race in Spotify connect/disconnect flows08b87c2Merge branch 'main' into fix/spotify-token-preservation📊 Changes
1 file changed (+44 additions, -1 deletions)
View changed files
📝
packages/client/src/components/agents/AgentEditor.tsx(+44 -1)📄 Description
Linked issue
Closes #653
Why this change
/api/spotify/statusis read. Most visibly affects the paste-fallback path: users have just typed a URL into a textbox and reflexively hit Save afterward, which dropsspotifyAccessToken/spotifyRefreshToken/spotifyExpiresAt/spotifyScopefromagent.settings. The popup path is technically vulnerable too — the auto-closing popup just makes it less likely to be triggered.handleSaveinAgentEditor.tsxbuilds the newsettingspayload from form fields only, and the server'sagents.storage.updatereplaces thesettingsJSON wholesale rather than merging — anything the form omits is lost.What changed
handleSavenow reads the latestdbConfig.settingsand re-includesspotifyAccessToken,spotifyRefreshToken,spotifyExpiresAt,spotifyScopein the saved payload, so wholesale replacement on the server no longer drops them.exchange, popup-poll connected branch, anddisconnect) nowqc.invalidateQueries({ queryKey: agentKeys.all })so React Query'sdbConfigreflects the new server state. Without that,handleSavewould preserve from a stale cache and either re-resurrect tokens after disconnect or fail to preserve fresh ones after exchange.agents.storage.update's wholesale-replace semantics are left untouched to keep the patch focused (per CLAUDE.md).Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
To exercise:
Configure a Spotify DJ agent, connect via the paste-fallback flow on a non-loopback host, then make an unrelated edit (e.g. tweak the prompt) and click Save — agent should remain connected on next status read.
Repeat with the popup flow (loopback / 127.0.0.1) and confirm Save also preserves the connection afterwards.
Click Disconnect in the editor, then click Save — agent should remain disconnected (tokens must not be resurrected from a stale React Query cache).
After paste-fallback success, close and re-open the editor — status should still show Connected to Spotify.
Docs and release impact
UI evidence (if applicable)
🤖 Generated with Claude Code
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.