Skip to content

Commit 0692f71

Browse files
committed
fix: wait for extension relay tab reconnects (#32461) (thanks @AaronWander)
1 parent bcb0d1b commit 0692f71

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Docs: https://docs.openclaw.ai
2929
- ACP/session history: persist transcripts for successful ACP child runs, preserve exact transcript text, record ACP spawned-session lineage, and keep spawn-time transcript-path persistence best-effort so history storage failures do not block execution. (#40137) thanks @mbelinky.
3030
- Browser/CDP: normalize loopback direct WebSocket CDP URLs back to HTTP(S) for `/json/*` tab operations so local `ws://` / `wss://` profiles can still list, focus, open, and close tabs after the new direct-WS support lands. (#31085) Thanks @shrey150.
3131
- Browser/CDP: rewrite wildcard `ws://0.0.0.0` and `ws://[::]` debugger URLs from remote `/json/version` responses back to the external CDP host/port, fixing Browserless-style container endpoints. (#17760) Thanks @joeharouni.
32+
- Browser/extension relay: wait briefly for a previously attached Chrome tab to reappear after transient relay drops before failing with `tab not found`, reducing noisy reconnect flakes. (#32461) Thanks @AaronWander.
3233
- Context engine registry/bundled builds: share the registry state through a `globalThis` singleton so duplicated bundled module copies can resolve engines registered by each other at runtime, with regression coverage for duplicate-module imports. (#40115) thanks @jalehman.
3334

3435
## 2026.3.7

src/browser/server-context.ensure-tab-available.prefers-last-target.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,29 @@ describe("browser server-context ensureTabAvailable", () => {
151151
vi.useRealTimers();
152152
}
153153
});
154+
155+
it("still fails after the extension-tab grace window expires", async () => {
156+
vi.useFakeTimers();
157+
try {
158+
const responses = [
159+
[{ id: "A", type: "page", url: "https://a.example", webSocketDebuggerUrl: "ws://x/a" }],
160+
[{ id: "A", type: "page", url: "https://a.example", webSocketDebuggerUrl: "ws://x/a" }],
161+
...Array.from({ length: 20 }, () => []),
162+
];
163+
stubChromeJsonList(responses);
164+
const state = makeBrowserState();
165+
166+
const ctx = createBrowserRouteContext({ getState: () => state });
167+
const chrome = ctx.forProfile("chrome");
168+
await chrome.ensureTabAvailable();
169+
170+
const pending = expect(chrome.ensureTabAvailable()).rejects.toThrow(
171+
/no attached Chrome tabs/i,
172+
);
173+
await vi.advanceTimersByTimeAsync(3_500);
174+
await pending;
175+
} finally {
176+
vi.useRealTimers();
177+
}
178+
});
154179
});

src/infra/git-commit.test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ describe("git commit resolution", () => {
6565
const repoHead = execFileSync("git", ["rev-parse", "--short=7", "HEAD"], {
6666
cwd: repoRoot,
6767
encoding: "utf-8",
68-
}).trim();
68+
})
69+
.trim()
70+
.slice(0, 7);
6971

7072
const temp = await makeTempDir("git-commit-cwd");
7173
const otherRepo = path.join(temp, "other");
@@ -81,7 +83,9 @@ describe("git commit resolution", () => {
8183
const otherHead = execFileSync("git", ["rev-parse", "--short=7", "HEAD"], {
8284
cwd: otherRepo,
8385
encoding: "utf-8",
84-
}).trim();
86+
})
87+
.trim()
88+
.slice(0, 7);
8589

8690
process.chdir(otherRepo);
8791
const { resolveCommitHash } = await import("./git-commit.js");
@@ -95,7 +99,9 @@ describe("git commit resolution", () => {
9599
const repoHead = execFileSync("git", ["rev-parse", "--short=7", "HEAD"], {
96100
cwd: repoRoot,
97101
encoding: "utf-8",
98-
}).trim();
102+
})
103+
.trim()
104+
.slice(0, 7);
99105

100106
const { resolveCommitHash } = await import("./git-commit.js");
101107
const entryModuleUrl = pathToFileURL(path.join(repoRoot, "src", "entry.ts")).href;
@@ -161,7 +167,9 @@ describe("git commit resolution", () => {
161167
const repoHead = execFileSync("git", ["rev-parse", "--short=7", "HEAD"], {
162168
cwd: repoRoot,
163169
encoding: "utf-8",
164-
}).trim();
170+
})
171+
.trim()
172+
.slice(0, 7);
165173

166174
const { resolveCommitHash } = await import("./git-commit.js");
167175

0 commit comments

Comments
 (0)