Skip to content

🧩 feat: Compose the Background Responses Host - #17606

Merged
dustinhealy merged 5 commits into
feat/stored-response-executionfrom
feat/background-response-host
Nov 11, 2026
Merged

dustinhealy merged 5 commits into
feat/stored-response-executionfrom
feat/background-response-host

Conversation

@dustinhealy

@dustinhealy dustinhealy commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds one typed host for background Agent Responses: durable dispatch, signed local worker ingress, canonical completion/recovery, owner review and cancellation. Ordinary synchronous Responses remain available, and background execution stays disabled unless configured.

The host preserves the original source credential's authority on replay, keeps native recovery state visible, and distinguishes deterministic invalid requests from retryable service failures.

How it works

The host composes durable dispatch, signed local worker ingress, completion/recovery and owner review around the existing synchronous Responses handlers. Background reads require an authorized journal and cannot fall through to ordinary history. Continuation preserves retention deadlines; review submission is available only when checkpoint validation and resume execution are installed together.

Type of change

  • Feature
  • Bug fix

Testing

Tested environments/configuration: Node 24, disposable MongoDB replica sets, real HTTP listeners, actual API-key authentication and durable queue execution.

Automated tests: 568 Responses/remote cases across 26 suites and 99 compiled JSON/SSE controller cases pass. Real HTTP/Mongo cases cover one journal load per poll, source denial and storage failure without fallback, fresh-turn and inherited retention, canonical input/output ancestry, replay without duplicate messages, owner/native boundaries and trusted listeners. Actual Stop/provider-error history is read through the compiled host and real foreground fallback; closing or physically erasing its journal cannot disclose retained background Messages. Ordinary response-ID and legacy conversation-ID reads reject background-marked history even when its full receipt is damaged.

Owning API types, ordered provider/data-schemas/API builds, explicit ten-file import sorting/checks and scoped static checks pass. Three optional full-mode checks are skipped, with types checked separately. Compiled CJS/ESM smoke passes; the isolated Lighthouse harness passes (median LCP 3.58 s, CLS 0.018, TBT 79 ms).

Screenshots / recordings

No user-facing visual change: typed host and HTTP composition.

Risk / compatibility

The host requires explicit durable dependencies and an initialized local listener. Background history requires a readable, authorized journal; legacy conversation-ID retrieval remains foreground-only. Missing authority, unavailable completion proof and incomplete checkpoint cleanup fail closed. Public response state comes from canonical receipts; transient progress does not fabricate completion. Owner browser review and scoped execution credentials retain separate authority.

Checklist

@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from 5931a56 to f385494 Compare October 29, 2026 13:04
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from f385494 to 294539c Compare October 29, 2026 13:09
@dustinhealy
dustinhealy added this pull request to stack #17619 October 29, 2026 13:13
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from 294539c to 5f50436 Compare October 29, 2026 13:27
Copilot AI balanced review requested due to automatic review settings October 29, 2026 13:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Idempotent replays can return output created by a revoked key without rechecking its authority, while non-loopback listener bindings accept queued work that cannot execute.

4 open issues
What changed in this PR

Adds a shared background Responses host that composes existing services for HTTP handlers and workers, including durable dispatch, access checks, review, and cancellation.

Changes:

  • Composes execution, recovery, review, and worker authentication behind one host interface.
  • Adds typed HTTP handlers for background creation, retrieval, and cancellation while preserving ordinary Responses handling.
  • Adds integration tests covering authorization, idempotency, review decisions, cancellation, and durable execution.
File Description
packages/​api/​src/​agents/​responses/​index.ts Exports the new host factory.
packages/​api/​src/​agents/​responses/​http.ts Adds background Responses HTTP handlers.
packages/​api/​src/​agents/​responses/​host.ts Composes services and exposes HTTP and trusted-transport operations.
packages/​api/​src/​agents/​responses/​host.spec.ts Tests host behavior through HTTP, authentication, storage, and queue integration.

