Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
test(runtime): align compaction reminder checks with system sections
zszz3b622cb975bc1
diff --git a/apps/desktop/test/context-compaction.test.mjs b/apps/desktop/test/context-compaction.test.mjsindex d57835f90..9080321c5 100644--- a/apps/desktop/test/context-compaction.test.mjs+++ b/apps/desktop/test/context-compaction.test.mjs@@ -114,12 +114,11 @@ test("the hard boundary is enforced by the host, with a model-side escape hatch"assert.match(runtime, /function contextFallbackReminder\(/);assert.match(runtime, /contextReminderClaimed/);assert.match(runtime, /contextFallbackReminderClaimed/);- // pi 0.86 carries the canonical system prompt in the transcript. The- // reminder is appended as a per-turn system message, not only as the legacy- // AgentContext.systemPrompt field.+ // The reminder is appended as a replaceable system section so compaction+ // can expire it without rewriting earlier instructions.assert.match(runtime,- /messages: \[\s*\.\.\.context\.messages,\s*\{\s*role: "system",\s*content: reminder,/,+ /messages: \[\s*\.\.\.context\.messages,\s*\{\s*role: "system",\s*content: "",\s*sections: \{ \[CONTEXT_BUDGET_SECTION\]: reminder \}/,);assert.match(hostPermissions, /"new_context"/);});diff --git a/packages/agent-runtime/src/runtime.test.ts b/packages/agent-runtime/src/runtime.test.tsindex 689bab439..61e2d83e1 100644--- a/packages/agent-runtime/src/runtime.test.ts+++ b/packages/agent-runtime/src/runtime.test.ts@@ -5285,8 +5285,15 @@ describe("DesktopAgentRuntime per-turn context protection", () => {// compaction trigger, so the model can close out before host compaction.expect(below.context.systemPrompt).toContain("<context_budget>");expect(below.context.systemPrompt).toContain("new_context");+ expect(below.context.messages.at(-1)).toMatchObject({+ role: "system",+ content: "",+ sections: { context_budget: expect.stringContaining("<context_budget>") },+ });+ expect(getCurrentSystemMessage(below.context.messages)?.sections?.context_budget).toContain("new_context");expect(stillBelow.context.systemPrompt).not.toContain("<context_budget>");- // The reminder rides on the turn's context only; nothing is persisted.+ // The legacy prompt baseline stays unchanged; the returned transcript+ // carries the reminder section through the normal persistence path.expect((runtime as any).agent.state.systemPrompt).not.toContain("<context_budget>",);