feat: refine mobile master agent sync and chat rendering
This commit is contained in:
@@ -216,6 +216,7 @@ test("heartbeat external activity on an active cli folder blocks the next claim
|
||||
|
||||
const project = await getCliProject();
|
||||
const folderKey = buildProjectFolderKey(project);
|
||||
const recentExternalActivityAt = new Date(Date.now() - 60_000).toISOString();
|
||||
|
||||
const firstTask = await queueMasterAgentTask({
|
||||
projectId: project.id,
|
||||
@@ -252,7 +253,7 @@ test("heartbeat external activity on an active cli folder blocks the next claim
|
||||
threadDisplayName: project.threadMeta.threadDisplayName,
|
||||
codexFolderRef: project.threadMeta.codexFolderRef,
|
||||
codexThreadRef: project.threadMeta.codexThreadRef,
|
||||
lastActiveAt: "2026-04-06T11:05:00.000Z",
|
||||
lastActiveAt: recentExternalActivityAt,
|
||||
suggestedImport: true,
|
||||
},
|
||||
],
|
||||
@@ -263,7 +264,7 @@ test("heartbeat external activity on an active cli folder blocks the next claim
|
||||
assert.ok(policy, "expected heartbeat to persist a scoped conflict policy");
|
||||
assert.equal(policy?.activeCliExecution, true);
|
||||
assert.equal(policy?.conflictState, "blocked");
|
||||
assert.equal(policy?.recentExternalActivityAt, "2026-04-06T11:05:00.000Z");
|
||||
assert.equal(policy?.recentExternalActivityAt, recentExternalActivityAt);
|
||||
|
||||
const secondTask = await queueMasterAgentTask({
|
||||
projectId: project.id,
|
||||
@@ -314,3 +315,49 @@ test("heartbeat external activity on an active cli folder blocks the next claim
|
||||
assert.equal(policy?.activeCliExecution, false);
|
||||
assert.equal(policy?.conflictState, "blocked");
|
||||
});
|
||||
|
||||
test("stale blocked policy does not keep queued conversation replies stuck forever", async () => {
|
||||
await setup();
|
||||
|
||||
const project = await getCliProject();
|
||||
const folderKey = buildProjectFolderKey(project);
|
||||
const state = await readState();
|
||||
state.projectExecutionPolicies = [
|
||||
{
|
||||
deviceId: "mac-studio",
|
||||
folderKey,
|
||||
projectId: project.id,
|
||||
allowPolicy: "forbid",
|
||||
conflictState: "blocked",
|
||||
recentExternalActivityAt: "2026-04-06T09:30:00.000Z",
|
||||
updatedAt: "2026-04-06T09:30:00.000Z",
|
||||
},
|
||||
];
|
||||
await writeState(state);
|
||||
|
||||
const queuedTask = await queueMasterAgentTask({
|
||||
projectId: project.id,
|
||||
requestMessageId: "msg-stale-policy",
|
||||
requestText: "继续推进这个线程",
|
||||
executionPrompt: "请继续推进这个线程",
|
||||
requestedBy: "Boss 超级管理员",
|
||||
requestedByAccount: "17600003315",
|
||||
deviceId: "mac-studio",
|
||||
taskType: "conversation_reply",
|
||||
targetProjectId: project.id,
|
||||
targetThreadId: project.threadMeta.threadId,
|
||||
targetThreadDisplayName: project.threadMeta.threadDisplayName,
|
||||
targetCodexThreadRef: project.threadMeta.codexThreadRef,
|
||||
targetCodexFolderRef: project.threadMeta.codexFolderRef,
|
||||
});
|
||||
|
||||
const claimed = await claimNextMasterAgentTask("mac-studio");
|
||||
assert.equal(claimed?.taskId, queuedTask.taskId);
|
||||
|
||||
const nextState = await readState();
|
||||
const policy = nextState.projectExecutionPolicies.find((item) => item.folderKey === folderKey);
|
||||
assert.ok(policy, "expected stale scoped policy to remain in state");
|
||||
assert.equal(policy?.conflictState, "none");
|
||||
assert.equal(policy?.activeCliExecution, true);
|
||||
assert.equal(policy?.recentExternalActivityAt, undefined);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user