🔧 fix: Fence Channel Startup and Transaction Capability (#17831)

* 🔧 fix: Fence Channel Startup and Transaction Capability

* 🔧 fix: Gate Clustered Workers Until Startup Completes
This commit is contained in:
Dustin Healy 2026-11-10 21:04:10 -08:00 • committed by GitHub
parent 1f27f5848a
commit fdf75e0174
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 227 additions and 16 deletions

View file

@ -1,9 +1,11 @@
import assert from 'node:assert/strict';
import { execFileSync } from 'node:child_process';
import { execFile, execFileSync } from 'node:child_process';
import { copyFileSync, mkdtempSync, rmSync } from 'node:fs';
import { createServer } from 'node:http';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { promisify } from 'node:util';
const root = fileURLToPath(new URL('../..', import.meta.url));
const fixture = mkdtempSync(join(tmpdir(), 'channel-compose-'));
@ -48,6 +50,7 @@ function configuration(tag, source = false, shared = false, gatewayPort) {
...process.env,
UID: '1000',
GID: '1000',
PORT: '3080',
LIBRECHAT_IMAGE_TAG: tag,
SLACK_APP_ID: 'A123',
SLACK_CLIENT_ID: '123.456',
@ -121,3 +124,30 @@ assert.equal(
'3999',
);
console.log('PASS: shared Compose needs no app credentials and clears all bound-gateway settings');
// Run the shipped healthcheck against an API that listens before initialization completes.
let ready = false;
const server = createServer((req, res) => {
res.writeHead(req.url === '/health' || (req.url === '/readyz' && ready) ? 200 : 503);
res.end();
});
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
try {
const { port } = server.address();
const [kind, command, flag, script] = configuration('').api.healthcheck.test;
assert.equal(kind, 'CMD');
assert.equal(command, 'node');
assert.equal(flag, '-e');
const probe = () =>
promisify(execFile)(process.execPath, [
flag,
script.replace('127.0.0.1:3080', `127.0.0.1:${port}`),
]);
assert.equal((await fetch(`http://127.0.0.1:${port}/health`)).status, 200);
await assert.rejects(probe(), { code: 1 });
ready = true;
await probe();
console.log('PASS: gateway dependency stays unhealthy until API readiness succeeds');
} finally {
await new Promise((resolve) => server.close(resolve));
}

View file

@ -8,6 +8,10 @@ import yaml from 'js-yaml';
const readWorkflow = (file) =>
yaml.load(readFileSync(new URL(`../workflows/${file}`, import.meta.url), 'utf8'));
const manual = readWorkflow('main-image-workflow.yml');
assert.ok(
readWorkflow('retry-docker-builds.yml').on.workflow_run.workflows.includes(manual.name),
'the retry workflow must subscribe to the manual release publisher by its current name',
);
for (const workflow of [readWorkflow('tag-images.yml')]) {
const images = JSON.parse(workflow.jobs.publish.with.images);
const gateway = images.find((image) => image.image_name === 'librechat-channel-gateway');