Repository navigation
feat(session): implement session store for persisting ACP session IDs… - #712
Conversation
… across instances
There was a problem hiding this comment.
Important
The resume flow itself looks sound, but the store currently lands inside the ACP workspace (the user's repository), and its identity omits the agent id while every daemon in that directory shares one file — please take a look before merging.
Reviewed changes
acpclientload capability +session/load—Initializenow recordsagentCapabilities.loadSessionandLoadSessionresumes an existing session, returning the same mode/model/config-option shape assession/new.- Resume on respawn —
Runner.ensureSessionlooks up a persisted session id, loads it when the agent supports it, falls back tosession/newon failure, and persists whichever id it ends up with. - Replay suppression —
conversationState.loadingis set aroundsession/load, so the agent's replayed history notifications are dropped instead of re-forwarded as new transcript events. sessionStore— a mutex-guarded JSON map at<workspace>/.paca-bridge/sessions.jsonkeyed byprovider|session-key, written atomically via tmp file + rename.- Store test — covers persistence across instances and provider isolation.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the incremental delta since the prior review (cd9b507..13818b5), covering the session store's relocation, agent scoping, and the new resume tests.
- Moved the store out of the workspace —
storePathnow resolves<stateDir>/<hash(workspace)>/<agentID>/sessions.json, defaulting toos.UserConfigDir()/paca-acp-bridge, so the daemon no longer creates runtime state in the user's repository. - Scoped the store to the agent and workspace — the path includes the agent id and the absolute workspace hash, so two agents in one project no longer share or clobber each other's
sessions.json. - Merged on write —
setre-reads the on-disk file before writing so a concurrent writer's entries are not lost, and the directory is now0700. - Threaded the agent id through the CLI —
runner.ConfiggainsAgentIDandStateDir, andcli.Mainpasses--agent-id. - Added resume-path coverage — the fake agent now advertises
loadSession, replays asession/updatebefore thesession/loadresponse, and logs the session calls; end-to-end tests cover load plus replay suppression,session/newfallback on load failure, and skipping load without the capability. - Added store tests — round-trip, provider isolation, concurrent-writer merge, and path isolation by workspace and agent outside the workspace.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the incremental delta since the prior Pullfrog review (bbe307d..7027f64): session-store hardening around stale entries, path identity, and atomic writes.
- Pruned stale sessions — entries now carry an
updatedtimestamp, and anything older than 30 days is dropped when the store is written, so the file no longer grows without bound as tasks come and go. - Hardened the agent-id path component —
storePathreduces the agent id withfilepath.Baseand falls back todefaultfor""/./.., so a caller-supplied id can no longer escape the state directory. - Made writes collision-safe — the fixed
sessions.json.tmpname shared by concurrent daemons is replaced withos.CreateTempin the target directory, and the temp file is removed on any write/close/rename failure. - Suppressed redundant writes and surfaced corrupt stores — re-setting an unchanged id within an hour skips the rewrite, and an unreadable
sessions.jsonnow logs a warning via the logger threaded into the store instead of failing silently. - Added coverage — tests for agent-id traversal rejection and 30-day pruning through a real file round-trip.
go build ./..., go vet ./..., gofmt -l ., and go test ./... pass in apps/acp-bridge at 7027f64.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Problem
Replying to an ACP agent conversation could start a brand-new conversation with no memory of the earlier turns. The bridge kept the ACP
sessionIdonly in memory, so whenever the agent subprocess was respawned it calledsession/newand the agent started blank. That happened after:session/cancel,Changes (
apps/acp-bridge)acpclient:Initializenow readsagentCapabilities.loadSession; addedSupportsLoadSession()andLoadSession()(session/load).runner/sessionstore.go(new): persists session ids to<user config dir>/paca-acp-bridge/<hash(workspace)>/<agent-id>/sessions.json(never inside the workspace), keyed by provider + session key. Writes re-read and merge the file. Best-effort; any I/O error just means a fresh session.runner.ConfiggainsAgentIDandStateDir.runner.ensureSession: when respawning, triessession/loadwith the saved id first; falls back tosession/new(with a warning) if the agent doesn't support it or the load fails. The new id is saved after each session is established.session/loadarrives assession/updatenotifications; these are dropped while loading so they don't show up as duplicate transcript events.session/loadon respawn, replay suppression, fallback tosession/newon load failure, and no load without the capability.Testing
go build,go vet,go test ./...pass inapps/acp-bridge.PACA_SESSION_IDLE_MINUTES=1, send a message, wait ~2 minutes, reply; the agent should remember the earlier turn (requires the agent to supportsession/load).