mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-20 06:51:59 +00:00
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Backend Unit Tests / backend (push) Blocked by required conditions
Channel Gateway / gateway (push) Waiting to run
Codegraph E2E Vote Gate / Gate (push) Waiting to run
Codegraph E2E Votes / vote (shard 1/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Frontend Unit Tests / frontend (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
Playwright E2E Tests / Codegraph select (push) Waiting to run
Playwright E2E Tests / Shard timings (push) Waiting to run
Playwright E2E Tests / e2e () (push) Blocked by required conditions
Playwright E2E Tests / MCP list_changed (replica count 1) (push) Blocked by required conditions
Playwright E2E Tests / MCP list_changed (replica count 2) (push) Blocked by required conditions
Playwright E2E Tests / MCP Apps (browser and server) (push) Waiting to run
Playwright E2E Tests / e2e (push) Blocked by required conditions
Playwright Shard Timings / Record shard timings (push) Waiting to run
Repository Safety / Confine repository symlinks (push) Waiting to run
* 🪪 feat: Authorize a Schedule in the Same Step That Creates It Where consent is on, a new schedule was created unauthorized and stayed exempt until its owner edited it or the operator's deadline passed. The create form now asks what the schedule may use, from the offer for its agent, and the schedule is created with its grant in one write. A schedule created without a choice is marked as needing authorization from the start. The grant dialog's tool list and choice are split out so the form shows the same thing. * 🔁 fix: Read the Offer Again When a Create's Authorization Is Turned Down The create form kept the offer it first read. Once the server refused a choice made from it, every retry sent the same refused digest. The form now reads the offer again, keeps the ticks that still apply, and holds the create until the new offer is in. * 🧭 fix: Check Readiness at Creation for the Tools the Owner Allowed A schedule being created has no stored grant, so its readiness check covered every MCP tool the agents select, including servers the owner left out. The grant is now validated first and handed to the check, which covers what it allows.
49 lines
2.2 KiB
JavaScript
49 lines
2.2 KiB
JavaScript
/**
|
|
* Loads the real wiring against the real packages. Only the app's own singletons are stood
|
|
* in for, so something the packages do not provide fails here and not when the router loads.
|
|
*/
|
|
jest.mock('~/models', () => ({
|
|
findUser: jest.fn(),
|
|
getRoleByName: jest.fn(),
|
|
getScheduleById: jest.fn(),
|
|
getAgentGraphNodes: jest.fn(),
|
|
resolveAgentGraphAccess: jest.fn(),
|
|
getScheduleMCPCompletionState: jest.fn(),
|
|
}));
|
|
jest.mock('~/config', () => ({ getMCPServersRegistry: jest.fn() }));
|
|
jest.mock('~/server/services/Config/app', () => ({ getAppConfig: jest.fn() }));
|
|
jest.mock('~/server/controllers/ModelController', () => ({ getModelsConfig: jest.fn() }));
|
|
jest.mock('./access', () => ({ resolveAgentFireAccess: jest.fn() }));
|
|
|
|
const { findUser, getRoleByName } = require('~/models');
|
|
const { resolveAgentFireAccess } = require('./access');
|
|
|
|
describe('schedule consent wiring', () => {
|
|
it('provides the routes and the service the schedule router uses', () => {
|
|
const { consent } = require('./consent');
|
|
expect(consent.handlers).toEqual({
|
|
draft: expect.any(Function),
|
|
get: expect.any(Function),
|
|
confirm: expect.any(Function),
|
|
revoke: expect.any(Function),
|
|
});
|
|
expect(consent.service.grant).toEqual(expect.any(Function));
|
|
});
|
|
|
|
it('answers the offer for a schedule not yet created from the caller and the agent it names', async () => {
|
|
const { consent } = require('./consent');
|
|
const res = { status: jest.fn().mockReturnThis(), json: jest.fn() };
|
|
// No agent named: there is nothing to make an offer for.
|
|
await consent.handlers.draft({ user: { id: 'owner' }, body: {} }, res);
|
|
expect(res.status).toHaveBeenCalledWith(404);
|
|
|
|
findUser.mockResolvedValue({ id: 'owner', role: 'USER' });
|
|
getRoleByName.mockResolvedValue({ permissions: {} });
|
|
resolveAgentFireAccess.mockResolvedValue('ok');
|
|
res.status.mockClear();
|
|
// An owner whose role may not use schedules is refused, by the same check as a stored one.
|
|
await consent.handlers.draft({ user: { id: 'owner' }, body: { agent_id: 'agent_a' } }, res);
|
|
expect(res.status).toHaveBeenCalledWith(403);
|
|
expect(res.json).toHaveBeenLastCalledWith({ code: 'consent_forbidden' });
|
|
});
|
|
});
|