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

推荐订阅源

V
Visual Studio Blog
Engineering at Meta
Engineering at Meta
月光博客
月光博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
博客园 - Franky
The GitHub Blog
The GitHub Blog
大猫的无限游戏
大猫的无限游戏
The Cloudflare Blog
B
Blog RSS Feed
云风的 BLOG
云风的 BLOG
小众软件
小众软件
罗磊的独立博客
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
美团技术团队
H
Hackread – Cybersecurity News, Data Breaches, AI and More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
C
Check Point Blog
WordPress大学
WordPress大学
博客园 - 【当耐特】
博客园 - 司徒正美
D
Docker

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
fix(google-meet): bound google api error bodies · opencla...
vincentkoc · 2026-06-19 · via Recent Commits to openclaw:main

File tree

  • extensions/google-meet/src

Original file line numberDiff line numberDiff line change

@@ -191,10 +191,8 @@ async function fetchGoogleCalendarEvents(params: {

191191

});

192192

try {

193193

if (!response.ok) {

194-

const detail = await response.text();

195194

throw await googleApiError({

196195

response,

197-

detail,

198196

prefix: "Google Calendar events.list",

199197

scopes: [GOOGLE_CALENDAR_EVENTS_SCOPE],

200198

});

Original file line numberDiff line numberDiff line change

@@ -58,10 +58,8 @@ export async function exportGoogleDriveDocumentText(params: {

5858

});

5959

try {

6060

if (!response.ok) {

61-

const detail = await response.text();

6261

throw await googleApiError({

6362

response,

64-

detail,

6563

prefix: "Google Drive files.export",

6664

scopes: [GOOGLE_DRIVE_MEET_SCOPE],

6765

});

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,47 @@

1+

// Google Meet tests cover bounded Google API error handling.

2+

import { describe, expect, it, vi } from "vitest";

3+

import { googleApiError } from "./google-api-errors.js";

4+
5+

function cancelTrackedResponse(

6+

text: string,

7+

init: ResponseInit,

8+

): {

9+

response: Response;

10+

wasCanceled: () => boolean;

11+

} {

12+

let canceled = false;

13+

const stream = new ReadableStream<Uint8Array>({

14+

start(controller) {

15+

controller.enqueue(new TextEncoder().encode(text));

16+

},

17+

cancel() {

18+

canceled = true;

19+

},

20+

});

21+

return {

22+

response: new Response(stream, init),

23+

wasCanceled: () => canceled,

24+

};

25+

}

26+
27+

describe("googleApiError", () => {

28+

it("bounds Google API error bodies without using response.text()", async () => {

29+

const tracked = cancelTrackedResponse(`${"access denied ".repeat(1024)}tail`, {

30+

status: 403,

31+

headers: { "content-type": "text/plain" },

32+

});

33+

const textSpy = vi.spyOn(tracked.response, "text").mockRejectedValue(new Error("unbounded"));

34+
35+

const error = await googleApiError({

36+

response: tracked.response,

37+

prefix: "Google Meet spaces.get",

38+

scopes: ["https://www.googleapis.com/auth/meetings.space.readonly"],

39+

});

40+
41+

expect(error.message).toContain("Google Meet spaces.get failed (403): access denied");

42+

expect(error.message).not.toContain("tail");

43+

expect(error.message.length).toBeLessThan(8_400);

44+

expect(tracked.wasCanceled()).toBe(true);

45+

expect(textSpy).not.toHaveBeenCalled();

46+

});

47+

});

Original file line numberDiff line numberDiff line change

@@ -1,21 +1,26 @@

11

// Google Meet plugin module implements google api errors behavior.

2+

import { readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";

3+
24

const REAUTH_HINT = "Re-run `openclaw googlemeet auth login` and store the refreshed oauth block.";

5+

const GOOGLE_API_ERROR_BODY_LIMIT_BYTES = 8 * 1024;

36
47

function scopeText(scopes: readonly string[]): string {

58

return scopes.map((scope) => `\`${scope}\``).join(", ");

69

}

710
11+

export async function readGoogleApiErrorDetail(response: Response): Promise<string> {

12+

return await readResponseTextLimited(response, GOOGLE_API_ERROR_BODY_LIMIT_BYTES);

13+

}

14+
815

export async function googleApiError(params: {

916

response: Response;

10-

detail: string;

1117

prefix: string;

1218

scopes?: readonly string[];

1319

}): Promise<Error> {

20+

const detail = await readGoogleApiErrorDetail(params.response);

1421

const scopeHint =

1522

params.scopes && params.scopes.length > 0

1623

? ` Required OAuth scope: ${scopeText(params.scopes)}. ${REAUTH_HINT}`

1724

: "";

18-

return new Error(

19-

`${params.prefix} failed (${params.response.status}): ${params.detail}${scopeHint}`,

20-

);

25+

return new Error(`${params.prefix} failed (${params.response.status}): ${detail}${scopeHint}`);

2126

}

Original file line numberDiff line numberDiff line change

@@ -283,10 +283,8 @@ async function fetchGoogleMeetJson<T>(params: {

283283

});

284284

try {

285285

if (!response.ok) {

286-

const detail = await response.text();

287286

throw await googleApiError({

288287

response,

289-

detail,

290288

prefix: params.errorPrefix,

291289

scopes: [GOOGLE_MEET_MEDIA_SCOPE],

292290

});

@@ -350,10 +348,8 @@ export async function fetchGoogleMeetSpace(params: {

350348

});

351349

try {

352350

if (!response.ok) {

353-

const detail = await response.text();

354351

throw await googleApiError({

355352

response,

356-

detail,

357353

prefix: "Google Meet spaces.get",

358354

scopes: [GOOGLE_MEET_SPACE_SCOPE],

359355

});

@@ -392,10 +388,8 @@ export async function createGoogleMeetSpace(params: {

392388

});

393389

try {

394390

if (!response.ok) {

395-

const detail = await response.text();

396391

throw await googleApiError({

397392

response,

398-

detail,

399393

prefix: "Google Meet spaces.create",

400394

scopes:

401395

params.config && Object.keys(params.config).length > 0

@@ -442,10 +436,8 @@ export async function endGoogleMeetActiveConference(params: {

442436

});

443437

try {

444438

if (!response.ok) {

445-

const detail = await response.text();

446439

throw await googleApiError({

447440

response,

448-

detail,

449441

prefix: "Google Meet spaces.endActiveConference",

450442

scopes: [GOOGLE_MEET_SPACE_CREATED_SCOPE],

451443

});

Original file line numberDiff line numberDiff line change

@@ -11,6 +11,7 @@ import {

1111

waitForLocalOAuthCallback,

1212

} from "openclaw/plugin-sdk/provider-auth-runtime";

1313

import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";

14+

import { readGoogleApiErrorDetail } from "./google-api-errors.js";

1415
1516

const GOOGLE_MEET_REDIRECT_URI = "http://localhost:8085/oauth2callback";

1617

const GOOGLE_MEET_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";

@@ -85,7 +86,7 @@ async function executeGoogleTokenRequest(body: URLSearchParams): Promise<GoogleM

8586

});

8687

try {

8788

if (!response.ok) {

88-

const detail = await response.text();

89+

const detail = await readGoogleApiErrorDetail(response);

8990

throw new Error(`Google OAuth token request failed (${response.status}): ${detail}`);

9091

}

9192

const payload = (await response.json()) as {