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

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
U
Unit 42
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
罗磊的独立博客
月光博客
月光博客
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
B
Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
美团技术团队
Y
Y Combinator Blog
T
Tailwind CSS Blog
宝玉的分享
宝玉的分享
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
爱范儿
爱范儿
B
Blog RSS Feed
V
Visual Studio Blog
MyScale Blog
MyScale Blog

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(browser): document stable tab references (#88393) · o...
FMLS · 2026-05-31 · via Recent Commits to openclaw:main

@@ -396,4 +396,212 @@ describe("browser server-context tab selection state", () => {

396396

undefined,

397397

]);

398398

});

399+400+

it("assigns stable tab ids and prefers labels as suggested target ids", async () => {

401+

const fetchMock = vi.fn(async (url: unknown) => {

402+

const value = String(url);

403+

if (!value.includes("/json/list")) {

404+

throw new Error(`unexpected fetch: ${value}`);

405+

}

406+

return {

407+

ok: true,

408+

json: async () => [

409+

{

410+

id: "DOCS_RAW",

411+

title: "Docs",

412+

url: "https://docs.example.com",

413+

webSocketDebuggerUrl: "ws://127.0.0.1/devtools/page/DOCS_RAW",

414+

type: "page",

415+

},

416+

{

417+

id: "APP_RAW",

418+

title: "App",

419+

url: "https://app.example.com",

420+

webSocketDebuggerUrl: "ws://127.0.0.1/devtools/page/APP_RAW",

421+

type: "page",

422+

},

423+

],

424+

} as unknown as Response;

425+

});

426+427+

global.fetch = withBrowserFetchPreconnect(fetchMock);

428+

const state = makeState("openclaw");

429+

const ctx = createTestBrowserRouteContext({ getState: () => state });

430+

const openclaw = ctx.forProfile("openclaw");

431+432+

expect(await openclaw.listTabs()).toEqual([

433+

expect.objectContaining({

434+

targetId: "DOCS_RAW",

435+

tabId: "t1",

436+

suggestedTargetId: "t1",

437+

}),

438+

expect.objectContaining({

439+

targetId: "APP_RAW",

440+

tabId: "t2",

441+

suggestedTargetId: "t2",

442+

}),

443+

]);

444+445+

await expect(openclaw.labelTab("t1", "docs")).resolves.toEqual(

446+

expect.objectContaining({

447+

targetId: "DOCS_RAW",

448+

tabId: "t1",

449+

label: "docs",

450+

suggestedTargetId: "docs",

451+

}),

452+

);

453+

});

454+455+

it("carries a stale alias to a single replacement target", async () => {

456+

let listCount = 0;

457+

const fetchMock = vi.fn(async (url: unknown) => {

458+

const value = String(url);

459+

if (!value.includes("/json/list")) {

460+

throw new Error(`unexpected fetch: ${value}`);

461+

}

462+

listCount += 1;

463+

const secondList = listCount > 1;

464+

return {

465+

ok: true,

466+

json: async () =>

467+

secondList

468+

? [

469+

{

470+

id: "FIRST_RAW",

471+

title: "First",

472+

url: "https://first.example.com",

473+

webSocketDebuggerUrl: "ws://127.0.0.1/devtools/page/FIRST_RAW",

474+

type: "page",

475+

},

476+

{

477+

id: "THIRD_RAW",

478+

title: "Third",

479+

url: "https://third.example.com",

480+

webSocketDebuggerUrl: "ws://127.0.0.1/devtools/page/THIRD_RAW",

481+

type: "page",

482+

},

483+

]

484+

: [

485+

{

486+

id: "FIRST_RAW",

487+

title: "First",

488+

url: "https://first.example.com",

489+

webSocketDebuggerUrl: "ws://127.0.0.1/devtools/page/FIRST_RAW",

490+

type: "page",

491+

},

492+

{

493+

id: "SECOND_RAW",

494+

title: "Second",

495+

url: "https://second.example.com",

496+

webSocketDebuggerUrl: "ws://127.0.0.1/devtools/page/SECOND_RAW",

497+

type: "page",

498+

},

499+

],

500+

} as unknown as Response;

501+

});

502+503+

global.fetch = withBrowserFetchPreconnect(fetchMock);

504+

const state = makeState("openclaw");

505+

const ctx = createTestBrowserRouteContext({ getState: () => state });

506+

const openclaw = ctx.forProfile("openclaw");

507+508+

expect((await openclaw.listTabs()).map((tab) => tab.tabId)).toEqual(["t1", "t2"]);

509+

expect(await openclaw.listTabs()).toEqual([

510+

expect.objectContaining({ targetId: "FIRST_RAW", tabId: "t1" }),

511+

expect.objectContaining({ targetId: "THIRD_RAW", tabId: "t2" }),

512+

]);

513+

});

