@@ -12,7 +12,7 @@ import {
1212 type AuthProfileStore ,
1313} from "openclaw/plugin-sdk/agent-runtime" ;
1414import { type FileLockOptions , withFileLock } from "openclaw/plugin-sdk/file-lock" ;
15- import { enqueueKeyedTask } from "openclaw/plugin-sdk/keyed-async-queue" ;
15+ import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue" ;
1616import {
1717 CODEX_PLUGINS_MARKETPLACE_NAME ,
1818 normalizeCodexServiceTier ,
@@ -41,7 +41,7 @@ const CODEX_APP_SERVER_BINDING_LOCK_OPTIONS: FileLockOptions = {
4141 } ,
4242 stale : CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS * 2 ,
4343} ;
44- const bindingMutationQueues = new Map < string , Promise < void > > ( ) ;
44+ const bindingMutationQueue = new KeyedAsyncQueue ( ) ;
4545const bindingMutationContext = new AsyncLocalStorage < Set < string > > ( ) ;
4646
4747type ProviderAuthAliasLookupParams = Parameters < typeof resolveProviderIdForAuth > [ 1 ] ;
@@ -121,14 +121,11 @@ export async function withCodexAppServerBindingLock<T>(
121121 // same-process tasks cannot slip between compare/clear/start.
122122 const nestedOwnedBindings = new Set ( ownedBindings ) ;
123123 nestedOwnedBindings . add ( bindingPath ) ;
124- return await enqueueKeyedTask ( {
125- tails : bindingMutationQueues ,
126- key : bindingPath ,
127- task : ( ) =>
128- bindingMutationContext . run ( nestedOwnedBindings , ( ) =>
129- withFileLock ( bindingPath , CODEX_APP_SERVER_BINDING_LOCK_OPTIONS , run ) ,
130- ) ,
131- } ) ;
124+ return await bindingMutationQueue . enqueue ( bindingPath , ( ) =>
125+ bindingMutationContext . run ( nestedOwnedBindings , ( ) =>
126+ withFileLock ( bindingPath , CODEX_APP_SERVER_BINDING_LOCK_OPTIONS , run ) ,
127+ ) ,
128+ ) ;
132129}
133130
134131/** Reads and normalizes a Codex app-server binding sidecar, returning undefined on stale data. */
0 commit comments