Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: verify LI completion persistence through the public workflow (#13484)

Adam Eivybb02d845950c
diff --git a/server/services/agentFinalization.outputHooks.test.js b/server/services/agentFinalization.outputHooks.test.js
index 9639c36ed7..9d1e7c1ef7 100644
--- a/server/services/agentFinalization.outputHooks.test.js
+++ b/server/services/agentFinalization.outputHooks.test.js
@@ -476,6 +476,17 @@ describe('recovery output-hook dispatch (#3182)', () => {
expect(addTask).not.toHaveBeenCalled();
});
+ it('persists the LI execution verdict in the same public completion task write', async () => {
+ isProgrammaticIoTaskType.mockReturnValue(false);
+ const task = { ...TASK, metadata: { ...TASK.metadata, liProposal: {
+ appId: 'app-example', slug: 'example-proposal', scope: 'repo',
+ } } };
+ await finalizeAgent({ agentId: persistedAgent.id, task, success: true, exitCode: 0, outputBuffer: '' });
+ expect(updateTask).toHaveBeenCalledWith(task.id, expect.objectContaining({ status: 'completed', metadata: expect.objectContaining({
+ liExecution: expect.objectContaining({ appId: 'app-example', slug: 'example-proposal', success: true }),
+ }) }), 'internal');
+ });
+
it.each(['normal', 'recovered'])('parks a runtime prerequisite through %s public completion without a provider retry', async mode => {
isProgrammaticIoTaskType.mockReturnValue(false);
const task = { id: TASK.id, taskType: 'internal', status: 'in_progress', metadata: {
diff --git a/server/services/agentLifecycle.test.js b/server/services/agentLifecycle.test.js
index 7ea6493aff..fc4cf18fff 100644
--- a/server/services/agentLifecycle.test.js
+++ b/server/services/agentLifecycle.test.js
@@ -481,17 +481,6 @@ describe('self-update spawn gate — funnel coverage (#4124)', () => {
expect(reads).toHaveLength(1);
});
- it('finalizeAgent stamps the LI execution verdict into the completion task write (#2779)', () => {
- const idx = AGENT_FINALIZATION_SRC.indexOf('export async function finalizeAgent');
- expect(idx, 'finalizeAgent must exist').toBeGreaterThan(-1);
- const updateIdx = AGENT_FINALIZATION_SRC.indexOf('await updateTask(task.id, taskUpdate, taskType)', idx);
- expect(updateIdx, 'finalizeAgent must persist the task via updateTask').toBeGreaterThan(idx);
- const body = AGENT_FINALIZATION_SRC.slice(idx, updateIdx);
- // The verdict is stamped into taskUpdate via the shared helper BEFORE the updateTask
- // call, so it federates in the same write that marks the task terminal.
- expect(body).toMatch(/await stampLiExecutionVerdict\(taskUpdate, task, \{ success: deliverySuccess, validationPassed, errorAnalysis: deliveryVerdict\.errorAnalysis \}\)/);
- });
-
it('stampLiExecutionVerdict builds the verdict from the task liProposal marker via the shared builder (#2779)', () => {
const idx = AGENT_FINALIZATION_SRC.indexOf('async function stampLiExecutionVerdict');
expect(idx, 'stampLiExecutionVerdict must exist').toBeGreaterThan(-1);