Skip to content

⏳ fix: Honor Workspace Queue Budgets Per Request - #265

Merged
danny-avila merged 2 commits into
mainfrom
danny-avila/workspace-queue-wait-header
Sep 28, 2026
Merged

danny-avila merged 2 commits into
mainfrom
danny-avila/workspace-queue-wait-header

Conversation

@danny-avila

@danny-avila danny-avila commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

LibreChat advertises how long one workspace-tool HTTP request can safely wait for admission. The Code API router previously derived its queue deadline from the execution timeout, which could outlive the caller's HTTP attempt and leave an ambiguous command result. A very short queue allowance could also expire before the store entered its admission queue, returning an ambiguous assignment error even though execution never started.

  • Honor X-LibreChat-Workspace-Queue-Wait-Ms as the per-request admission allowance, bounded by five minutes and any configured server queue ceiling.
  • Keep the 30-second admission default when the header is absent, independently of the execution timeout; reject malformed allowances before dispatch.
  • Classify deadline expiry during initial registration and workspace-fence reads as WORKSPACE_QUEUE_TIMEOUT only before assignment enqueue is attempted. Preserve ambiguous errors after enqueue may have begun.
  • Update the admission guide, remote-bridge guide, and worker README with the header contract and queue + execution + settlement + delivery timeout calculations.

POST /workspace-tools/execute → validate request and allowance → read worker registration → enter admission queue → acquire workspace slot → enqueue assignment → settle and deliver result. Only the pre-enqueue segment can be reported as definitely not started.

This is the Code API counterpart to LibreChat #16421. Longer LibreChat request budgets should remain disabled until this change is deployed and the complete ingress path passes a timed canary.

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update

Testing

  • cd service && bun test src/workspace-tools/router.test.ts src/bridge/worker-admission.test.ts src/bridge/concurrent-worker.test.ts — 81 passed.
  • cd service && bunx eslint src/bridge/worker-admission.test.ts src/workspace-tools/router.ts src/workspace-tools/router.test.ts — passed. store.ts has unrelated baseline lint diagnostics; no lint errors were reported on the added lines.
  • cd service && bunx tsc --noEmit — reports errors outside the changed files in root-access.ts, egress-gateway.ts, egress-grant.ts, sandbox-backend/index.test.ts, and service/replay-state.ts; no router/store diagnostics.
  • git diff --check — passed.

Test Configuration

  • macOS, Bun 1.3.13, HTTP router tests with an in-process bridge-store fixture, and Redis-mock admission tests.
  • No live ingress or deployment canary was run.

Checklist

  • My code adheres to this project's style guidelines in the changed sections
  • I have performed a self-review of my own code
  • I have commented in the classification boundary
  • I have made pertinent documentation changes
  • I have written tests demonstrating that my changes are effective
  • Local focused unit tests pass with my changes

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-28T12:03:23.980298Z 5b23036 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 84a6d07b0d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread service/src/workspace-tools/router.ts
Comment thread service/src/workspace-tools/router.ts
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current PR head 5b23036. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 5b23036de4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila
danny-avila merged commit 337ddd6 into main Sep 28, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant