🎟️ fix: Preserve BYOM Tool Calls Through Capacity Windows (#16060)

* ⏳ fix: Keep BYOM tools queued across capacity windows

* ⏳ fix: Configure the admission budget and refresh queued credentials

Addresses the Codex review on #16060:

- Add `limits.maxQueueWaitMs` to the code environment config schema so a
  deployment can shorten or disable the five-minute admission budget from
  `librechat.yaml`; omission keeps the merged behavior, `0` surfaces the
  first capacity expiry to the model. Resolved through
  `resolveAttachedWorkspaceQueueWaitMs` and passed by ToolService, matching
  how `maxCommandTimeoutMs` already flows.
- Accept an auth-header supplier in `executeWorkspaceTool` and mint it per
  admission attempt, so a call queued past the Code API token TTL presents
  fresh credentials instead of failing permanently with 401. The attached
  Bash tool and the workspace file operations now pass suppliers.
- Recheck the deadline after a clamped wait and throw the saved rejection
  rather than opening an admission window that could still be admitted
  once the budget is spent.

* fix: Complete workspace admission wiring and caller regressions

* fix: Share protected edit retry budgets and schema limits

---------

Co-authored-by: Lia <lia@librechat.ai>
This commit is contained in:
Danny Avila 2026-09-19 09:03:06 -04:00 • committed by GitHub
parent c821638e3d
commit c0affede00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 739 additions and 155 deletions

View file

@ -8,6 +8,7 @@ import {
createAttachedWorkspaceBashTool,
createGitIdentityProgrammaticBashTool,
resolveAttachedWorkspaceCommandTimeoutMax,
resolveAttachedWorkspaceQueueWaitMs,
} from './command';
describe('programmatic Bash Git identity', () => {
@ -265,6 +266,17 @@ describe('createAttachedWorkspaceBashTool', () => {
expect(resolveAttachedWorkspaceCommandTimeoutMax()).toBe(30_000);
});
test('resolves the administrator-configured admission budget', () => {
expect(resolveAttachedWorkspaceQueueWaitMs()).toBe(5 * 60_000);
expect(resolveAttachedWorkspaceQueueWaitMs({ limits: { maxQueueWaitMs: 30_000 } })).toBe(
30_000,
);
expect(resolveAttachedWorkspaceQueueWaitMs({ limits: { maxQueueWaitMs: 0 } })).toBe(0);
expect(resolveAttachedWorkspaceQueueWaitMs({ limits: { maxQueueWaitMs: 10 * 60_000 } })).toBe(
5 * 60_000,
);
});
test('lowers the omitted timeout when the deployment ceiling is below 30 seconds', async () => {
const fetchImpl: CodeBridgeFetch = jest.fn(async () => commandResponse());
const bashTool = createAttachedWorkspaceBashTool({