Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: preserve safe Reactor session rejection diagnostics

[._.]/ Adam Eivyf9d0ac521019
diff --git a/scripts/reactor-render.py b/scripts/reactor-render.py
index a9f2c3c74f..c85b783f99 100644
--- a/scripts/reactor-render.py
+++ b/scripts/reactor-render.py
@@ -206,7 +206,11 @@ async def render(params):
shutil.rmtree(scratch_path)
emit("complete", clipId=clip["clip_id"], seconds=expected / 24, frames=state["frames"])
except Exception as error:
+ # Only the numeric HTTP status crosses stdio. SDK messages, codes and
+ # operation details may contain response bodies or credentials.
+ status = getattr(error, "status", None)
emit("error", phase=phase, errorType=type(error).__name__,
+ **({"httpStatus": status} if type(status) is int and 400 <= status <= 599 else {}),
**({"code": "INVALID_FRAME_BUFFER"} if state["error"] == "Invalid Reactor video frame buffer" else {}))
raise
finally:
diff --git a/scripts/reactor_render_test.py b/scripts/reactor_render_test.py
index 3a7c05cb8a..46bd9722c9 100644
--- a/scripts/reactor_render_test.py
+++ b/scripts/reactor_render_test.py
@@ -154,6 +154,27 @@ class CaptureLifecycleTest(unittest.IsolatedAsyncioTestCase):
self.assertFalse(Path(str(self.output) + ".capture").exists())
spawn.assert_not_awaited()
+ async def test_connection_rejection_reports_only_safe_http_status_without_submitting(self):
+ for status in (400, 402, 503, None, "private-status", True, 200, 600):
+ with self.subTest(status=status):
+ reactor = FakeReactor()
+ error = type("BadRequestError", (Exception,), {})("private response body")
+ error.status = status
+ reactor.connect = AsyncMock(side_effect=error)
+ log = io.StringIO()
+ with patch.object(self.runner, "Reactor", return_value=reactor), redirect_stdout(log):
+ with self.assertRaises(type(error)):
+ await self.runner.render(self.params)
+ events = [json.loads(line) for line in log.getvalue().splitlines()]
+ expected = {"type": "error", "phase": "connecting", "errorType": "BadRequestError"}
+ if type(status) is int and 400 <= status <= 599:
+ expected["httpStatus"] = status
+ self.assertEqual(events[-1], expected)
+ self.assertNotIn("private", log.getvalue())
+ self.assertEqual(reactor.commands, [])
+ self.assertTrue(reactor.disconnected)
+ self.assertFalse(Path(str(self.output) + ".capture").exists())
+
async def test_canvas_opens_on_the_requested_aspect_and_rejects_one_fast_h3_cannot_render(self):
reactor = FakeReactor()
diff --git a/server/services/videoGen/reactor.js b/server/services/videoGen/reactor.js
index 9f825c502a..8ad408a111 100644
--- a/server/services/videoGen/reactor.js
+++ b/server/services/videoGen/reactor.js
@@ -175,6 +175,11 @@ function captureClip(entry, input, pythonPath, job, jobId) {
if (message.type === 'error' && message.phase === 'connecting' && message.errorType === 'TimeoutError') {
failure = new Error('Reactor connection timed out before any clip was submitted; check provider availability and network access, then retry');
}
+ if (!failure && message.type === 'error' && message.phase === 'connecting' && /^[A-Za-z]+$/.test(message.errorType)) {
+ const status = Number.isInteger(message.httpStatus) && message.httpStatus >= 400 && message.httpStatus <= 599
+ ? `; HTTP ${message.httpStatus}` : '';
+ failure = new Error(`Reactor session connection failed (${message.errorType}${status}) before any clip was submitted; check the provider account and model availability before retrying`);
+ }
if (!failure && message.type === 'error' && /^[a-z]+$/.test(message.phase) && /^[A-Za-z]+$/.test(message.errorType)) failure = new Error(`Reactor ${message.phase} failed (${message.errorType})`);
if (message.type === 'status') {
if (typeof message.message === 'string' && /^Captured [0-9.]+ of [0-9.]+ frames; audio=(True|False)$/.test(message.message)) console.log(`🎬 ${message.message}`);
diff --git a/server/services/videoGen/reactor.test.js b/server/services/videoGen/reactor.test.js
index 8f7da139bc..b27eded842 100644
--- a/server/services/videoGen/reactor.test.js
+++ b/server/services/videoGen/reactor.test.js
@@ -85,6 +85,22 @@ describe('Reactor SDK adapter', () => {
expect(reactor.getActiveJob()).toBeNull();
});
+ it.each([400, 402, undefined, 'private-status', 600])('reports session rejection with safe status %s before clip submission', async (httpStatus) => {
+ await started();
+ const failed = once(videoGenEvents, 'failed');
+ child.stdout.emit('data', Buffer.from(JSON.stringify({ type: 'error', phase: 'connecting', errorType: 'BadRequestError', httpStatus, message: 'private response body' }) + '\n'));
+ child.emit('close', 1);
+ const [event] = await failed;
+ expect(event.error).toContain('before any clip was submitted');
+ expect(event.error).toContain('check the provider account and model availability');
+ if (httpStatus === 400 || httpStatus === 402) expect(event.error).toContain(`HTTP ${httpStatus}`);
+ else expect(event.error).not.toContain('HTTP');
+ expect(event.error).not.toContain('private');
+ expect(mocks.spawn).toHaveBeenCalledOnce();
+ expect(mocks.finalize).not.toHaveBeenCalled();
+ expect(reactor.getActiveJob()).toBeNull();
+ });
+
it('rejects all blank samples before history publication and removes the output', async () => {
const sharp = (await import('sharp')).default;
await sharp({ create: { width: 32, height: 32, channels: 3, background: '#000000' } }).png().toFile(join(root, 'blank.png'));