Repository navigation
Read vs open: a timeline read should not start an agent runtime #5270
Replies: 7 comments
|
Note: this post's content has been substantially rewritten (was: original proposal framing a protocol read/open split as the only correct fix). What changed and why, after verification against current
The verified findings behind the rewrite: #5242, #4535, #5040, PR #4473 (branch code, not just its description), PR #5259, stevecastaneda/paseo-plugins#25. |
|
Archived ACP timeline reads now stop the temporary provider process after loading the transcript, with #6766 merged. Once released, you can read an archived ACP conversation without leaving that process resident; restoring the agent starts a fresh process for new messages. This covers the archived ACP part of your read-vs-open workflow. It does not change reads of unarchived agents, add bulk-read concurrency limits or transcript eviction, or fix the Pi and OpenCode history paths. It will be in the next release. The current release, v0.11.2, does not contain it, and the next version number is not decided yet. To get it sooner, watch the releases page, where changes often appear in a beta before the stable release. Thanks for describing the workflow and separating the archived and unarchived cases. |
|
A Codex timeline read that reopens a runtime now avoids an extra full-history read when Paseo already holds the timeline, with PR #8132 merged. It also stops retaining that unused transcript copy. Once released, update the daemon; existing timeline callers get the improvement without changing their requests. This reduces redundant history work in your read-vs-open scenario. It does not make reads non-resident, bound concurrent readers, or evict the retained timeline, so the broader contract you described remains unresolved. Thanks for laying out the different callers and resource costs. It is merged and will be in the next release. Current stable v0.13.2 and latest beta v0.14.0-beta.2 do not contain it; the next version number is not decided yet. Watch Paseo releases to get it sooner, changes often appear in a beta before stable. |
|
The archived Pi part of your read-vs-open workflow is addressed by merged PR #8554: history reads still briefly start Pi, but release it after replay instead of leaving it resident. Reads of unarchived agents, bulk-read concurrency, and retained transcript memory are unchanged. |
|
The Claude command-list case gets a fix in merged PR #9019: reopening a chat without sending a prompt no longer leaves its process stuck beyond eligible idle cleanup. This allows that process to release its memory, but still starts it for the read and keeps the existing one-hour idle period. |
|
For Codex, merged #9859 covers the part of the read-vs-open workflow that was still resident. A timeline read of a Codex chat the daemon has not loaded already stops its temporary app-server after the read on v0.16.0, but the chat then stays loaded in the daemon until it restarts. With this fix, idle cleanup releases it after the idle period. Other providers, other read paths, and bulk-read limits are unchanged. The fix will ship in the next beta and then the next stable release (Updates page). |
|
This also affects opening an ordinary, unarchived Pi chat just to read it. On v0.16.1, timeline, command, prompt, and subagent requests can all wait on the same interactive resume; in one observed open, the command/prompt/subagent requests finished together after about 4.2 s. Archived history now releases the temporary Pi process, but it still starts one for the read. For the user-open decision above, I'd show the saved transcript and metadata first, with zero Pi processes started for browsing. Resume once on the first send or another explicitly provider-dependent action. Keep branch ordering intact and don't report missing command/subagent metadata as an authoritative empty list. A useful test is to open a persisted Pi chat after restarting the daemon, check that no Pi process starts, then send and check that exactly one session resumes the same conversation. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Read vs open: history/timeline reads must not implicitly acquire interactive runtime residency
Follow-ups: #5242 (launch-time process fan-out), #4535, PR #4473. Plugin quick fix: stevecastaneda/paseo-plugins#25.
Problem
History-reading wire RPCs currently activate the interactive provider runtime. On main:
fetch_agent_timeline_request→ensureAgentLoaded(packages/server/src/server/session.ts:7607) →resumeAgentFromPersistence. The resume purpose is chosen from the durable record: archived → history, otherwise interactive (packages/server/src/server/agent/agent-loading.ts:114). A closed but unarchived durable agent is therefore fully interactive-resumed by an ordinary timeline read and stays resident indefinitely (docs/agent-lifecycle.md, "Idle agents remain resident indefinitely").agent.timeline.search,agent.timeline.list_prompts,agent.fork_context,list_commands(unarchived agents),clear_agent_attention(batched), and theget_agent_activityMCP tool — every read-shaped entry point funnels throughensureAgentLoaded.historypurpose exists but only Codex has a non-resident read on main (temporary app-server, disposed before returning,codex-app-server-agent.tsreadArchivedHistory); Claude, OpenCode, ACP, Pi and OMP have no non-resident path — an unarchived read-resume leaves a live session, and OpenCode's teardown aborts the native session.Any consumer that reads timelines per agent — plugin, SDK script, CLI (
paseo logs) — starts and keeps one provider process per agent. With ~199 non-archived agents (issue #5242) that is a launch-time process and memory spike before any user action. The plugin PR removes this one caller; the next consumer reproduces it. The app-side launch fan-out was fixed by #5040 (session-owned open set); the daemon-side read contract is what remains.Prior work
AgentClient.readSessionHistory()with a narrow history context; provider-owned read-only readers — Codex through a temporary app-server, ACP through a temporary process, Claude from the persisted transcript without an SDK query, Pi from the persisted JSONL directly, OMP through a minimal history RPC runtime, OpenCode through direct session metadata/messages on a releasable server acquisition; memory-only hydration into retained closed snapshots; reads held outside the per-agent lifecycle queue with a post-read re-check that promotes to interactive resume on concurrent unarchive; real-provider regression suites for Codex and OpenCode.This discussion extends that seam; it does not replace it. What #4473 does not yet cover — and what #5242 exposes — is bulk reads across agents, the closed-unarchived class, and retention/concurrency bounds at daemon scale.
Scope exposed by #5242
The incident was a directory-wide read: the plugin listed every non-archived agent and read each timeline, so launch resumed ~199 provider runtimes (≈139 Claude, 36 Codex, 24 Cursor). Any per-agent timeline reader reproduces the class. Extending the existing read-only path from archived-only to all closed durable agents removes the class; without bounded concurrency it converts "200 resident runtimes" into "200 simultaneous temporary helpers" — also unacceptable.
Desired invariant
Explicit runtime activation stays a separate, deliberate act: prompting, requesting provider commands, responding to a permission — and, if maintainers choose, the user opening a chat (see Decisions needed).
Candidate architecture
Layers, not a single mechanism. The core fix needs no wire changes — it lives where the resources live:
timeline.subscribealready creates demand without residency (session.ts:1250–1258); unchanged.readSessionHistoryfrom archived to all closed persisted agents; memory-only hydration; no interactive registration; no native state mutation; temporary resources released on success and failure. Provider coverage follows refactor(server): separate provider history reads from interactive resume #4473: temporary app-server (Codex), temporary process (session/load, resume-only providers rejected) (ACP), persisted transcript without SDK query (Claude), direct JSONL parse (Pi), minimal history RPC runtime (OMP), direct metadata/messages over a releasable acquisition (OpenCode — the acquisition may be a shared helper server; the contract guarantees release, not a dedicated process).docs/agent-lifecycle.md); feat(server): evict idle Codex backends after one hour with background-work guard #5259's opt-in idle-backend eviction withnoteAgentAccessis the first ownership-policy step but is Codex-only, opt-in, and a reclamation policy rather than an ownership model. Do not assume either model is settled by this fix.Resource constraints
Compatibility
Because the core fix is server/provider-side, the wire format does not have to change for the invariant to hold. What changes is observable behavior: a fetch that used to resume now returns history without residency. Whether migration machinery is needed depends on what existing clients rely on:
docs/protocol-compatibility.md), each shim carrying itsCOMPAT(...)tag.Measurements
Decisions needed
list_commandsstay open-class for unarchived agents, or move behind explicit activation?All reactions