Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions apps/desktop/e2e/new-task-reload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ test('archived-only history boots into a usable new task', async ({ window: page
await composer.press('Enter');
await expect(reply).toBeVisible({ timeout: 20_000 });

// Visible streaming text is not proof that the Host has released the Turn.
await expect(page.getByRole('button', { name: '重新生成' })).toHaveCount(1);

// Prove bootstrap can restore this history before archiving it.
await page.reload();
await expect(reply).toBeVisible();
Expand Down
11 changes: 7 additions & 4 deletions apps/desktop/e2e/workhub-reconstruction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ test('WorkHub rebuilds delegated execution feedback after navigating away and ba
timeout: 20_000,
});

const sessionName = await page.evaluate(async () =>
(await window.maka.sessions.list())[0]?.name,
);
expect(sessionName).toBeTruthy();
// This test owns navigation identity, not asynchronous title generation.
const sessionName = initialPrompt;
await page.evaluate(async (name) => {
const session = (await window.maka.sessions.list())[0];
if (!session) throw new Error('Source Session was not found');
await window.maka.sessions.rename(session.id, name);
}, sessionName);
await page.evaluate(async () => {
await window.maka.settings.updateClient({ workHub: { enabled: true } });
});
Expand Down
3 changes: 1 addition & 2 deletions apps/desktop/renderer-architecture.json
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,6 @@
"window.maka.transcripts": 2,
"window.maka.workHub.act": 1,
"window.maka.workHub.candidates": 1,
"window.maka.workHub.record": 1,
"window.maka.workHub.resolveCoordinationSession": 1
},
"environmentCapabilities": {
Expand Down Expand Up @@ -895,7 +894,7 @@
"react": 1
},
"importSpecifiers": 116,
"nonTriviaTokens": 14338
"nonTriviaTokens": 14318
},
"src/renderer/use-app-shell-composer-quotes.ts": {
"importDeclarations": 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ test('resolves WorkHub coordination through the dedicated Host operation', async
{ sessionId: 'maka_workhub_coordination' },
{ candidateSetId: `sha256:${'a'.repeat(64)}`, candidates: [] },
{ disposition: 'answer_here', coordinationTurnId: 'action-turn' },
{ turnId: 'summary-turn' },
]);

assert.deepEqual(await client.resolveWorkHubCoordinationSession(), {
Expand All @@ -118,14 +117,6 @@ test('resolves WorkHub coordination through the dedicated Host operation', async
}),
{ disposition: 'answer_here', coordinationTurnId: 'action-turn' },
);
assert.deepEqual(
await client.recordWorkHubCoordination({
turnId: 'summary-turn',
userText: 'Request',
assistantText: 'Summary',
}),
{ turnId: 'summary-turn' },
);
assert.deepEqual(requests, [
{ operation: 'workhub.coordination.resolve', input: {} },
{ operation: 'workhub.coordination.candidates', input: {} },
Expand All @@ -137,14 +128,7 @@ test('resolves WorkHub coordination through the dedicated Host operation', async
proposal: { disposition: 'answer_here' },
},
},
{
operation: 'workhub.coordination.record',
input: {
turnId: 'summary-turn',
userText: 'Request',
assistantText: 'Summary',
},
},

]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { registerRuntimeHostWorkHubIpc } from '../runtime-host-workhub-ipc-main.
test('projects WorkHub coordination resolution through its dedicated IPC domain', async () => {
const handlers = new Map<string, (...args: unknown[]) => unknown>();
let resolveCalls = 0;
const records: unknown[] = [];
const actions: unknown[] = [];
const changes: unknown[] = [];
const createdSessionId = 'runtime-created-session';
Expand All @@ -35,14 +34,6 @@ test('projects WorkHub coordination resolution through its dedicated IPC domain'
resolveCalls += 1;
return { sessionId: 'maka_workhub_coordination' };
},
recordWorkHubCoordination: async (input: {
turnId: string;
userText: string;
assistantText: string;
}) => {
records.push(input);
return { turnId: input.turnId };
},
listWorkHubCoordinationCandidates: async () => ({
candidateSetId: `sha256:${'a'.repeat(64)}`,
candidates: [],
Expand Down Expand Up @@ -74,19 +65,7 @@ test('projects WorkHub coordination resolution through its dedicated IPC domain'
assert.ok(handler);
assert.deepEqual(await handler({}), { sessionId: 'maka_workhub_coordination' });
assert.equal(resolveCalls, 1);
assert.deepEqual(
await handlers.get('workhub:record')?.({}, {
turnId: 'record',
userText: 'Request',
assistantText: 'Summary',
}),
{ turnId: 'record' },
);
assert.deepEqual(records, [{
turnId: 'record',
userText: 'Request',
assistantText: 'Summary',
}]);
assert.equal(handlers.has('workhub:record'), false);
assert.deepEqual(await handlers.get('workhub:candidates')?.({}), {
candidateSetId: `sha256:${'a'.repeat(64)}`,
candidates: [],
Expand Down Expand Up @@ -123,14 +102,15 @@ test('projects WorkHub coordination resolution through its dedicated IPC domain'
assert.deepEqual(changes, [{ reason: 'created', sessionId: createdSessionId }]);
});

test('serializes typed WorkHub action failures across Electron IPC', async () => {
for (const code of ['operation_conflict', 'candidate_set_stale'] as const) {
test(`serializes typed WorkHub action failures across Electron IPC (${code})`, async () => {
const handlers = new Map<string, (...args: unknown[]) => unknown>();
registerRuntimeHostWorkHubIpc(
{
actWorkHubCoordination: async () => {
throw new RuntimeHostOperationError(
'workhub.coordination.act',
'operation_conflict',
code,
'WorkHub action is permanently abandoned',
);
},
Expand All @@ -156,9 +136,10 @@ test('serializes typed WorkHub action failures across Electron IPC', async () =>
{
ok: false,
error: {
code: 'operation_conflict',
code,
message: 'WorkHub action is permanently abandoned',
},
},
);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function createWorkHubController({
...(routingStrategy ? { routingStrategy } : {}),
coordination: {
open: async (handler) => { handler(transcript); return { close: async () => undefined }; },
record: async (input) => ({ turnId: input.turnId }),

candidates: async () => {
const candidates = (await sessions.list())
.filter((entry) => entry.kind === 'ordinary' && !entry.archived)
Expand Down
Loading