14a5e56f6f
Move gateway routing metadata (session_key, platform, chat_type, origin, display_name, memory_flushed) from sessions.json into the sessions table in state.db. This eliminates the dual-file dependency that caused the mcp_serve polling bug (#8925) and makes state.db the single source of truth for session discovery. Changes: - Schema v7 migration: add 6 new columns to sessions table with backfill from existing sessions.json during migration - New SessionDB methods: set_gateway_metadata(), list_gateway_sessions(), find_session_by_origin(), set_memory_flushed() - Gateway session.py: write routing metadata to state.db on every session create/reset/switch - Rewire all consumers (mcp_serve, mirror, channel_directory, status) to query state.db first with sessions.json fallback for pre-migration databases - mcp_serve _poll_once: simplified to watch only state.db mtime (fixes the split-mtime bug from #8925 as a side effect) sessions.json continues to be written by the gateway for now but is no longer read as the primary source by any consumer. Can be made optional in a future PR.