Review effort: Balanced

@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from 5f50436 to a71eb54 Compare October 29, 2026 13:38
@github-actions

Copy link
Copy Markdown
Contributor

Lighthouse CI failed. The last 80 log lines contain the measured budgets and assertion failures.

│ 23      │ 'http://localhost:3080/api/permissions/mcpServer/effective/all'                                                 │ 2881.0419999999867 │ 3789.890999999974  │ 200    │
│ 24      │ 'http://localhost:3080/api/prompts/groups?limit=10'                                                             │ 2883.485999999946  │ 4326.845000000001  │ 200    │
│ 25      │ 'http://localhost:3080/api/keys?name=openAI'                                                                    │ 3531.0969999999797 │ 4043.7240000000165 │ 200    │
│ 26      │ 'http://localhost:3080/api/presets'                                                                             │ 3534.0259999999835 │ 4045.8669999999984 │ 200    │
│ 27      │ 'http://localhost:3080/api/tags'                                                                                │ 3534.307999999961  │ 4049.5509999999485 │ 200    │
│ 28      │ 'http://localhost:3080/api/share/link/16390000-0000-4000-8000-000000000001'                                     │ 3536.9529999999795 │ 4309.544999999955  │ 200    │
│ 29      │ 'http://localhost:3080/api/messages/16390000-0000-4000-8000-000000000001?toolPreviews=1'                        │ 3538.600999999966  │ 4567.401999999973  │ 200    │
│ 30      │ 'http://localhost:3080/api/files/config'                                                                        │ 3538.8979999999574 │ 4315.926000000007  │ 200    │
│ 31      │ 'http://localhost:3080/api/user/settings/favorites/tools'                                                       │ 3540.0899999999674 │ 4658.002999999939  │ 200    │
│ 32      │ 'http://localhost:3080/api/endpoints/token-config'                                                              │ 3540.412000000011  │ 4576.503999999986  │ 200    │
│ 33      │ 'http://localhost:3080/api/user/settings/skills/active'                                                         │ 3540.612999999954  │ 4570.562999999995  │ 200    │
│ 34      │ 'http://localhost:3080/api/agents/tools/web_search/auth'                                                        │ 3542.6729999999807 │ 7350.207999999955  │ 200    │
│ 35      │ 'http://localhost:3080/api/agents/tools/calls?conversationId=16390000-0000-4000-8000-000000000001'              │ 3543.5999999999767 │ 4835.075999999972  │ 200    │
│ 36      │ 'http://localhost:3080/api/agents/chat/status/16390000-0000-4000-8000-000000000001?generationProtocolVersion=2' │ 4717.810999999958  │ 4973.4469999999565 │ 200    │
└─────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────┴────────────────────┴────────┘

Inspect .lighthouse HTML/JSON and e2e/lighthouse/README.md. Reuse loaded user/config data; overlap independent reads without bypassing authorization.

┌─────────┬────────────────────────────┬──────────────────────┬───────┐
│ (index) │ audit                      │ median               │ limit │
├─────────┼────────────────────────────┼──────────────────────┼───────┤
│ 0       │ 'largest-contentful-paint' │ 4735.197             │ 4500  │
│ 1       │ 'cumulative-layout-shift'  │ 0.017901221762542687 │ 0.1   │
│ 2       │ 'total-blocking-time'      │ 463.5079999999698    │ 500   │
└─────────┴────────────────────────────┴──────────────────────┴───────┘

  1) [chromium] › e2e/lighthouse/load.spec.ts:10:5 › serial database latency stays within web-vitals budgets 

    Error: Median largest-contentful-paint must stay within 4500

    expect(received).toBeLessThanOrEqual(expected)

    Expected: <= 4500
    Received:    4735.197

       at audit.ts:127

      125 |   console.table(measured);
      126 |   for (const { audit, median, limit } of measured) {
    > 127 |     expect(median, `Median ${audit} must stay within ${limit}`).toBeLessThanOrEqual(limit);
          |                                                                 ^
      128 |   }
      129 |   return results;
      130 | }
        at auditPage (/home/runner/work/LibreChat/LibreChat/e2e/lighthouse/audit.ts:127:65)
        at /home/runner/work/LibreChat/LibreChat/e2e/lighthouse/load.spec.ts:33:19

    attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chromium/test-failed-1.png
    ────────────────────────────────────────────────────────────────────────────────────────────────

    Error Context: e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chromium/error-context.md

    attachment #3: trace (application/zip) ─────────────────────────────────────────────────────────
    e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chromium/trace.zip
    Usage:

        npx playwright show-trace e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chromium/trace.zip

    ────────────────────────────────────────────────────────────────────────────────────────────────


