* fix: Retire Credentials by Their Committing Write and on Opt-In 2FA
Re-date password reset and enrollment cutoffs once the write that set them commits, so a credential minted while the write is in flight is retired. Opt-in 2FA confirmation now stamps twoFactorEnrolledAt and rotates the session like required enrollment. OpenID refresh ends a session established before a reset or enrollment instead of spending its IdP grant.
* fix: Bind Opt-In 2FA Rotation to the Caller's Refresh Session
Confirmation now requires the refresh session the request was issued with, rotates it in place and revokes only the others, so an access token on its own cannot trade enrollment for a long-lived session. The OpenID retirement check moves into the refresh recovery service and ends the session through the existing session-missing path, leaving the CJS controller unchanged.
* fix: Clear a Retired OpenID Session Against the User It Was Checked For
* refactor: Inject the Refresh Secret Into OpenID Recovery
* fix: Report a Reset Whose Cutoff Could Not Be Re-Dated
A failed re-stamp now propagates as RETIREMENT_RESTAMP_FAILED. The reset controller still revokes sessions and passkeys and answers CREDENTIAL_RETIREMENT_INCOMPLETE; the CLI re-stamps after its revocations and exits non-zero; enrollment revokes sessions before the re-stamp and mints nothing when it fails.
* fix: Re-Date the Reset Cutoff Only After the Link Is Consumed
The web reset re-stamps credentialsChangedAt in the controller once resetPassword has committed, consumed the token and sent the notice, so a failed re-stamp can no longer leave the link replayable. Revocations still run and the response reports CREDENTIAL_RETIREMENT_INCOMPLETE.
* fix: Retire Credentials on Every Exit Path After a Reset Commits
resetPasswordWithToken owns the post-commit steps: deleting the link and sending the notice no longer throw, and a link issued before the account's last credentialsChangedAt is refused, so it is spent even when its deletion fails. The reset write is conditioned on the cutoff it read, so one link commits once. The controller re-dates the cutoff and revokes sessions and passkeys whenever the password changed, and answers CREDENTIAL_RETIREMENT_INCOMPLETE if any of that fails.
* fix: Spend Undated Reset Links and Move the Reset Notice Into TypeScript
* fix: Tell the User When a Reset Could Not Sign Out Every Session
The reset page now recognizes CREDENTIAL_RETIREMENT_INCOMPLETE, shared from librechat-data-provider, and shows a localized warning that the new password is active with a sign-in action, instead of reporting the spent link as invalid.
* perf: Re-Date the Reset Cutoff From the Committed Write
The committed reset hands its credentialsChangedAt back through PasswordResetResult, so the controller re-stamps without a second user read.
* fix: Retire Every Superseded Credential Before Minting on 2FA Enrollment
Opt-in confirmation and setup finalization now revoke sessions, re-date twoFactorEnrolledAt and wait for the auth cache to drop the pre-enrollment document, running every step even when one fails. If any step fails they mint nothing and answer CREDENTIAL_RETIREMENT_INCOMPLETE; the settings dialog keeps 2FA on with a warning and the setup screen sends the user back to sign in with the new factor.
* test: Cover the Settings Warning When 2FA Enrollment Leaves Sessions Behind
* fix: Send the User Back to Sign In After an Incomplete Opt-In Enrollment
Enrollment retires the confirming tab's bearer, and an incomplete retirement mints no replacement, so the settings dialog now shows the backup codes and then signs out to the login page, whether the user completes setup or closes the dialog.
* test: Run the Retirement Warning Scenarios Against Their Own Signed-Out or Fresh Accounts
* test: Open the Sidebar Drawer Before the Account Menu on Phones
* fix: Report a Committed Opt-In Enrollment When Rotating the Session Fails
Once 2FA is promoted, a later failure in confirm2FA withdraws whatever session it may have minted and answers CREDENTIAL_RETIREMENT_INCOMPLETE, so the settings dialog hands over the backup codes and signs the user in again instead of reporting an invalid code.
* test: Prove an Incomplete Reset Does Not Resume the Retired Session
The Sign in action sends a browser with a live session through /login for about 150 ms before it lands in chat, so the signed-in version of the warning scenario only passed when the URL check caught that window. The warning scenario runs signed out, and a new scenario holds a pre-reset session and asserts its refresh is refused and the user stays on the login page.
* fix: Settle the Auth Cache After the CLI Reset's Final Cutoff Write
* test: Require the Login Form After Signing In From a Signed-Out Reset
* fix: Explain an Incomplete Session Retirement Before Restarting Sign-In After Required 2FA Setup
* perf: Start the Opt-In Enrollment User and Session Reads Together
* refactor: Move the Context Usage Popover Pieces Into @librechat/chat
* test: Cover the Context Usage Pieces in the Chat Package
* fix: Ship the Collapsible Animations With the Shared Tailwind Preset
* test: Keep the Expanded Breakdown Choice Across Remounts
* test: Assert the Absent Compaction Hint by Its Fixed Copy
* refactor: Give Collapsible and HoverCard the Breakdown Disclosure Styles
* test: Cover the Breakdown Roll and Remembered Choice in the Browser
* chore: Retest Against Current Dev
* refactor: Move the Messages View Provider Into @librechat/chat
* refactor: Render the Package Message List by Default in ChatScreen
* fix: Drop the Rail's IntersectionObserver Guard for a Package Spec Stub
Nothing renders the rail without a browser: its observer starts in an effect, which never runs in a server render. The guard existed only because jsdom lacks the API, so jsdom now gets inert observers and matchMedia from the package's jest setup, and the spec's own stubs, which no longer matched the DOM lib's IntersectionObserver type, are gone.
* test: Scroll a Sidebar Row Into View Before Dragging It
A row under the fold has no pixel the mouse can press, so the drag selected text instead. Whether a run hit it depended on which earlier specs shared its shard and left chats in the Running and Finished sections.
* test: Give the Client Specs an Inert IntersectionObserver
With the rail's guard gone, a client spec that renders the message list reaches the observer jsdom lacks. The shared setup provides an inert one, as the package's jest setup does, and the child-thread spec's partial client mock gains the rem scale hook the rail reads.
* chore: Retest Against Current Dev
* test: Give the Test Messages Host the Row Hook Members
The messages host gained the assistant, added-conversation, streamed-attachment and feedback hooks when the row hooks moved into the package, so the shared test host supplies them too.
* refactor: Move Leaf Content Parts Into the Chat Package
Container, ToolAuthWarning, ToolPreparation, the failed-reveal pill, the fold
rail, the background task guidance keys, MemoryInfo, PendingSkillCall,
ResumeAuthorHeader, DialogImage and ToolCallLimitNotice move from
client/src/components/Chat/Messages/Content to packages/chat/src/components/parts
and export from @librechat/chat/components. Their specs move with them.
Client importers and mocks point at the package entry. Design-lint
suppressions follow the moved files.
* fix: Ship the Tool Row Type Scale With the Component Library
The progress-text rules move from the SPA stylesheet to packages/client/src/theme/parts.css, which ThemeProvider loads into @librechat/client/style.css, so the package's PendingSkillCall row keeps its type size without the app's CSS. The two class names join the no-unknown-classes allow list, and PendingSkillCall needs no suppression.
* test: Check the Tool Row Label Keeps the Chat Type Scale
* test: Find the Tool Row Label Around Its Toggle
* test: Capture the Staged Skill Row in Its Loading State
* fix: End the Tool Row Type Chain in a Length for Standalone Consumers
--font-size-base and --markdown-font-size are declared only in the app's
stylesheet, so the .progress-text-wrapper font-size and line-height were invalid
for a consumer that loads the published theme alone. The chain now ends in
var(--font-size-base, 1rem), and the consumer spec reads the published
stylesheet for it.
* test: Cover the Memory Limit Alert in Both Themes and Modes
* 💬 feat: Show Ask-User Questions Inline in the Chat Instead of Over the Composer
A live ask_user_question pause now starts in its chat card, in thread order and at the thread's width, instead of a popover over the composer that covered most of the screen on phones. The card's chevron still moves a question into the composer popover, and the popover's chevron moves it back.
The shared atom flips from the questions moved to the chat (collapsedAskActionsAtom) to the questions moved to the composer (expandedAskActionsAtom), so the card is the default surface.
* 🔁 fix: Restore Saved Ask Answers in the Inline Card and Focus a Batch Only on Screen
A pending single question's answer is saved under its own draft key, which autosave restores only into the composer. With the chat card as the default surface, a reload showed an empty answer there; the card now reads that saved draft when no in-memory answer exists.
A batch arriving below a reader who has scrolled up took focus on a control out of view. Arrival focus now waits for the step to be on screen (re-measured against the viewport and scroll containers on each IntersectionObserver notification), and still only takes focus when focus is idle. The visibility measurement moves from Thinking.tsx to utils/viewport.ts so both share it.
* 🧷 fix: Keep a Restored Ask Answer When Draft Saving Is Turned Off
The answer restored from a pending question's saved draft lived only in the render-time fallback, so turning Save drafts off while the card was open recomputed it to empty and cleared the visible answer. It is now copied into the in-memory answers once restored, so later preference changes leave it in place, as they do for the composer.
* 🎯 fix: Clear Answered Ask Drafts and Focus the Popover on Handoff
A pending single question's answer is saved under its own draft key. Answered from the composer, autosave cleared it along with the composer; answered from the chat card, which is now the default, nothing cleared it, so every answered question left its text in localStorage. The key is now cleared as soon as the answer is accepted (even after navigating away) and when the question expires, so a saved answer lives exactly as long as its question.
Moving a question from the card into the composer left focus on the card's now-removed button. A single question now focuses the draft, its answer box, and a batch focuses its active step through a new focusOnHandoff prop that is not limited to the first arrival.
* ⌨️ fix: Focus a Single Question on Arrival and Always Focus a Batch Handoff
With the popover gone as the default, a single question arrived with no focus cue: keys typed next in the composer went out as an ordinary mid-run message instead of answering it. The single card now takes arrival focus like a batch does, on its first option or else its answer field, once per question, only once it is on screen and only when focus is idle (nowhere, or the empty composer that sent the turn). Both cards share a new useArrivalFocus hook for the on-screen wait.
A batch moved into the composer popover now takes focus unconditionally: the handoff is the user's own action, and Safari leaves focus on the previous owner of a clicked button, which can be the hidden chat card.
The deferred-tools HITL e2e scenario read its terminal line once as soon as it appeared, while the slow echo was still streaming into it; it now waits for the full text.
* refactor: Move the Message Row Hooks Into @librechat/chat
* test: Point the Live Attachment Scenario at the Moved useAttachments Spec
The scenario ran the client's useAttachments spec by path, which moved into packages/chat with the hook. It now runs the spec from that workspace.
* refactor: Compose Message Toolbar Styles From Shared Button and Label Variants
* test: Cover an Open Fork Menu Holding the Message Toolbar Visible
* refactor: Compose Composer File Styles From Shared Primitives
* refactor: Compose Summary, Collapsible Text and Subagent Activity Styles From Shared Button Presets
* fix: Draw the New Button Variants From Theme Radius and Height Roles
* test: Find the Held-Open Scenario's Replies Inside the Message List
* fix: Restore the Feedback Note and Fork Checkbox Looks Through Primitive Variants
* refactor: Compose the Message Nav Chevrons With the Disabled Ink Recipe
* fix: Keep the Pre-Push Hook's Git Environment Away From Its Checks
Git exports GIT_DIR to hooks, absolute in a linked worktree, and the hook passed
it to the static checks. scripts/imports.test.mts builds scratch repositories
with git init, add and commit, so under a push those ran against the pushing
worktree: two fixture commits on the branch, its index replaced, and core.bare
set in the shared config.
The hook now unsets everything git rev-parse --local-env-vars lists before any
child runs. The imports suite clears GIT_* for itself as well, because the
pre-commit hook reaches it with STATIC_CHECKS_FULL=1.
* test: Cover the Hook's Git Environment Scrub in the Pre-Push Scenarios
* fix: Simplify Tool Activity Headers
* fix: Preserve Interactive Flattened Tool Results
* test: Update Fold Tree Scenarios for Hidden Markers
* fix: Restore Tool Activity Tree Markers
* fix: Smooth Streaming Tool Disclosures and Show Command Timers
* fix: Align Tool UI Imports With Shared Chat Components
* fix: Hide Durations on File Read and Authoring Cards
* fix: Phrase Tool Durations as Part of the Label
* style: Match Thoughts Panel Radius to Tool Panels
* fix: Keep the Bash Copy Button Clear of the Command
* style: Space Thoughts Rows Like Tool Rows
* style: Render Agent Handoff as a Tool Disclosure
* style: Even Padding on the File Search Relevance Badge
* feat: Show Loaded Skill Instructions With an Open Skill Action
* style: Align Memory Panel Typography With Tool Panels
* style: Show Full File Paths and Match the Diff to Code Panels
* style: Pin Tool Durations and Chevrons to the Row End
* style: Use an Icon Button to Open a Loaded Skill
* style: Always Show Disclosure Chevrons
* style: Compact, Evenly Inset Copy Buttons in Tool Panels
* fix: Draw No Fold Rail Around a Lone Tool Call
* fix: Put a Titled Command's Time on Its Command Line
* fix: Hide a Bare File Edit Summary
* style: Compact Copy Button on Thoughts Headers
* fix: Move Titled Web Search Details Into the Sources Panel Header
* fix: Show Titled Web Search Details Beside the Title Chevron
* fix: Import Tool Call Phase Types From the Chat Package
* test: Cover Tool Activity Header Scenarios
* fix: Read Smooth Streaming Through the Message Parts Host
* fix: Keep a Command's Measured Time When Its Title Takes Over
* fix: Show a Loaded Skill Only When Its Name Is Unambiguous
* fix: Keep Nested Group Rails and the Handoff Label Text
* fix: Keep Skill Execution Warnings Beside Its Instructions
* fix: Label Loaded Skill Instructions as the Current Version
* refactor: Move the Message Navigation Rail Into @librechat/chat
* refactor: Render the Message Navigation Rail From @librechat/chat
* test: Cover the Navigation Rail Jumping Between a Thread's Ends
* refactor: Move Message Scrolling Into @librechat/chat
* refactor: Run Message Scrolling in the Package Message List
* test: Pin the Scroll Throttle's Coalescing Window
* refactor: Move the History Revalidation Guard into @librechat/chat
* refactor: Let useTurns Own Response Binding, Regenerated Focus and the History Guard
* style: Restyle OAuth Success and Error Pages
* style: Render the OAuth Connected Server Badge With Chip
* test: Cover the OAuth Popup Pages With Playwright Scenarios
* test: Settle the OAuth Popup Close Race and Render the Error Page Shell
* test: Show a Settled Assistants Error Lost to New-Chat Recovery
* fix: Keep a Failed Assistants Run's Error on the New-Chat Pane
* fix: Skip New-Chat Recovery for Any Error Turn the Server Did Not Save
* refactor: Move the Assistants Stream Hook into @librechat/chat
* refactor: Stream Assistants Turns Through the Package Legacy Stream
* test: Cover Assistants Send, Stop and Failure Through the Legacy Stream
* test: Give the Test Stream Hosts the Legacy Services Member
* test: Keep the Assistants Failure Case for Its Own Fix
* test: Give the Consumer Spec Host the Legacy Services Member
* fix: Bind Role Delete Config Restore to the Role Identity and Audit the Members It Moved
* fix: Reassign Deleted Role Members With Per-Account Conditional Writes
* test: Type the Member Reassignment Race Spy With Mongoose Query Types
* perf: Reassign Deleted Role Members in Stamped Bulk Writes
* test: Type the Bulk Reassignment Race Spy Options
* fix: Attribute Role Deletion Reassignments by a Per-Batch Nonce
* fix: Keep a Role Whose Members Could Not All Be Reassigned and Audit Those Moved
* fix: Report a Reassignment Batch Whose Write Committed Before Rejecting
* fix: Audit Members Moved Before a Concurrent Role Deletion Won
* fix: Hold Role Deletion to Its Identity, Audit, Cache and Retry Invariants on Every Path
* fix: Recheck the Targeted Role Before Every Reassignment Batch
* fix: Resolve the Targeted Role Id When a Role Delete Names Only the Role
* fix: Report Each Reassigned Account Once and Retry a Config Restore Deferred by an Unreadable Role
* fix: Keep the Reassignment Tag When a Failed Batch Cannot Be Read Back
* fix: Keep Each Overlapping Role Deletion's Reassignment Tag on the Accounts It Moved
* refactor: Share One MessageFooter Between ContentRow and MessageRender
* test: Cover the Shared Message Footer Alignment and Sibling Order
* test: Add a User Prompt Footer Scenario to the Mock Harness
* test: Render the Real Elapsed Timer in the Footer Spec
* feat: Add the Composer Placement Transition Recipe
* refactor: Move the Composer Layout Into the Chat Package
* test: Expect No Refocus on a Coarse Pointer in the Composer Frame Scenario
* fix: Render No Context Rail for a Boolean Slot
* feat: Add a Composer Variant to TextareaAutosize
* refactor: Move the Composer Field and Action Slot Into the Chat Package
* test: Wait for the Collapse Transition in the Composer Field Scenario
* fix: Keep the Composer Touch Font Floor in the Shared Field Stylesheet
* test: Floor a Small Chat Font on the Composer Draft on Touch
* refactor: Draw Content and Thread Rows Through a ContentRow in @librechat/chat
* test: Cover ContentRow Against Fake Hosts and Register the App Hosts in Row Specs
* test: Add Structured Reply Row Scenarios to the Mock Harness
* refactor: Render Thread Rows Through MessagesHost Slots
* refactor: Move the Thread Renderers Into @librechat/chat as the Default MessagesView Thread
* test: Verify Sibling Switching, Activity Anchors and Editing on the Package Thread
* refactor: Move HoverButtons into @librechat/chat Behind Thread and Read-Aloud Host Members
* test: Cover HoverButtons Against a Fake Host and the App Read-Aloud Slot
* test: Add Hover Toolbar Scenarios to the Mock Harness
* test: Target the Edit Textarea by Test Id in the Hover Edit Scenario
* fix: Keep Module-Scope Atoms Out of the Components Entry by Reading HoverButtons State Through the Chat Contract and Host
* test: Render the Hover Toolbar Specs Through the Real English Bundle
* refactor: Route Stream Event Handler Effects Through Grouped Host Services
* test: Confirm the Titled Endpoint Pick in the Generated Title Scenario
* test: Give the Subagent Index Test Host the Event Services Member
* test: Give the Consumer Spec Host the Event Services Member
On narrow layouts the agent builder drawer stays open over the composer after Select Agent, the child activity panel is a modal dialog rather than a region, and Chat History sits behind the drawer's panel switcher. The subagent activity and agent handoff specs now close the drawer with the shared helper, find the child panel under either role, and open Chat History on either layout.
* refactor: Move the Prompts Popover Into the Chat Package
* test: Check Dialog Focus Without Querying the Hidden Composer
* fix: Keep the Search Typed After the Slash When the Prompts Popover Opens
* refactor: Add a Command Popover with a Host Windowed List Slot
* refactor: Move the Mention Popover Into the Chat Package
* test: Cover the Mention Popover Combobox in the Mock Harness
* style: Draw the Mention Popover Like the Prompts and Skills Popovers
* test: Walk to the Endpoint Row Before Drilling Into Its Models
* test: Drill Into a Plain Custom Endpoint in the Mention Scenario
* refactor: Share the Command Character Helper From the Chat Core
* refactor: Move the MessagesView Root Into @librechat/chat
* fix: Read Submitting State From the Chat Contract and Complete the Test Hosts
* test: Tell the Scroll Control Apart From the Rail's End Marker
* refactor: Move the Fork and Feedback Actions into @librechat/chat
Fork reads the viewer's fork defaults and starts the fork through two new
MessagesHost members, keeping its toasts and rate-limit copy in the package; the
app supplies them from its settings atoms and the fork mutation, whose own
callbacks open the copy so a row that unmounts mid-request still lands there.
Feedback moves as is. @ariakit/react becomes a peer dependency of the package.
* test: Cover Fork and Feedback in the Mock Harness
* chore: Sort MessageRow Spec Imports
* fix: Resolve Fork Labels Per Call and Pin the Fork Toast Locator
* test: Give the Consumer Spec Messages Host the Fork Members
* 🥐 chore: Standardize Bun-First Workspace Typechecks
* fix: Preserve Bun 1.4.3 Checker Compatibility
* chore: Pin Bun 1.4.4 for Local and CI Typechecks
---------
Co-authored-by: Lia <lia@librechat.ai>
* refactor: Move Composer Input Controls and Shortcut Helpers Into @librechat/chat
* test: Cover Interrupt Now on a Queued Composer Row
* test: Read the Moved Escalate Button in the Composer Color Guardrail
* refactor: Reuse the Core Draft Check for the Send Button
* fix: Point the Acceptance Harness at the Moved Composer Shortcuts
* perf: Serve JWT Bearer User Lookups From the Auth User Cache
* perf: Batch Agent Permission Reads on the File Access Path
* perf: Remember a Loaded Google Service Key Across Endpoint Config Reads
* perf: Run Independent Startup, Tool, Skill and Erasure Reads Concurrently
* fix: Drop JWT User Cache Writes That Race a User Mutation
Confirm each cache write with a second read and evict when the user changed,
so an in-flight lookup cannot repopulate an entry a credential change just
evicted. The cache mode now arrives through the loader dependencies.
* refactor: Move Agent Skill Access Reads Into packages/api
The chat-completions and Responses controllers call loadSkillAccess instead of
orchestrating the three reads in CJS. The preview route spec mocks the batched
file access helper the middleware now calls.
* test: Cover Agent File Access, JWT Bursts and Remote Skill Reads End to End
* fix: Serve a Cached JWT User Only While Its updatedAt Is Current
A cache hit now reads the stored updatedAt and deletion fence instead of the
fence alone, so a document cached from a read that raced a user mutation is
never served, even when the write landed after that mutation's eviction.
* refactor: Move Startup Migration Checks Into packages/api
* refactor: Inject the Startup Migration Checks Instead of Mongoose Models
* fix: Serve Cached OpenID Users Only While Their updatedAt Is Current
Moves the freshness check into getCurrentCachedAuthUserDoc and uses it on the
OpenID bearer path as well as the local JWT one, so a document cached from a
read that raced a credential or role change is never served there either.
Fixesberry-13/LibreChat#432
* fix: Compare Authorization Fields on Every Auth Cache Hit
updatedAt has millisecond resolution, so the freshness read also compares the
token retirement stamps, role, tenant and two-factor state.
* fix: Annotate the Auth Freshness Projection for Isolated Declarations
* perf: Reuse the OpenID Cache Freshness Read for Deletion Admission
A cache hit already proved the deletion fence is clear, so only users read from
the database take the separate fence query.
* refactor: Keep the OpenID Cache Freshness and Fence Decisions in packages/api
* test: Exercise JWT Cache Freshness Against Real User Methods in MongoDB
* fix: Stamp the JWT User Lookup So the Cache Write Fence Applies
* fix: Reload a Google Service Key File When It Changes or Disappears
The availability check remembers a loaded key only while the file's mtime and
size are unchanged, and fetches URL sources every time as before.
* fix: Recheck a Service Key File After a Permission Change
* feat: Retire Expired and Older Pauses and Reconcile the Held Pause With Sync Snapshots
* fix: Let an Expired Pause Retire the Held One It Ties
* fix: Hold a Pause the Sync Frame Buffers and Follow an Answer Whose Pause a Snapshot Released
* fix: Keep a Stale Buffered Pause Out of the Host Reducer
* fix: Retire a Released Pause When Its Generation Ends
* fix: Let Only the Pause a Sync Frame Stands for Reach the Host Reducer
* feat: Answer, Restore and Stop a Paused Generation From the Chat Core
* fix: Retire a Pause the Server Refused Once Its Probe Owns the Chat
* fix: Keep a Pause the Server Refused Over for Later Reads and Replays
* refactor: Move Subagent Progress State and Content Folding Into @librechat/chat
* refactor: Attach the Subagent Activity Feed Through the Chat Transport
* test: Tag the Subagent Activity Panel E2E Specs With Scenarios
* test: Pin Replay, Ready and Live Steer Ordering Across an Activity Reconnect
* fix: Stop the Subagent Activity Feed on Refusals and Bound Idle Reconnects
* fix: Keep Attaching the Subagent Feed While the Child Thread Is Still Reserved
* test: Read Steer Order the Same While the Child Turn Streams and Once It Settles
* refactor: Move Composer Attachment Components Into @librechat/chat
* test: Cover the Pasted Text Editor From Paste to Saved Edit
* test: Keep the Real Data Provider Enums in the ChatView Subagent Spec
* refactor: Build the Source Badge Styles at Render Time
* test: Reopen the Pasted Text Correction From Its Replacement Chip
* chore: Re-record the Attachment Design Suppressions on Dev
* test: Merge the SteerPart Package Mocks Into One Factory
* fix: Fence Auth User Cache Writes After Eviction and Evict Favorite Holders
An eviction now leaves a per-user fence in the auth user cache that outlives
every document read before it. The reader skips a cached document while its
user is fenced, and a lookup slower than one cache TTL is not cached, so a
request that read the user before a change can no longer repopulate the cache
afterwards, and a document the reverse index lost is hidden as well. Role and
user methods share one bulk eviction helper, and the terms reset only waits
out the TTL when an eviction failed.
Deleting an agent, deleting a user's agents and removing an agent from
favorites now evict the cached auth documents of the users whose favorites
changed.
* fix: Anchor Cached Auth Document Expiry to the Lookup Start
A stalled reverse-index write could land a stale document after the eviction
fence expired, with a fresh TTL. The document now carries an expiry two cache
TTLs after its lookup began; its Redis TTL is computed after the index write
and the reader refuses it past that expiry.
* refactor: Time the Auth User Lookup in the API Package
The lookup start that anchors a cached document's lifetime is now stamped by
timeAuthUserLookup in packages/api, so the OpenID JWT strategy only wires the
lookup through it.
* fix: Wait Out the Full Cached Document Lifetime After Failed Eviction
A document read just before a change can live two cache TTLs from its lookup,
so a credential change or terms reset whose eviction failed now waits that
long before reporting success.
* fix: Recheck Cached Auth Document Expiry After the Fence Read
A fence read that stalls can return after both the fence and the document
expired, so the reader checks the document's expiry again before serving it.