Skip to content

refactor(server): separate provider history reads from interactive resume#2388

Open
dwyanewang wants to merge 2 commits into
getpaseo:mainfrom
dwyanewang:refactor/provider-history-read
Open

refactor(server): separate provider history reads from interactive resume#2388
dwyanewang wants to merge 2 commits into
getpaseo:mainfrom
dwyanewang:refactor/provider-history-read

Conversation

@dwyanewang

@dwyanewang dwyanewang commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #2348.

This separates read-only provider history access from interactive session resume:

  • adds a dedicated AgentClient.readSessionHistory() contract with a narrow history context;
  • removes AgentResumeSessionOptions and the "interactive" | "history" purpose plumbing;
  • hydrates archived timelines through lightweight closed history snapshots instead of registering a live provider session;
  • keeps resumeSession() eager and interactive, including invalid-session validation before the first prompt;
  • preserves shared archived loaders, deferred timeline broadcast upgrades, and concurrent unarchive promotion;
  • migrates Codex, ACP-based providers, Claude, OpenCode, OMP, and Pi to provider-owned history readers.

Provider history reads now avoid interactive MCP/Paseo tool setup, prompts, subscriptions, aborts, and native archive mutations. Any temporary process or server acquisition is owned and released by the history operation on both success and failure.

Provider behavior

Provider History path
Codex Temporary app-server with direct thread/read; no thread/resume
ACP Temporary initialized process; session/load with mcpServers: []; resume-only providers do not invoke interactive resume
Claude Reads the persisted transcript without starting an SDK query
OpenCode Direct session.get / session.messages, with acquisition release on every failure boundary
OMP Minimal temporary RPC runtime without model/mode/prompt/tool setup
Pi Direct read-only JSONL projection without starting a runtime or installing the Paseo extension

Archive and concurrency behavior

  • Reading archived history leaves both Paseo archivedAt and provider-native archive state unchanged.
  • A concurrent unarchive promotes the shared load to normal interactive resume, including when the stale history read fails.
  • Archived records without a valid persistence handle never create a new interactive native session.
  • Closed timeline responses use the stored agent record as the authority for title, status, archive timestamp, labels, attention state, and persistence metadata.

Review scope

This is intentionally cross-provider because the old history purpose was part of the shared AgentClient contract. Splitting the provider migrations would either leave some archived providers unavailable or retain an interactive-resume fallback.

Roughly half of the added lines are regression tests. There are no protocol schema changes.

Maintainer feedback confirmed that one atomic cross-provider PR is preferred, so this is ready for review.

Verification

Focused tests passed for:

  • archived loader sharing, deferred broadcast, concurrent unarchive, and no-persistence behavior;
  • AgentManager history hydration and archive races;
  • Codex and ACP initialization/history cleanup;
  • Claude, OpenCode, OMP, and Pi history readers;
  • derived/custom provider mapping;
  • MCP archived activity and public closed timeline payloads.

Static/build verification:

  • npm run typecheck
  • npm run lint
  • npm run format:check
  • npm run build:server
  • git diff --check

The full test suite was not run locally per repository guidance.

Closes #2364.

@dwyanewang
dwyanewang marked this pull request as ready for review July 24, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(server): separate provider history reads from interactive resume

1 participant