Skip to content

feat: add History tab to resume prior agent sessions from disk @W-22434464@#205

Open
marcelinollano wants to merge 3 commits into
mainfrom
ml/W-22434464-navigate-history
Open

feat: add History tab to resume prior agent sessions from disk @W-22434464@#205
marcelinollano wants to merge 3 commits into
mainfrom
ml/W-22434464-navigate-history

Conversation

@marcelinollano
Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds a new History tab to the Agentforce DX webview that lists prior cached agent sessions and lets you pick one back up where you left off.

  • Reads sessions from .sfdx/agents/<storageKey>/sessions/, the same on-disk format used by the sf CLI plugin, so the list works regardless of which tool wrote the session.
  • Each row shows a sessionType badge (Simulation / Live Test), the first user message, and a compressed timestamp; click resumes via SDK agentBase.resumeSession(sessionId) and switches to Preview.
  • If the clicked session is already active for the same agent, no restart fires.
  • Empty/loading states match the Tracer placeholder layout, including the Start Simulation / Live Test / Send a message button.

What issues does this PR fix or reference?

@W-22434464@ — [AFDX] [UX] Navigate history

Functionality Before

The webview only ever surfaced the most recent session. Switching agents or restarting wiped chat/tracer state with no way to revisit prior runs that were already on disk.

Functionality After

  • New History tab next to Preview / Tracer with a clock icon.
  • Resume reuses the existing agent instance, restores transcript + traces, and skips the canned welcome message.
  • Optimistic UI: clicking a row immediately shows a "Resuming session..." spinner and disables input — no flicker through the "no session" toolbar state.

Testing Setup Notes

  1. Open a project with an authoring bundle.
  2. Start a simulation, send a few messages, end the session.
  3. Open the new History tab — the just-finished session appears, newest first, with badge + first-message + timestamp.
  4. Click another row → it resumes that session in place; click the same row again → no-op.
  5. Repeat with a Live Test and a Published agent — badges reflect the session type.
  6. Delete or rename a script bundle then attempt to resume one of its sessions — a friendly error appears.

Tests

  • New sessionHistoryService.test.ts (5 cases) covers the disk-read fallback chain.
  • Extended sessionManager.test.ts with resumeSession happy path, end-previous, error, and no-webview cases.
  • Extended webviewMessageHandlers.test.ts with listSessions (success/empty/throw) and resumeSession (forward/short-circuit/missing sessionId).
  • New SessionHistory.test.tsx covers placeholder, list rendering, empty state with start button, and click-to-resume.

🤖 Generated with Claude Code

marcelinollano and others added 3 commits May 13, 2026 00:38
Surfaces a new History tab in the agent webview that lists prior cached
sessions read from .sfdx/agents/<key>/sessions/, the same on-disk format
the sf CLI plugin uses. Clicking a row reattaches the agent via
SDK resumeSession(sessionId), restores the transcript and traces, and
hands control back to the Preview tab without restarting if the chosen
session is already active.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@marcelinollano marcelinollano changed the title feat: add History tab to resume prior agent sessions from disk feat: add History tab to resume prior agent sessions from disk @W-22434464@ May 13, 2026
@marcelinollano marcelinollano marked this pull request as ready for review May 13, 2026 09:47
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.

1 participant