Skip to content

Conversation

@travisjeffery
Copy link

@travisjeffery travisjeffery commented Feb 6, 2026

Summary

This PR improves ACP session startup behavior and session selection UX.

It adds strategy-based session loading (latest, prompt, new), supports loading existing sessions when the agent advertises session/list + session/load (codex-acp for example), and has ** Start a new session ** as default.

What Changed

  • Added new user option:
    • agent-shell-session-load-strategy (latest default, prompt, new).
  • Persisted session capability detection during handshake:
    • tracks support for session/list.
    • tracks support for session/load.
  • Updated session initialization flow:
    • if capabilities are present and strategy is not new, attempt session/list then session/load.
    • fallback to session/new on list/load errors or when no session is selected.
  • Added session picker helpers:
    • human-readable session labels (title | updatedAt | sessionId).
    • prompt-based session selection.
    • dedicated sorter that pins ** Start a new session ** to the first position in completion display/cycle ordering.
  • Refactored session setup internals to reduce duplication:
    • extracted helper for state hydration from response.
    • extracted helper for session-init finalization UI updates.

Tests

Added/updated ERT coverage for:

  • list+load preferred path when supported.
  • fallback to session/new when session/list fails.
  • new strategy bypassing list/load.
  • prompt session selection behavior.
  • picker sort behavior keeping ** Start a new session ** first.

Targeted test run for these flows passes.

Docs / Follow-up Included in Branch

This branch also includes small documentation updates:

  • checkdoc/docstring cleanup in agent-shell.el.
  • README variable table entry for agent-shell-session-load-strategy.

Checklist

  • I've read the README's Contributing section.
  • I've filed a feature request/discussion for a new feature.
  • My code follows the project style.
  • I've added tests where applicable.
  • I've updated documentation where necessary.
  • I've run M-x checkdoc and M-x byte-compile-file.
  • I've reviewed all code in PR myself and will vouch for its quality.

@travisjeffery travisjeffery force-pushed the feature/session-picker-new-session-first branch from 83b5b72 to 211254e Compare February 6, 2026 06:58
@xenodium
Copy link
Owner

Sorry for the delay. We have an existing PR for session loading in #248 (cc @farra). I need to spend some time comparing the two approaches to figure out how to move forward. Relatedly, I'm considering a non-comint buffer alternative which may simplify handshake for us (and possibly loading sessions).

I need to play with both implementations quite a bit. It's gonna take me a little while, sorry.

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.

2 participants