Skip to content

th-d5b446: Python server list_conversations + resume-by-conversationId#209

Merged
brentrager merged 1 commit into
mainfrom
th-d5b446-python-list-conversations
Jul 9, 2026
Merged

th-d5b446: Python server list_conversations + resume-by-conversationId#209
brentrager merged 1 commit into
mainfrom
th-d5b446-python-list-conversations

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Problem

The merged Rust (reference), Go (#205), and TS (#206) smooth-operator servers all speak list_conversations + resume-by-conversationId — the conversation-sidebar / resume substrate every client (daemon PWA, th code TUI, chat-widget) builds against. The Python server (python/server) didn't. Pearl th-d5b446.

Solution

Python parity, matching the merged contract byte-for-byte at the wire level.

  • New WS action list_conversations ({action, requestId, limit?}, default limit 50): replies via immediate_response (200, "Conversations") with { conversations: [ { conversationId, title, updatedAt, messageCount } ] } — most-recent-first, filtered to messageCount > 0 (drops the empty conversations every page-load mints). title = ~60-char preview of the first inbound (user) message with leading markdown/control chars stripped, name fallback; updatedAt = ISO-8601.
  • create_conversation_session gains optional conversationId: a known id resumes (reuse the conversation id + its persisted message log, so send_message appends and the runner replays history); absent/unknown mints fresh — unchanged behavior.
  • SessionStore gains list_conversations() + an optional conversation_id arg on create_session; InMemorySessionStore tracks per-conversation last-activity for the sort key.

Additive + back-compat: no conversationId / no list_conversations call = unchanged behavior.

Verification

  • 16 new tests (test_list_conversations_resume.py): title strip/fallback/truncate, list filter/sort/limit, resume binds + preserves history, unknown/absent id mints fresh — both at the store and through the real FrameDispatcher.
  • uv run pytest154 passed. ruff format + ruff check clean.

Pearl th-d5b446.

🤖 Generated with Claude Code

Mirror the merged Rust/Go/TS reference (pearl th-d5b446) on the Python
smooth-operator-server — the conversation-sidebar / resume substrate every
client builds against.

- New WS action `list_conversations`: most-recent-first, only conversations
  with messageCount > 0, each with a first-inbound title preview (~60 chars,
  leading markdown/control stripped, name fallback), ISO-8601 updatedAt, and
  messageCount. Optional limit (default 50).
- `create_conversation_session` gains optional `conversationId`: a known id
  resumes (reuse id + persisted log so send_message appends and history
  replays); absent/unknown mints fresh (unchanged).

Additive + back-compat. SessionStore gains list_conversations() + optional
conversation_id on create_session; in-memory store tracks per-conversation
last-activity for the sort key. 16 new tests; full suite green (154).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 008b532

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@smooai/smooth-operator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brentrager brentrager merged commit b367240 into main Jul 9, 2026
2 checks passed
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