Address review feedback and fix check lint failures

This commit is contained in:
OpenClaw Assistant 2026-03-14 20:53:30 +00:00
parent 7bbaad2eea
commit 281e33e0cb
5 changed files with 6 additions and 14 deletions

View File

@ -87,13 +87,6 @@ function expectSupportsDeveloperRoleForcedOff(overrides?: Partial<Model<Api>>):
expect(supportsDeveloperRole(normalized)).toBe(false);
}
function expectSupportsUsageInStreamingForcedOff(overrides?: Partial<Model<Api>>): void {
const model = { ...baseModel(), ...overrides };
delete (model as { compat?: unknown }).compat;
const normalized = normalizeModelCompat(model as Model<Api>);
expect(supportsUsageInStreaming(normalized)).toBe(false);
}
function expectResolvedForwardCompat(
model: Model<Api> | undefined,
expected: { provider: string; id: string },

View File

@ -81,11 +81,7 @@ export type GatewayConnectionDetails = {
message: string;
};
function shouldAttachDeviceIdentityForGatewayCall(_params: {
url: string;
token?: string;
password?: string;
}): boolean {
function shouldAttachDeviceIdentityForGatewayCall(): boolean {
// Even when local CLI calls authenticate with a shared gateway token/password,
// we still want to attach device identity so paired operator scopes remain
// available for detail RPCs such as status / system-presence / last-heartbeat.
@ -829,7 +825,7 @@ async function executeGatewayRequestWithScopes<T>(params: {
mode: opts.mode ?? GATEWAY_CLIENT_MODES.CLI,
role: "operator",
scopes,
deviceIdentity: shouldAttachDeviceIdentityForGatewayCall({ url, token, password })
deviceIdentity: shouldAttachDeviceIdentityForGatewayCall()
? loadOrCreateDeviceIdentity()
: undefined,
minProtocol: opts.minProtocol ?? PROTOCOL_VERSION,

View File

@ -79,6 +79,7 @@ describe("probeGateway", () => {
});
expect(result.ok).toBe(true);
expect(gatewayClientState.options?.deviceIdentity).toBeNull();
expect(gatewayClientState.requests).toEqual([]);
});
});

View File

@ -61,6 +61,7 @@ export async function probeGateway(opts: {
clientVersion: "dev",
mode: GATEWAY_CLIENT_MODES.PROBE,
instanceId,
deviceIdentity: opts.includeDetails === false ? null : undefined,
onConnectError: (err) => {
connectError = formatErrorMessage(err);
},

View File

@ -684,7 +684,8 @@ export function attachGatewayWsMessageHandler(params: {
hasBrowserOriginHeader,
sharedAuthOk,
authMethod,
}) || shouldSkipControlUiPairing(controlUiAuthPolicy, role, trustedProxyAuthOk);
}) ||
shouldSkipControlUiPairing(controlUiAuthPolicy, role, trustedProxyAuthOk);
if (device && devicePublicKey && !skipPairing) {
const formatAuditList = (items: string[] | undefined): string => {
if (!items || items.length === 0) {