Repository navigation
Use the saved account for agent actions and read the Keychain once per process - #16
Open
MainSequenceDev wants to merge 1 commit into
Open
MainSequenceDev wants to merge 1 commit into
MainSequenceDev wants to merge 1 commit into
Conversation
…r process Agent actions checked the account with GET /api/v1/users/me/ on every call, although sign-in already saves the account name with the session. They now take the saved name and ask the backend only when an older session has none. Each session read ran two /usr/bin/security programs, and one agent search read the session eight times. MachineSessionService now reads a backend's session once per process and rereads it only to renew or to retry a rejected token. A reread that finds a different account fails instead of switching accounts under the running action. Measured against the local backend: an agent search drops from 16 Keychain programs and a users/me round trip (about 1.2 s) to 2 programs and none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
Agent search in the Claude Desktop plugin was slow. Timing one search through the worker against the local backend (
127.0.0.1:8000):GET /api/v1/users/me//usr/bin/security)initialize,notifications/initialized,tools/list)tools/call agent.search(backend)Most of the remaining time is the backend's query embedding, tracked separately on the backend.
Changes
loginalready stores the username after its oneusers/mecall.AgentClientnow usesstatus(backend)and falls back tostatus(backend, true)only when an older session has no saved name. The readiness loop no longer asks the backend on every poll either.MachineSessionService.saved()caches each backend's session. It rereads only where another process may have rotated the pair: renewal, retrying a rejected token, and the check after writing. Logout drops the cached entry.AUTH_REJECTED("account changed in another process").Tests
discovery takes the account saved at sign-in and checks the backend only when none was savedone process reads the saved session once and never switches account on a rereadnpm test: 114/114 pass.No version bump or tag in this PR; release separately.
🤖 Generated with Claude Code