You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/09/06 02:52:45 UTC
(maka) branch main updated: fix(desktop): stop polling an unavailable collaboration authority (#4527)
This is an automated email from the ASF dual-hosted git repository.
Astro-Han pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/maka.git
The following commit(s) were added to refs/heads/main by this push:
new a03dd577bb fix(desktop): stop polling an unavailable collaboration authority (#4527)
a03dd577bb is described below
commit a03dd577bbe38a2d602879fef42bfeddf85af56a
Author: testikun <bu...@gmail.com>
AuthorDate: Sun Sep 6 10:52:39 2026 +0800
fix(desktop): stop polling an unavailable collaboration authority (#4527)
When a Runtime Host reports `operation_unavailable` for the collaboration inbox, Desktop kept polling it in the background on every refresh, so an unsupported Host produced a steady stream of failing queries.
The main-process IPC handler now remembers the negative result for the lifetime of the registered Host candidate and answers with an empty inbox without querying the Host again; a new candidate registration resets the memo. Session-scoped collaboration queries keep their error behavior. The wire protocol is unchanged: no capability field, no epoch bump. An earlier draft also cached unavailable scopes in the preload and carried an `authorityUnavailable` flag over IPC; that second memo [...]
Refs #4522
Generated-by: Claude Code
---
.../src/main/__tests__/runtime-host-collaboration-ipc-main.test.ts | 7 +++++++
apps/desktop/src/main/runtime-host-collaboration-ipc-main.ts | 5 +++++
2 files changed, 12 insertions(+)
diff --git a/apps/desktop/src/main/__tests__/runtime-host-collaboration-ipc-main.test.ts b/apps/desktop/src/main/__tests__/runtime-host-collaboration-ipc-main.test.ts
index 3da977f0a2..a161321e20 100644
--- a/apps/desktop/src/main/__tests__/runtime-host-collaboration-ipc-main.test.ts
+++ b/apps/desktop/src/main/__tests__/runtime-host-collaboration-ipc-main.test.ts
@@ -165,9 +165,11 @@ function peerReachability() {
test('treats an unavailable collaboration authority as an empty background inbox', async () => {
const handlers = new Map<string, IpcHandler>();
+ let queryCalls = 0;
registerRuntimeHostCollaborationIpc(
{
async queryCollaborationTurnRequests() {
+ queryCalls += 1;
throw new RuntimeHostOperationError(
'collaboration.turn-request.query',
'operation_unavailable',
@@ -191,6 +193,11 @@ test('treats an unavailable collaboration authority as an empty background inbox
canRequestTurns: false,
requests: [],
});
+ assert.deepEqual(await query({} as Parameters<IpcHandler>[0]), {
+ canRequestTurns: false,
+ requests: [],
+ });
+ assert.equal(queryCalls, 1);
await assert.rejects(
query({} as Parameters<IpcHandler>[0], 'session-1'),
RuntimeHostOperationError,
diff --git a/apps/desktop/src/main/runtime-host-collaboration-ipc-main.ts b/apps/desktop/src/main/runtime-host-collaboration-ipc-main.ts
index 502d5b9b23..47e5a677fc 100644
--- a/apps/desktop/src/main/runtime-host-collaboration-ipc-main.ts
+++ b/apps/desktop/src/main/runtime-host-collaboration-ipc-main.ts
@@ -46,6 +46,7 @@ export function registerRuntimeHostCollaborationIpc(
| DesktopCollaborationConnectionTarget
| Promise<DesktopCollaborationConnectionTarget>,
): void {
+ let backgroundInboxUnavailable = false;
ipcMain.handle(
'session-collaboration:prepare',
async (
@@ -97,10 +98,14 @@ export function registerRuntimeHostCollaborationIpc(
async (_event, sessionId: unknown) => {
const requestedSessionId =
sessionId === undefined ? undefined : requiredId(sessionId, 'Session');
+ if (requestedSessionId === undefined && backgroundInboxUnavailable) {
+ return { canRequestTurns: false, requests: [] };
+ }
try {
return await client.queryCollaborationTurnRequests(requestedSessionId);
} catch (error) {
if (requestedSessionId === undefined && isCollaborationInboxUnavailable(error)) {
+ backgroundInboxUnavailable = true;
return { canRequestTurns: false, requests: [] };
}
throw error;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org