Fix internal gateway attestation for inter-session sends

This commit is contained in:
Rai Butera 2026-03-12 15:51:13 +00:00
parent dc61211802
commit ba5fe7130d
4 changed files with 15 additions and 1 deletions

View File

@ -61,6 +61,7 @@ function createSyntheticOperatorClient(): GatewayRequestOptions["client"] {
role: "operator",
scopes: ["operator.admin", "operator.approvals", "operator.pairing"],
},
isInternalBackendClient: true,
};
}

View File

@ -140,9 +140,18 @@ describe("sessions_send gateway loopback", () => {
expect(details.sessionKey).toBe("main");
const firstCall = spy.mock.calls[0]?.[0] as
| { lane?: string; inputProvenance?: { kind?: string; sourceTool?: string } }
| {
lane?: string;
channel?: string;
messageChannel?: string;
runContext?: { messageChannel?: string };
inputProvenance?: { kind?: string; sourceTool?: string };
}
| undefined;
expect(firstCall?.lane).toBe("nested");
expect(firstCall?.channel).toBe("inter_session");
expect(firstCall?.messageChannel).toBe("inter_session");
expect(firstCall?.runContext?.messageChannel).toBe("inter_session");
expect(firstCall?.inputProvenance).toMatchObject({
kind: "inter_session",
sourceTool: "sessions_send",

View File

@ -49,6 +49,7 @@ function createPluginRouteRuntimeClient(params: {
role: "operator",
scopes,
},
isInternalBackendClient: true,
};
}

View File

@ -990,6 +990,9 @@ export function attachGatewayWsMessageHandler(params: {
canvasHostUrl,
canvasCapability,
canvasCapabilityExpiresAtMs,
isInternalBackendClient:
connectParams.client.id === GATEWAY_CLIENT_IDS.GATEWAY_CLIENT &&
connectParams.client.mode === GATEWAY_CLIENT_MODES.BACKEND,
};
setSocketMaxPayload(socket, MAX_PAYLOAD_BYTES);
setClient(nextClient);