You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/09/27 03:02:31 UTC

(maka) branch main updated: fix(runtime-host): log transcript bootstrap failures (#5600)

This is an automated email from the ASF dual-hosted git repository.

Astro-Han pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/maka.git


The following commit(s) were added to refs/heads/main by this push:
     new f8976008ad fix(runtime-host): log transcript bootstrap failures (#5600)
f8976008ad is described below

commit f8976008adc1ee3209c08bfded21349984e33eff
Author: WuHaoYang <14...@qq.com>
AuthorDate: Sun Sep 27 11:02:25 2026 +0800

    fix(runtime-host): log transcript bootstrap failures (#5600)
    
    When the initial transcript bootstrap for subscription.open failed, the
    underlying cause was not logged. Log it with the existing secret redaction
    and 8 KiB limit before the publication-failure hook runs. The hook still
    gets the original error and the client still receives persistence_failed.
    
    Refs #5572
    
    Generated-by: Codex
---
 .../session-continuity-coordinator.test.ts         | 29 +++++++++++++++++++---
 .../src/server/session-continuity-coordinator.ts   |  6 +++--
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/packages/runtime-host/src/__tests__/session-continuity-coordinator.test.ts b/packages/runtime-host/src/__tests__/session-continuity-coordinator.test.ts
index 3b2dde383b..9a560e99e4 100644
--- a/packages/runtime-host/src/__tests__/session-continuity-coordinator.test.ts
+++ b/packages/runtime-host/src/__tests__/session-continuity-coordinator.test.ts
@@ -1184,21 +1184,33 @@ test('open returns a bounded immutable durable tail', async () => {
   coordinator.close();
 });
 
-test('reports a durable bootstrap read failure as unavailable persistence', async () => {
+test('logs a durable bootstrap failure before reporting unavailable persistence', async (t) => {
+  const logs: string[] = [];
+  t.mock.method(console, 'error', (...args: unknown[]) => {
+    logs.push(args.map(String).join(' '));
+  });
+  const failure = new Error(
+    `injected durable bootstrap failure: api_key=sk-secretvalue123\n${'细'.repeat(4096)}`,
+  );
+  const publicationFailures: unknown[] = [];
   const reader: SessionTranscriptReader = {
     ...transcriptReader([]),
     readDurableHighWater: async () => 0,
     readDurablePage: async () => {
-      throw new Error('injected durable bootstrap failure');
+      throw failure;
     },
   };
   const coordinator = new SessionContinuityCoordinator(
     HOST_EPOCH,
     async () => canonical(),
     new SessionAdmissionGate(),
-    undefined,
+    (error) => {
+      assert.equal(logs.length, 1, 'log the cause before the publication-failure hook');
+      publicationFailures.push(error);
+    },
     reader,
   );
+  t.after(() => coordinator.close());
   attachTestConnection(coordinator, 'connection-failed-bootstrap', new RecordingSink());
   const outcome = await coordinator.handlers['subscription.open'](
     {
@@ -1211,7 +1223,16 @@ test('reports a durable bootstrap read failure as unavailable persistence', asyn
     ok: false,
     error: { code: 'persistence_failed', message: 'Session transcript is unavailable' },
   });
-  coordinator.close();
+  assert.deepEqual(publicationFailures, [failure]);
+  assert.equal(logs.length, 1);
+  const prefix = '[runtime-host] subscription.open transcript bootstrap failed: ';
+  const diagnostic = logs[0] ?? '';
+  assert.ok(diagnostic.startsWith(prefix));
+  assert.match(diagnostic, /Error: injected durable bootstrap failure/);
+  assert.match(diagnostic, /\[redacted\]/i);
+  assert.doesNotMatch(diagnostic, /sk-secretvalue123/);
+  assert.match(diagnostic, /<diagnostic truncated>$/);
+  assert.ok(Buffer.byteLength(diagnostic.slice(prefix.length), 'utf8') <= 8 * 1024);
 });
 
 test('rejects a subscription open whose connection closes during transcript bootstrap', async () => {
diff --git a/packages/runtime-host/src/server/session-continuity-coordinator.ts b/packages/runtime-host/src/server/session-continuity-coordinator.ts
index 44676a9e78..37ca272ee9 100644
--- a/packages/runtime-host/src/server/session-continuity-coordinator.ts
+++ b/packages/runtime-host/src/server/session-continuity-coordinator.ts
@@ -1000,8 +1000,10 @@ export class SessionContinuityCoordinator implements SessionContinuityService {
             transcript = created.state;
             transcriptBootstrap = created.bootstrap;
           } catch (error) {
-            // The client can only retry, but a projection that outgrew its
-            // bounds is a Host defect and has to leave a trace here.
+            // Record the cause before the publication-failure hook can drain the Host.
+            console.error(
+              `[runtime-host] subscription.open transcript bootstrap failed: ${boundedFailureDiagnostic(error)}`,
+            );
             this.onPublicationFailure(error);
             return {
               ok: false as const,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org