fix: address Greptile P1 findings on PR #2302
- process-registry.ts: skip the trailing notifySlotAvailable() when pruneDeadEntries() removed entries — prune already wakes one waiter per removed SDK process, so the unconditional call double-woke and could let two waiters spawn in the same synchronous tick, briefly exceeding maxConcurrent. Only fire the safety-net notify when nothing was pruned. - install.ts: persistClaudeProvider() no longer silently rewrites CLAUDE_MEM_CLAUDE_AUTH_METHOD to 'subscription'. When called without an explicit auth method, preserve the existing setting; only fall back to 'subscription' when none is configured. Prevents re-running 'claude-mem install --provider claude' from wiping a user's configured 'api-key' or 'gateway' auth. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -591,10 +591,16 @@ type ClaudeApiMode = 'direct' | 'gateway';
|
||||
async function promptProvider(options: InstallOptions): Promise<ProviderId> {
|
||||
const initialProvider = (getSetting('CLAUDE_MEM_PROVIDER') as ProviderId) || 'claude';
|
||||
|
||||
const persistClaudeProvider = (authMethod: 'subscription' | 'api-key' | 'gateway' = 'subscription') => {
|
||||
const persistClaudeProvider = (authMethod?: 'subscription' | 'api-key' | 'gateway') => {
|
||||
const existingAuthMethod = getSetting('CLAUDE_MEM_CLAUDE_AUTH_METHOD') as
|
||||
| 'subscription'
|
||||
| 'api-key'
|
||||
| 'gateway'
|
||||
| undefined;
|
||||
const resolvedAuthMethod = authMethod ?? existingAuthMethod ?? 'subscription';
|
||||
const wrote = mergeSettings({
|
||||
CLAUDE_MEM_PROVIDER: 'claude',
|
||||
CLAUDE_MEM_CLAUDE_AUTH_METHOD: authMethod,
|
||||
CLAUDE_MEM_CLAUDE_AUTH_METHOD: resolvedAuthMethod,
|
||||
});
|
||||
if (wrote) log.info('Saved Claude Agent SDK configuration to ~/.claude-mem/settings.json');
|
||||
};
|
||||
|
||||
@@ -482,6 +482,7 @@ export async function waitForSlot(maxConcurrent: number): Promise<void> {
|
||||
const removed = getProcessRegistry().pruneDeadEntries();
|
||||
if (removed > 0) {
|
||||
logger.info('PROCESS', 'Pruned stale process registry entries while waiting for agent slot', { removed });
|
||||
return;
|
||||
}
|
||||
notifySlotAvailable();
|
||||
}, SLOT_RECHECK_INTERVAL_MS);
|
||||
|
||||
Reference in New Issue
Block a user