🤖: global teardown has been started
2026-10-29 13:44:46 �[32minfo�[39m: �[32mMongo Connection options�[39m
2026-10-29 13:44:46 �[32minfo�[39m: �[32m{�[39m
�[32m  "bufferCommands": false�[39m
�[32m}�[39m
🤖:  ✅  Connected to Database
🤖:  ✅  Found user in Database
🤖:  ✅  Deleted 1 convos & 2 messages
🤖:  ✅  Deleted user from Database
🤖: global teardown has been started
2026-10-29 13:44:47 �[32minfo�[39m: �[32mMongo Connection options�[39m
2026-10-29 13:44:47 �[32minfo�[39m: �[32m{�[39m
�[32m  "bufferCommands": false�[39m
�[32m}�[39m
🤖:  ✅  Connected to Database
🤖:  ⚠️  User not found in Database
  1 failed
    [chromium] › e2e/lighthouse/load.spec.ts:10:5 › serial database latency stays within web-vitals budgets 

Open the full run

@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from a71eb54 to 0219cff Compare October 29, 2026 14:21
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch 2 times, most recently from 35bd419 to 652e00c Compare October 29, 2026 15:16
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from 652e00c to e2157d9 Compare October 29, 2026 15:37
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from e2157d9 to 4f6425c Compare October 29, 2026 16:38
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from 4f6425c to 5c0655e Compare October 30, 2026 22:54
@dustinhealy

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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-10-31T00:13:01.432723Z f80de08 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: 5c0655efa7

ℹ️ 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".

@dustinhealy

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: f80de081c9

ℹ️ 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".

@dustinhealy
dustinhealy marked this pull request as ready for review October 31, 2026 00:13
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from f80de08 to faa8afe Compare November 2, 2026 18:12
@dustinhealy
dustinhealy removed this pull request from stack #17619 November 4, 2026 15:46
@dustinhealy
dustinhealy added this pull request to stack #17807 November 4, 2026 15:46
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from 87b13a0 to 6abbdc7 Compare November 5, 2026 06:53
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from 6abbdc7 to d6ab888 Compare November 10, 2026 09:27
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from d6ab888 to f510eee Compare November 10, 2026 09:42
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from f510eee to a581db9 Compare November 10, 2026 10:11
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from a581db9 to 795414c Compare November 10, 2026 22:55
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from 795414c to 7602780 Compare November 10, 2026 23:11
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from 7602780 to d28a8e9 Compare November 10, 2026 23:46
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from d28a8e9 to bfc14b8 Compare November 11, 2026 00:06
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from bfc14b8 to 53d51e6 Compare November 11, 2026 01:48
@dustinhealy
dustinhealy force-pushed the feat/background-response-host branch from 53d51e6 to 03a984f Compare November 11, 2026 04:15
@dustinhealy
dustinhealy merged commit 59f54d9 into dev Nov 11, 2026
39 of 44 checks passed
@dustinhealy
dustinhealy deleted the feat/background-response-host branch November 11, 2026 05:05
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.

2 participants