bug(providers): Pi sendQuery ignores persistSession and always writes a session JSONL
Problem
In-process Pi queries always persist a session transcript, even when the caller asks for an ephemeral session.
On current main, resolvePiSession() creates a durable session whenever there is no resume id:
if (!resumeSessionId) {
return { sessionManager: SessionManager.create(cwd), resumeFailed: false };
}packages/providers/src/community/pi/provider.ts also calls resolvePiSession(cwd, resumeSessionId, requestOptions?.forkSession) and never forwards requestOptions.persistSession.
SessionManager.create(cwd) writes ~/.pi/agent/sessions/<encoded-cwd>/<uuid>.jsonl. Claude already honors AgentRequestOptions.persistSession, and the Pi CLI --no-session flag maps to SessionManager.inMemory(). Archon's Pi provider does not.
This matters for fire-and-forget calls such as title generation and context: fresh workflow nodes. Those transcripts are not resume state. On a long workflow they accumulate under the workflow CWD slug and make later context windows harder to reason about. A local audit of title sessions showed two-message throwaway calls still persisted as JSONL.
Possible solution
- Extend
resolvePiSession()withpersistSession = true. - When there is no
resumeSessionIdandpersistSession === false, returnSessionManager.inMemory(cwd)instead ofSessionManager.create(cwd). - Pass
requestOptions?.persistSessionfrompackages/providers/src/community/pi/provider.ts. - In
packages/core/src/services/title-generator.ts, setpersistSession: falseon the titleSendQueryOptions. Title generation is not resumable. - In
packages/workflows/src/dag-executor.ts, setpersistSession: falsewhennode.context === 'fresh'. Fresh-context nodes already refuse resume, so their JSONL is leftover transcript, not session state. - Add unit coverage for:
- no resume id +
persistSession: false=>SessionManager.inMemory - no resume id + default/true =>
SessionManager.create - title generation always requests
persistSession: false - a fresh-context DAG node forwards
persistSession: false
- no resume id +
I verified this against main today. I have a local patch, but I cannot push a branch to coleam00/Archon (403). Happy to open a PR from a fork if that is preferred.
Source: coleam00/Archon