fix(state): add immutable created_source provenance column (#56439)

Gateway /resume rewrites sessions.source to the resuming platform, which is
correct routing behavior (source feeds find_latest_gateway_session_for_peer,
Telegram listings, and the TUI ghost pruner) but destroys creation
provenance. Add a separate immutable created_source column stamped once at
session creation and preserved by all upsert paths; surface it in
hermes sessions list as '<created>→<current>' when the two diverge.

Fixes #56439
This commit is contained in:
Austin Pickett
2026-09-25 13:56:49 -04:00
parent 41cd3117ae
commit f81bb4c485
6 changed files with 45 additions and 11 deletions

View File

@@ -362,6 +362,7 @@ CREATE TABLE IF NOT EXISTS system_prompts (
CREATE TABLE IF NOT EXISTS sessions (
id TEXT PRIMARY KEY,
source TEXT NOT NULL,
created_source TEXT,
user_id TEXT,
session_key TEXT,
chat_id TEXT,