mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-15 19:40:45 +08:00
Fix session history after UDS login by binding identity on all ws stream upgrades.
Gateway Remote stream mux starts async session.follow after the sync message listener returns; without patching every ws copy and awaiting identity, ACL saw an empty ALS and failed history load as gateway/internal. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
9a93e9c8ce
commit
ba60368f39
2 changed files with 86 additions and 24 deletions
|
|
@ -33,6 +33,17 @@ export function runWithUserContext(userContext, fn) {
|
|||
return userContextStorage.run(userContext, fn)
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist ALS for the rest of this async execution chain.
|
||||
* Needed for Gateway Remote stream mux: message handlers are sync but start
|
||||
* async `pump()` work that continues after the listener returns (so als.run
|
||||
* alone would exit before session.follow runs).
|
||||
* @param {object|null|undefined} userContext
|
||||
*/
|
||||
export function enterUserContext(userContext) {
|
||||
userContextStorage.enterWith(userContext ?? null)
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorator/helper for injecting user context into request handlers
|
||||
* @param {Function} handler - Request handler function
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue