Skip to content

Persist History by Connection Identity #27

Description

@adwinying

Parent

#26

What to build

Replace connection-name-filtered recall with a complete per-Connection Identity History path. Preserve the origin of each named Connection during layered config loading, derive one opaque identity for named Connections and direct Connection Strings, carry it through startup and Connection switching, and use it to load and persist the active Session's History.

History must be independent from Audit storage, contain only Statement strings, retain unsuccessful attempts, exclude Slash Commands, deduplicate exact text at the latest position, and cap each identity at 1,000 entries. Persistence failures remain visible but fail open: execution continues and current-session recall remains available.

Acceptance criteria

  • Layered Connection loading preserves whether each effective named Connection came from the global config or a specific project config; a project definition of the same name has project provenance.
  • Named Connection Identity combines canonical config origin and Connection name, keeping global, project, and different-project definitions separate even when their names or database targets match.
  • Direct Connection String Identity is stable for the exact accepted string, uses a domain-separated SHA-256 value, and never persists the raw string.
  • The same opaque Connection Identity is carried through direct startup, Connection Picker selection, and mid-run Connection switching.
  • History loads from and persists to one per-identity JSON array containing only ordered Statement strings, independently of Audit storage.
  • Reopening the same Connection Identity restores its History; switching to another identity replaces the visible recall snapshot with that identity's History.
  • Successful, failed, cancelled, and timed-out submitted Statements enter History.
  • Exact duplicate Statement text moves to the latest position without duplication; whitespace-different text remains distinct.
  • Only the 1,000 most recent unique Statements are retained both in memory and on disk.
  • Slash Commands that open UI or expand editor text never enter History; submitting the expanded Statement later does.
  • A History persistence failure reports an error, does not block Statement execution, and leaves the Statement available in the current Session's in-memory History.
  • A later successful update can persist the bounded in-memory History after an earlier write failure.
  • Connection Frecency remains name-based and unchanged.
  • No live cross-process refresh or inter-process locking is added in this slice; that behavior is covered by a later child issue.
  • Behavioral tests cover config provenance, identity stability and secrecy, startup/switch wiring, recall isolation, deduplication, cap enforcement, Slash Command exclusion, and fail-open recovery.
  • Repository formatting and targeted/full tests pass through mise.

Blocked by

None - can start immediately

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, AFK-ready: an agent can pick it up with no human context

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions