fix(session): unbrick MCP under Plaud 30-day tokens; add plaud refresh (v0.5.0)#135
Merged
Merged
Conversation
…sh` (v0.5.0) Plaud shortened token lifetimes from ~291 days to 30 days. require()'s TOKEN_REFRESH_BUFFER_SECONDS hard-rejects any token within the buffer of expiry, and that buffer was 30 days — so every freshly-issued token tripped it and the MCP returned session_expired on every call. Drop the buffer to 3 days; move the tray "expiring" warning threshold from 30 to 3 days to match. Also add a `plaud refresh` CLI command that re-auths the stored session, reusing saved email/region (Plaud has no refresh-token grant, so it is a full credential re-auth). No MCP equivalent by design — avoids routing a password through an AI client's context. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Why
Plaud shortened token lifetimes from ~291 days to 30 days.
SessionManager.require()hard-rejects any token withinTOKEN_REFRESH_BUFFER_SECONDSof expiry, and that buffer was 30 days — so every freshly-issued token was already inside the buffer andrequire()raisedPlaudSessionExpiredErroron every call. The MCP returnedsession_expiredfor everything, even right after signing in.Changes
session.py—TOKEN_REFRESH_BUFFER_SECONDS30 days → 3 days. This is the load-bearing fix that unbricks the MCP.tray/app.py— "expiring soon" warning threshold 30 → 3 days (otherwise the tray shows it permanently on a healthy fresh token).cli.py— newplaud refreshcommand: re-auths the stored session, reusing saved email/region; only prompts for the password (--email/--region/--passwordoverride). Plaud has no refresh-token grant, so this is a full credential re-auth. No MCP equivalent by design — avoids routing a password through an AI client's context.Tests
Full suite green (812 passed, 2 skipped). New
refreshflow exercised against a fake auth/store (reuse + region override).🤖 Generated with Claude Code