🧵 feat: Implement Request Executor Pattern for Actions (#4566)

* chore: actions typing

* fix(actions): implement request executor pattern to prevent concurrent execution issues

BREAKING CHANGE: ActionRequest now uses a RequestExecutor pattern for isolated request state

- Introduce RequestConfig class to store immutable configuration
- Add RequestExecutor class to handle isolated request state for each execution
- Modify ActionRequest to act as a facade creating new executors for each operation
- Maintain backward compatibility through delegation and getters
- Add TypeScript types for better type safety
- Fix race conditions in concurrent executions with auth and params

This change prevents state mutation issues when the same action is called
multiple times concurrently, particularly when using authentication. Each
request now gets its own isolated state through a new executor instance,
solving race conditions while maintaining the existing API interface.

* ci: test isolation/immutatability

* chore: Update version to 0.7.51 in data-provider package

* refactor(actions): refactor createActionTool to use request executor pattern
This commit is contained in:
Danny Avila 2024-10-28 13:42:38 -04:00 committed by GitHub
parent 262176fec4
commit 1526b429c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 414 additions and 74 deletions

2
package-lock.json generated
View file

@ -36522,7 +36522,7 @@
},
"packages/data-provider": {
"name": "librechat-data-provider",
"version": "0.7.5",
"version": "0.7.51",
"license": "ISC",
"dependencies": {
"@types/js-yaml": "^4.0.9",