惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Announcements
Recent Announcements
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
Engineering at Meta
Engineering at Meta
Stack Overflow Blog
Stack Overflow Blog
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
aimingoo的专栏
aimingoo的专栏
I
InfoQ
B
Blog
WordPress大学
WordPress大学
Jina AI
Jina AI
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园_首页
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
阮一峰的网络日志
阮一峰的网络日志
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
Google Developers Blog
C
Check Point Blog
月光博客
月光博客
L
LangChain Blog
GbyAI
GbyAI

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
Bind gateway approval access to requester metadata [AI] (...
pgondhi987 · 2026-05-15 · via Recent Commits to openclaw:main

@@ -74,6 +74,7 @@ type SelectedConnectAuth = {

7474

authBootstrapToken?: string;

7575

authDeviceToken?: string;

7676

authPassword?: string;

77+

authApprovalRuntimeToken?: string;

7778

signatureToken?: string;

7879

resolvedDeviceToken?: string;

7980

storedToken?: string;

@@ -130,6 +131,7 @@ export type GatewayClientOptions = {

130131

bootstrapToken?: string;

131132

deviceToken?: string;

132133

password?: string;

134+

approvalRuntimeToken?: string;

133135

instanceId?: string;

134136

clientName?: GatewayClientName;

135137

clientDisplayName?: string;

@@ -221,6 +223,8 @@ export class GatewayClient {

221223

private reconnectTimer: NodeJS.Timeout | null = null;

222224

private pendingDeviceTokenRetry = false;

223225

private deviceTokenRetryBudgetUsed = false;

226+

private approvalRuntimeTokenCompatibilityDisabled = false;

227+

private approvalRuntimeTokenRetryBudgetUsed = false;

224228

private pendingStartupReconnectDelayMs: number | null = null;

225229

private pendingConnectErrorDetailCode: string | null = null;

226230

private pendingConnectErrorDetails: unknown = null;

@@ -506,6 +510,7 @@ export class GatewayClient {

506510

authBootstrapToken,

507511

authDeviceToken,

508512

authPassword,

513+

authApprovalRuntimeToken,

509514

signatureToken,

510515

resolvedDeviceToken,

511516

storedToken,

@@ -516,12 +521,17 @@ export class GatewayClient {

516521

this.pendingDeviceTokenRetry = false;

517522

}

518523

const auth =

519-

authToken || authBootstrapToken || authPassword || resolvedDeviceToken

524+

authToken ||

525+

authBootstrapToken ||

526+

authPassword ||

527+

resolvedDeviceToken ||

528+

authApprovalRuntimeToken

520529

? {

521530

token: authToken,

522531

bootstrapToken: authBootstrapToken,

523532

deviceToken: authDeviceToken ?? resolvedDeviceToken,

524533

password: authPassword,

534+

approvalRuntimeToken: authApprovalRuntimeToken,

525535

}

526536

: undefined;

527537

const signedAtMs = Date.now();

@@ -646,6 +656,19 @@ export class GatewayClient {

646656

this.ws?.close(1013, "gateway starting");

647657

return;

648658

}

659+

if (

660+

this.shouldRetryWithoutApprovalRuntimeToken({

661+

error: err,

662+

authApprovalRuntimeToken,

663+

})

664+

) {

665+

this.approvalRuntimeTokenCompatibilityDisabled = true;

666+

this.approvalRuntimeTokenRetryBudgetUsed = true;

667+

this.backoffMs = Math.min(this.backoffMs, 250);

668+

logDebug("gateway rejected approval runtime auth field; retrying without it");

669+

this.ws?.close(1008, "connect retry");

670+

return;

671+

}

649672

this.opts.onConnectError?.(err instanceof Error ? err : new Error(String(err)));

650673

const msg = `gateway connect failed: ${String(err)}`;

651674

if (this.opts.mode === GATEWAY_CLIENT_MODES.PROBE || isGatewayClientStoppedError(err)) {

@@ -763,6 +786,26 @@ export class GatewayClient {

763786

);

764787

}

765788789+

private shouldRetryWithoutApprovalRuntimeToken(params: {

790+

error: unknown;

791+

authApprovalRuntimeToken?: string;

792+

}): boolean {

793+

if (this.approvalRuntimeTokenRetryBudgetUsed) {

794+

return false;

795+

}

796+

if (!params.authApprovalRuntimeToken) {

797+

return false;

798+

}

799+

if (!(params.error instanceof GatewayClientRequestError)) {

800+

return false;

801+

}

802+

if (params.error.gatewayCode !== "INVALID_REQUEST") {

803+

return false;

804+

}

805+

const message = normalizeLowercaseStringOrEmpty(params.error.message);

806+

return message.includes("invalid connect params") && message.includes("approvalruntimetoken");

807+

}

808+766809

private isTrustedDeviceRetryEndpoint(): boolean {

767810

const rawUrl = this.opts.url ?? "ws://127.0.0.1:18789";

768811

try {

@@ -787,6 +830,9 @@ export class GatewayClient {

787830

const explicitBootstrapToken = normalizeOptionalString(this.opts.bootstrapToken);

788831

const explicitDeviceToken = normalizeOptionalString(this.opts.deviceToken);

789832

const authPassword = normalizeOptionalString(this.opts.password);

833+

const authApprovalRuntimeToken = this.approvalRuntimeTokenCompatibilityDisabled

834+

? undefined

835+

: normalizeOptionalString(this.opts.approvalRuntimeToken);

790836

const storedAuth = this.loadStoredDeviceAuth(role);

791837

const storedToken = storedAuth?.token ?? null;

792838

const storedScopes = storedAuth?.scopes;

@@ -819,6 +865,7 @@ export class GatewayClient {

819865

authBootstrapToken,

820866

authDeviceToken: shouldUseDeviceRetryToken ? (storedToken ?? undefined) : undefined,

821867

authPassword,

868+

authApprovalRuntimeToken,

822869

signatureToken: authToken ?? authBootstrapToken ?? undefined,

823870

resolvedDeviceToken,

824871

storedToken: storedToken ?? undefined,