xielevi
4ba717df12
fix(profiles): migrate session/routing identity on profile rename
...
Renaming a profile moved profiles/<old>/ to profiles/<new>/, so the row DATA
travelled with the directory, but the profile name is also baked into
keys/values the move left untouched: session keys (agent:<old>:* namespace),
sessions.profile_name (fail-closed owner ladder / Desktop sidebar scope /
@session: deep links), sessions.origin_json.profile,
gateway_heartbeats.profile, delivery_obligations (session_key +
adapter_profile), telegram_dm_topic_* profile_name bindings, and the
gateway_routing index. Left stale, every inbound event on a chat keyed to the
old name resolved to a profile that no longer exists — flooding errors.log
with "Profile <old> does not exist ... falling back to global HERMES_HOME"
every few seconds — and renamed sessions dropped out of the sidebar / broke
their deep links.
The routing index is held in memory by a live multiplexer and written back
periodically, so a CLI-side DB rewrite alone is clobbered. Fix in layers:
- SessionDB.rekey_profile_state: atomic durable rewrite of the state.db
tables, matching the agent:<name>: namespace by exact prefix (substr, not
LIKE — '_' is a legal profile-name character and a LIKE wildcard), rewriting
the profile inside routing/origin JSON, and REFUSING on a target collision
(routing rows or telegram bindings) instead of silently merging.
- SessionStore.rekey_profile_routing: rekey the in-memory routing index
(keys + origin.profile) then persist — the half a DB write cannot reach.
Raises on a target-key collision before mutating.
- Control verb migrate-profile-identity (params-carrying; the socket passes
params only to handlers that declare them, bare handlers unchanged) so a
live gateway rekeys its in-memory copy AND both durable stores (routing home
+ the renamed profile's own state.db).
- rename_profile calls the verb when a multiplexer is live and, if it fails,
does NOT fall back to a racing CLI-side write: it prints a warning telling
the operator to restart the gateway and retry. With no live gateway it
performs the durable rewrite itself (safe: nothing else holds the store
open).
Checkpoints keyed by the profile's workdir path are a known related gap,
tracked separately, not addressed here.
Tests: rekey_profile_state (all tables, routing/origin JSON, collisions,
idempotent, no-op), rekey_profile_routing (namespace + origin, no-op, no
overwrite), control verb param passing, and rename end-to-end for both the
live-gateway (delegates, refuses unsafe fallback) and no-gateway (durable
rewrite) paths.
2026-09-16 00:32:15 -07:00
..
2026-09-13 09:40:44 -07:00
2026-09-15 05:32:58 -07:00
2026-09-15 21:46:37 -07:00
2026-09-03 03:31:03 -07:00
2026-09-15 19:28:39 -07:00
2026-09-15 18:54:51 -07:00
2026-09-14 09:02:28 -07:00
2026-09-15 04:11:11 -07:00
2026-09-03 15:07:39 -07:00
2026-09-15 04:12:13 -07:00
2026-09-03 15:07:39 -07:00
2026-09-03 02:46:19 -07:00
2026-09-07 06:13:16 -07:00
2026-09-15 04:11:11 -07:00
2026-09-15 04:12:13 -07:00
2026-09-15 03:58:44 -07:00
2026-09-15 03:58:44 -07:00
2026-09-02 21:00:34 -07:00
2026-09-15 18:28:49 -07:00
2026-09-15 20:44:42 +05:30
2026-09-11 03:45:33 +05:30
2026-09-15 20:44:42 +05:30
2026-09-03 13:49:57 -07:00
2026-09-02 20:56:23 -07:00
2026-09-15 04:57:29 -07:00
2026-09-05 18:08:00 +05:30
2026-09-02 22:51:30 -07:00
2026-09-15 04:53:38 -07:00
2026-09-15 04:12:13 -07:00
2026-09-15 20:44:42 +05:30
2026-09-15 04:12:13 -07:00
2026-09-15 04:12:13 -07:00
2026-09-03 13:08:40 -07:00
2026-09-03 13:48:49 -07:00
2026-09-15 20:44:42 +05:30
2026-09-15 06:29:50 -07:00
2026-09-12 22:07:41 -07:00
2026-09-15 03:38:29 -07:00
2026-09-12 22:07:41 -07:00
2026-09-03 13:08:40 -07:00
2026-09-02 21:59:38 -07:00
2026-09-15 06:29:50 -07:00
2026-09-02 20:34:28 -07:00
2026-09-15 18:26:38 -07:00
2026-09-03 02:07:33 -07:00
2026-09-15 19:06:54 -07:00
2026-09-02 21:26:16 -07:00
2026-09-15 06:16:38 -07:00
2026-09-02 23:58:31 -07:00
2026-09-02 23:58:31 -07:00
2026-09-08 03:06:30 -07:00
2026-09-15 18:24:22 -07:00
2026-09-12 08:25:54 -07:00
2026-09-15 04:12:13 -07:00
2026-09-12 08:25:54 -07:00
2026-09-15 04:12:13 -07:00
2026-09-15 19:28:32 -07:00
2026-09-15 04:12:13 -07:00
2026-09-15 06:29:50 -07:00
2026-09-15 04:12:13 -07:00
2026-09-15 14:52:26 +05:30
2026-09-13 20:54:50 -07:00
2026-09-15 18:25:46 -07:00
2026-09-13 14:35:32 -07:00
2026-09-13 05:21:02 -07:00
2026-09-12 22:00:02 -07:00
2026-09-13 14:35:32 -07:00
2026-09-08 13:39:17 -07:00
2026-09-15 04:08:53 -07:00
2026-09-15 20:47:06 +05:30
2026-09-15 04:12:13 -07:00
2026-09-03 13:30:31 -07:00
2026-09-02 23:58:31 -07:00
2026-09-13 20:50:10 -07:00
2026-09-15 19:05:29 -07:00
2026-09-15 19:05:29 -07:00
2026-09-15 06:29:50 -07:00
2026-09-12 08:25:36 -07:00
2026-09-13 20:41:41 -07:00
2026-09-03 00:06:54 -07:00
2026-09-12 16:17:04 -07:00
2026-09-15 10:57:16 -07:00
2026-09-15 06:29:50 -07:00
2026-09-15 21:47:48 -07:00
2026-09-15 05:25:39 -07:00
2026-09-15 00:41:13 +05:30
2026-09-10 01:08:18 -07:00
2026-09-15 21:47:48 -07:00
2026-09-14 08:10:36 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 20:47:14 -07:00
2026-09-13 05:07:11 -07:00
2026-09-13 05:09:06 -07:00
2026-09-15 04:12:13 -07:00
2026-09-15 05:38:31 -07:00
2026-09-05 16:45:59 +05:30
2026-09-15 18:29:16 -07:00
2026-09-03 00:04:40 -07:00
2026-09-13 05:07:11 -07:00
2026-09-13 09:18:02 -07:00
2026-09-03 14:16:54 -07:00
2026-09-10 01:25:45 -07:00
2026-09-03 00:06:30 -07:00
2026-09-04 00:15:16 -07:00
2026-09-15 04:12:13 -07:00
2026-09-03 13:16:47 -07:00
2026-09-13 05:09:06 -07:00
2026-09-15 18:28:26 -07:00
2026-09-03 00:05:41 -07:00
2026-09-15 12:06:08 -07:00
2026-09-15 04:12:13 -07:00
2026-09-15 12:06:08 -07:00
2026-09-04 07:17:00 -07:00
2026-09-15 04:12:13 -07:00
2026-09-06 05:41:46 -07:00
2026-09-13 20:51:06 -07:00
2026-09-03 17:13:22 -07:00
2026-09-12 21:39:10 -07:00
2026-09-14 08:10:36 -07:00
2026-09-15 20:44:42 +05:30
2026-09-15 04:12:13 -07:00
2026-09-02 20:40:51 -07:00
2026-09-14 16:16:06 -07:00
2026-09-14 16:16:06 -07:00
2026-09-15 03:44:36 -07:00
2026-09-15 04:07:13 -07:00
2026-09-15 04:13:44 -07:00
2026-09-15 18:30:05 -07:00
2026-09-10 01:00:19 -07:00
2026-09-12 15:00:37 +05:30
2026-09-07 00:51:41 -07:00
2026-09-15 03:59:50 -07:00
2026-09-03 00:06:30 -07:00
2026-09-06 07:20:24 -07:00
2026-09-02 20:06:17 -07:00
2026-09-03 00:06:30 -07:00
2026-09-02 21:20:42 -07:00
2026-09-03 00:06:30 -07:00
2026-09-13 05:07:11 -07:00
2026-09-11 03:45:32 +05:30
2026-09-03 17:13:22 -07:00
2026-09-03 13:48:14 -07:00
2026-09-15 18:35:32 -07:00
2026-09-15 22:47:03 -07:00
2026-09-07 14:16:57 -07:00
2026-09-14 16:14:33 -07:00
2026-09-03 13:48:14 -07:00
2026-09-15 18:35:32 -07:00
2026-09-13 05:09:06 -07:00
2026-09-03 17:13:22 -07:00
2026-09-15 18:35:32 -07:00
2026-09-07 04:46:54 -07:00
2026-09-15 18:34:40 -07:00
2026-09-07 04:46:54 -07:00
2026-09-07 04:46:54 -07:00
2026-09-15 18:33:43 -07:00
2026-09-09 12:18:58 -07:00
2026-09-03 13:48:14 -07:00
2026-09-15 18:34:40 -07:00
2026-09-02 20:12:36 -07:00
2026-09-15 18:29:37 -07:00
2026-09-02 20:15:37 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 09:44:26 -07:00
2026-09-15 04:12:13 -07:00
2026-09-15 18:28:26 -07:00
2026-09-15 04:12:13 -07:00
2026-09-15 18:29:37 -07:00
2026-09-15 18:35:59 -07:00
2026-09-12 08:25:54 -07:00
2026-09-13 16:43:50 -07:00
2026-09-15 04:12:13 -07:00
2026-09-03 15:07:39 -07:00
2026-09-15 19:04:00 -07:00
2026-09-15 06:29:50 -07:00
2026-09-15 18:55:47 -07:00
2026-09-12 08:34:43 -07:00
2026-09-15 04:12:13 -07:00
2026-09-04 00:15:16 -07:00
2026-09-03 17:13:22 -07:00
2026-09-15 19:06:54 -07:00
2026-09-02 21:44:59 -07:00
2026-09-02 20:50:08 -07:00
2026-09-15 03:38:29 -07:00
2026-09-03 17:13:22 -07:00
2026-09-02 21:44:59 -07:00
2026-09-03 09:44:26 -07:00
2026-09-15 05:34:29 -07:00
2026-09-13 05:07:11 -07:00
2026-09-02 20:51:30 -07:00
2026-09-03 03:31:03 -07:00
2026-09-10 04:22:38 -07:00
2026-09-02 20:51:30 -07:00
2026-09-13 20:54:50 -07:00
2026-09-02 21:54:56 -07:00
2026-09-02 21:54:56 -07:00
2026-09-15 04:12:13 -07:00
2026-09-15 03:39:45 -07:00
2026-09-13 16:43:50 -07:00
2026-09-15 03:46:29 -07:00
2026-09-15 06:29:50 -07:00
2026-09-15 18:23:29 -07:00
2026-09-10 09:11:00 -07:00
2026-09-07 08:08:04 -07:00
2026-09-03 13:48:49 -07:00
2026-09-12 01:35:05 -07:00
2026-09-12 01:35:05 -07:00
2026-09-15 18:58:02 -07:00
2026-09-15 18:23:29 -07:00
2026-09-14 22:01:32 +00:00
2026-09-11 03:45:31 +05:30
2026-09-10 18:11:25 -07:00
2026-09-04 07:17:00 -07:00
2026-09-03 09:44:26 -07:00
2026-09-04 00:15:16 -07:00
2026-09-14 08:10:36 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 20:40:15 -07:00
2026-09-12 08:24:26 -07:00
2026-09-02 20:40:15 -07:00
2026-09-03 17:13:22 -07:00
2026-09-02 20:19:57 -07:00
2026-09-02 21:57:39 -07:00
2026-09-14 21:00:29 -07:00
2026-09-15 15:11:33 -07:00
2026-09-03 14:00:59 -07:00
2026-09-09 04:38:01 -07:00
2026-09-15 18:39:54 -07:00
2026-09-14 21:00:29 -07:00
2026-09-15 21:47:18 -07:00
2026-09-15 18:48:59 -07:00
2026-09-15 10:48:49 +05:30
2026-09-15 10:48:49 +05:30
2026-09-09 04:38:01 -07:00
2026-09-09 04:38:01 -07:00
2026-09-03 09:44:26 -07:00
2026-09-15 04:12:13 -07:00
2026-09-11 03:45:31 +05:30
2026-09-12 08:27:53 -07:00
2026-09-13 14:33:11 -07:00
2026-09-15 06:22:15 -07:00
2026-09-06 05:34:01 -07:00
2026-09-15 06:22:15 -07:00
2026-09-16 00:32:15 -07:00
2026-09-03 00:06:57 -07:00
2026-09-13 05:08:29 -07:00
2026-09-02 21:07:16 -07:00
2026-09-02 21:07:16 -07:00
2026-09-02 22:55:15 -07:00
2026-09-10 14:56:55 -04:00
2026-09-13 05:07:50 -07:00
2026-09-13 05:07:11 -07:00
2026-09-07 02:09:34 -07:00
2026-09-04 20:24:24 -04:00
2026-09-15 06:36:19 -07:00
2026-09-14 21:18:47 +05:30
2026-09-14 19:49:12 +05:30
2026-09-02 20:47:24 -07:00
2026-09-15 03:44:36 -07:00
2026-09-02 21:00:55 -07:00
2026-09-02 22:39:49 -07:00
2026-09-13 05:07:50 -07:00
2026-09-13 05:07:50 -07:00
2026-09-15 18:19:50 -07:00
2026-09-02 22:25:24 -07:00
2026-09-03 14:00:59 -07:00
2026-09-15 04:12:13 -07:00
2026-09-02 21:07:16 -07:00
2026-09-02 21:07:16 -07:00
2026-09-15 03:46:29 -07:00
2026-09-15 18:30:05 -07:00
2026-09-11 06:24:54 -07:00
2026-09-11 06:24:54 -07:00
2026-09-11 06:24:54 -07:00
2026-09-11 06:24:54 -07:00
2026-09-03 00:06:57 -07:00
2026-09-13 05:21:02 -07:00
2026-09-02 23:59:27 -07:00
2026-09-11 06:37:27 -07:00
2026-09-09 13:30:28 -07:00
2026-09-11 06:24:54 -07:00
2026-09-15 18:25:46 -07:00
2026-09-02 22:39:06 -07:00
2026-09-03 13:33:10 -07:00
2026-09-13 05:32:38 -07:00
2026-09-15 04:12:13 -07:00
2026-09-04 07:17:00 -07:00
2026-09-03 13:33:10 -07:00
2026-09-03 13:33:10 -07:00
2026-09-12 08:25:54 -07:00
2026-09-15 04:12:13 -07:00
2026-09-07 22:25:12 -07:00
2026-09-02 20:43:25 -07:00
2026-09-03 13:08:40 -07:00
2026-09-15 04:12:13 -07:00
2026-09-03 09:44:26 -07:00
2026-09-12 08:25:54 -07:00
2026-09-03 17:13:22 -07:00
2026-09-02 23:04:20 -07:00
2026-09-02 20:59:41 -07:00
2026-09-03 17:13:22 -07:00
2026-09-13 05:08:29 -07:00
2026-09-11 03:45:31 +05:30
2026-09-12 21:47:53 -07:00
2026-09-13 05:21:02 -07:00
2026-09-14 08:10:36 -07:00
2026-09-02 20:43:25 -07:00
2026-09-02 21:36:24 -07:00
2026-09-15 03:53:13 -07:00
2026-09-02 21:34:25 -07:00
2026-09-15 18:55:47 -07:00
2026-09-14 08:10:36 -07:00
2026-09-15 14:52:26 +05:30
2026-09-11 06:24:54 -07:00
2026-09-02 20:43:25 -07:00
2026-09-08 19:52:26 +05:30
2026-09-15 04:12:13 -07:00
2026-09-03 13:22:51 -07:00
2026-09-12 08:34:43 -07:00
2026-09-03 14:16:54 -07:00
2026-09-03 13:10:38 -07:00
2026-09-13 05:07:50 -07:00
2026-09-02 20:38:18 -07:00
2026-09-02 21:31:17 -07:00
2026-09-12 08:25:54 -07:00
2026-09-15 18:30:32 -07:00
2026-09-02 16:34:55 -07:00
2026-09-15 21:57:59 +05:30
2026-09-15 04:11:11 -07:00
2026-09-13 05:08:20 -07:00
2026-09-15 19:28:39 -07:00
2026-09-03 09:44:26 -07:00
2026-09-15 12:06:08 -07:00
2026-09-03 09:44:26 -07:00
2026-09-15 04:13:44 -07:00
2026-09-03 09:44:26 -07:00
2026-09-15 19:28:39 -07:00
2026-09-02 21:49:26 -07:00
2026-09-15 18:30:32 -07:00
2026-09-15 04:12:13 -07:00
2026-09-15 04:12:13 -07:00
2026-09-02 22:12:58 -07:00
2026-09-02 21:28:23 -07:00
2026-09-10 11:48:01 -07:00
2026-09-02 21:28:23 -07:00
2026-09-02 21:28:23 -07:00
2026-09-03 13:20:22 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 09:44:26 -07:00
2026-09-13 19:19:32 -07:00
2026-09-09 21:16:40 +05:30
2026-09-04 20:24:24 -04:00
2026-09-15 03:40:26 -07:00
2026-09-13 05:07:50 -07:00
2026-09-15 18:48:59 -07:00
2026-09-07 07:11:36 -07:00
2026-09-15 04:37:41 -07:00
2026-09-11 15:28:37 -07:00
2026-09-14 08:10:36 -07:00
2026-09-03 14:21:32 -07:00
2026-09-03 14:21:32 -07:00
2026-09-12 18:35:21 -07:00
2026-09-15 20:44:42 +05:30
2026-09-15 03:46:29 -07:00
2026-09-11 06:37:27 -07:00
2026-09-15 18:54:28 -07:00
2026-09-13 21:30:02 -07:00
2026-09-04 20:24:24 -04:00
2026-09-02 23:08:44 -07:00
2026-09-13 20:55:29 -07:00
2026-09-15 18:27:06 -07:00
2026-09-15 18:27:06 -07:00
2026-09-02 21:54:36 -07:00
2026-09-09 02:36:00 -07:00