fix(pi): keep active runs alive during background sleep

This commit is contained in:
brother7 committed 2026-08-25 21:08:10 +08:00
1 parent 92f4c91088
commit 621ebb1781
22 files changed
+1061 -68

No files matched your search

@@ -25,4 +25,19 @@ describe('Pi packaged release proof wiring', () => {
expect(source.slice(proxyStart, resilienceStart))
.not.toContain("startLocalProofProvider('subagent')");
});
it('wires the packaged resilience proof through Main background and intentional-dispose seams', async () => {
const [mainSource, proofSource, scriptSource] = await Promise.all([
readFile(resolve('electron/main/index.ts'), 'utf8'),
readFile(resolve('electron/coding-runtime/pi/release-proof.ts'), 'utf8'),
readFile(resolve('scripts/run-pi-subagent-packaged-smoke.mjs'), 'utf8'),
]);
expect(mainSource).toContain("codingProducts?.sleep('background_sleep')");
expect(mainSource).toContain('acquireBackgroundLease: (lease) => backgroundLifecycle!');
expect(proofSource).toContain("runtime.dispose(run.targetConversationId, 'test_injection')");
expect(scriptSource).toContain("evaluateProof(electronApplication, 'resilience.idle-status')");
expect(scriptSource).toContain('setMainWindowVisible(electronApplication, false)');
expect(scriptSource).toContain("evaluateProof(electronApplication, 'resilience.dispose-target')");
});
});