514+515+

it("carries stable aliases across confident raw target replacement", async () => {

516+

let listCount = 0;

517+

const fetchMock = vi.fn(async (url: unknown) => {

518+

const value = String(url);

519+

if (!value.includes("/json/list")) {

520+

throw new Error(`unexpected fetch: ${value}`);

521+

}

522+

listCount += 1;

523+

const targetId = listCount > 1 ? "NEW_RAW" : "OLD_RAW";

524+

return {

525+

ok: true,

526+

json: async () => [

527+

{

528+

id: targetId,

529+

title: "Checkout",

530+

url: "https://shop.example.com/checkout",

531+

webSocketDebuggerUrl: `ws://127.0.0.1/devtools/page/${targetId}`,

532+

type: "page",

533+

},

534+

],

535+

} as unknown as Response;

536+

});

537+538+

global.fetch = withBrowserFetchPreconnect(fetchMock);

539+

const state = makeState("openclaw");

540+

const ctx = createTestBrowserRouteContext({ getState: () => state });

541+

const openclaw = ctx.forProfile("openclaw");

542+543+

await expect(openclaw.labelTab("OLD_RAW", "checkout")).resolves.toEqual(

544+

expect.objectContaining({

545+

targetId: "OLD_RAW",

546+

tabId: "t1",

547+

suggestedTargetId: "checkout",

548+

}),

549+

);

550+

const profileState = state.profiles.get("openclaw");

551+

if (!profileState) {

552+

throw new Error("expected profile state");

553+

}

554+

profileState.lastTargetId = "OLD_RAW";

555+556+

await expect(openclaw.listTabs()).resolves.toEqual([

557+

expect.objectContaining({

558+

targetId: "NEW_RAW",

559+

tabId: "t1",

560+

label: "checkout",

561+

suggestedTargetId: "checkout",

562+

}),

563+

]);

564+

expect(state.profiles.get("openclaw")?.lastTargetId).toBe("NEW_RAW");

565+

});

566+567+

it("resolves friendly tab references before backend focus and close calls", async () => {

568+

const fetchMock = vi.fn(async (url: unknown) => {

569+

const value = String(url);

570+

if (value.includes("/json/list")) {

571+

return {

572+

ok: true,

573+

json: async () => [

574+

{

575+

id: "DOCS_RAW",

576+

title: "Docs",

577+

url: "https://docs.example.com",

578+

webSocketDebuggerUrl: "ws://127.0.0.1/devtools/page/DOCS_RAW",

579+

type: "page",

580+

},

581+

],

582+

} as unknown as Response;

583+

}

584+

if (value.includes("/json/activate/DOCS_RAW") || value.includes("/json/close/DOCS_RAW")) {

585+

return { ok: true } as unknown as Response;

586+

}

587+

throw new Error(`unexpected fetch: ${value}`);

588+

});

589+590+

global.fetch = withBrowserFetchPreconnect(fetchMock);

591+

const state = makeState("openclaw");

592+

const ctx = createTestBrowserRouteContext({ getState: () => state });

593+

const openclaw = ctx.forProfile("openclaw");

594+595+

await openclaw.labelTab("DOCS_RAW", "docs");

596+

await expect(openclaw.ensureTabAvailable("t1")).resolves.toEqual(

597+

expect.objectContaining({ targetId: "DOCS_RAW" }),

598+

);

599+

await openclaw.focusTab("docs");

600+

await openclaw.closeTab("t1");

601+602+

expect(fetchCallUrls(fetchMock).some((url) => url.includes("/json/activate/DOCS_RAW"))).toBe(

603+

true,

604+

);

605+

expect(fetchCallUrls(fetchMock).some((url) => url.includes("/json/close/DOCS_RAW"))).toBe(true);

606+

});

399607

});