joaomarcos
d63e5d8a10
fix(cache): source-qualify the peer identity and gate the declared bind
...
Both blockers from @andrexibiza's review of 28a2d7f0ee.
1. The generation lookup was not in the same identity domain as recovery.
latest_conversation_boundary() selected on session_key alone, while
_declared_conversation_session() is qualified by (source, session_key).
X-Hermes-Session-Key accepts any authenticated caller-supplied string, so an
API conversation may legally carry the same key as a Telegram row in one
database -- a /new over there rotated this conversation's gwk_ generation
while recovery correctly refused to cross the same line, moving the affinity
identity out from under a physical identity that had not moved.
The boundary read now takes (session_key, source), and the carrier is
'source|key|generation' rather than 'key|generation' -- keying on the string
alone would also collapse two same-key conversations from different sources
onto one routing key, since this value leaves the process verbatim as
OpenRouter's sticky session_id and xAI's x-grok-conv-id. The source comes
from the agent's own session row, falling back to the platform the row will
be created with before it lands.
2. The declared key's stated lower precedence did not survive settlement. Both
handlers let stored_session_id / an explicit body session_id win, then called
_bind_declared_conversation() unconditionally. record_gateway_session_peer()
does SET session_key = ? across compression ancestors, so a request carrying
conversation A's chain plus header key B silently rebound A to B: A could no
longer be recovered by its own key, and B recovered A's session.
Recording is now gated on the declared key having actually selected or
minted the session, on both paths. Behind that gate the bind itself refuses
to overwrite a row already bound to a different key, so a future caller
cannot reintroduce the same defect by opting in wrongly.
test_declaration_outranks_the_lineage_root asserted the pre-qualification
contract by comparing a DB-backed agent against a DB-less one; it now makes the
stronger statement it was written for -- one declared conversation reached
through two different physical ids on the same peer.
Refs #96811
Found in review by @andrexibiza, whose analysis located each of these
defects and specified what a correct fix had to prove.
Co-Authored-By: Andrex Ibiza, MBA <andrexibiza@gmail.com >
2026-09-01 02:14:35 -07:00
..
2026-08-25 01:48:43 +05:30
2026-08-31 10:09:04 -07:00
2026-08-28 07:51:16 -07:00
2026-07-29 13:10:23 -07:00
2026-08-26 10:10:11 -07:00
2026-08-26 10:10:11 -07:00
2026-08-29 18:34:35 -07:00
2026-08-14 21:54:56 -07:00
2026-08-29 18:34:35 -07:00
2026-08-29 18:34:35 -07:00
2026-08-29 18:34:35 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-29 18:34:35 -07:00
2026-07-29 13:10:23 -07:00
2026-08-12 23:47:28 -07:00
2026-08-14 21:27:05 -07:00
2026-08-15 00:34:29 -07:00
2026-08-29 18:34:35 -07:00
2026-08-18 20:34:46 -04:00
2026-08-20 12:29:11 -05:00
2026-08-29 18:34:35 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-23 02:54:30 -07:00
2026-08-31 10:51:19 -07:00
2026-07-29 13:10:23 -07:00
2026-08-31 13:00:24 -07:00
2026-08-31 11:18:53 -07:00
2026-07-04 15:44:50 -07:00
2026-07-29 15:37:24 -07:00
2026-08-13 11:41:59 -07:00
2026-07-15 07:47:18 -07:00
2026-07-29 13:10:23 -07:00
2026-07-01 17:00:30 +05:30
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-31 13:00:33 -07:00
2026-07-29 13:10:23 -07:00
2026-08-03 23:01:03 +05:30
2026-08-24 20:11:18 -07:00
2026-08-13 11:45:27 -07:00
2026-08-02 22:15:20 +05:30
2026-08-11 23:36:47 -05:00
2026-07-29 13:10:23 -07:00
2026-08-31 13:00:24 -07:00
2026-08-02 20:12:50 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-26 10:10:11 -07:00
2026-08-16 10:27:52 -07:00
2026-07-29 13:10:23 -07:00
2026-08-29 11:33:05 +05:30
2026-07-29 13:10:23 -07:00
2026-08-22 19:30:10 -07:00
2026-08-16 01:55:00 -07:00
2026-07-29 13:10:23 -07:00
2026-08-14 21:54:56 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-14 13:56:58 -07:00
2026-07-29 13:10:23 -07:00
2026-07-31 23:16:58 -07:00
2026-08-20 20:20:23 -07:00
2026-08-02 11:52:59 +05:30
2026-08-07 16:57:11 +05:30
2026-07-29 13:10:23 -07:00
2026-06-27 11:43:08 -07:00
2026-07-29 13:10:23 -07:00
2026-08-15 01:04:19 -07:00
2026-07-29 13:10:23 -07:00
2026-08-31 14:02:55 -07:00
2026-08-31 13:00:18 -07:00
2026-08-31 13:00:18 -07:00
2026-08-24 11:25:04 -07:00
2026-07-29 15:37:24 -07:00
2026-08-24 21:46:05 -07:00
2026-08-12 12:42:39 +05:30
2026-08-28 04:58:14 -07:00
2026-08-23 19:02:30 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-24 11:25:04 -07:00
2026-07-29 13:10:23 -07:00
2026-08-15 03:16:21 -07:00
2026-08-23 18:27:07 -07:00
2026-08-26 21:38:20 -07:00
2026-07-22 08:11:40 -07:00
2026-08-31 12:36:02 -07:00
2026-07-29 13:10:23 -07:00
2026-07-23 08:19:14 -07:00
2026-07-29 13:10:23 -07:00
2026-08-09 22:29:39 +05:30
2026-08-23 18:27:07 -07:00
2026-07-29 13:10:23 -07:00
2026-08-30 19:46:21 -07:00
2026-08-30 09:03:57 -07:00
2026-08-28 12:38:49 +05:30
2026-08-31 14:09:42 +05:30
2026-06-21 11:34:47 -07:00
2026-07-29 13:10:23 -07:00
2026-08-02 22:15:20 +05:30
2026-06-25 12:56:05 -07:00
2026-07-29 15:37:24 -07:00
2026-08-07 13:24:56 +05:30
2026-07-29 13:10:23 -07:00
2026-08-30 19:46:21 -07:00
2026-08-31 09:58:11 -07:00
2026-08-26 07:16:04 -07:00
2026-08-31 14:09:42 +05:30
2026-08-28 02:29:27 +05:30
2026-08-30 19:46:21 -07:00
2026-08-31 13:00:33 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-28 06:32:43 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-23 15:03:29 +05:30
2026-07-31 23:16:58 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-31 10:39:55 -07:00
2026-07-31 23:16:58 -07:00
2026-07-29 13:10:23 -07:00
2026-08-31 20:43:00 -05:00
2026-07-29 13:10:23 -07:00
2026-08-23 18:27:07 -07:00
2026-08-26 07:16:04 -07:00
2026-07-29 13:10:23 -07:00
2026-08-14 01:08:13 -07:00
2026-09-01 14:33:23 +05:30
2026-07-29 13:10:23 -07:00
2026-07-23 19:44:35 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-08 05:44:18 -07:00
2026-07-29 21:30:53 -07:00
2026-08-04 11:00:04 +05:30
2026-08-24 04:14:26 +05:30
2026-08-16 06:31:46 -07:00
2026-08-29 18:34:35 -07:00
2026-08-03 19:08:09 +05:30
2026-08-04 11:35:06 -06:00
2026-08-04 13:12:24 +05:30
2026-07-17 13:08:46 -04:00
2026-08-29 18:34:35 -07:00
2026-08-29 18:34:35 -07:00
2026-08-23 20:01:18 -07:00
2026-08-04 13:20:15 +05:30
2026-08-12 23:47:28 -07:00
2026-08-14 21:54:56 -07:00
2026-07-29 13:10:23 -07:00
2026-08-29 18:34:35 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-22 04:20:48 +05:30
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-16 22:06:41 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-31 10:08:13 -07:00
2026-08-03 20:43:38 +05:30
2026-08-23 20:01:18 -07:00
2026-08-14 16:37:36 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-31 10:42:39 -07:00
2026-09-01 02:14:35 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-02 21:48:06 -07:00
2026-08-16 22:06:08 -07:00
2026-08-15 01:04:19 -07:00
2026-08-03 21:53:13 +05:30
2026-07-29 13:10:23 -07:00
2026-08-28 03:46:24 -07:00
2026-08-23 18:43:12 -07:00
2026-08-30 20:40:43 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-13 15:24:47 +05:30
2026-08-28 13:05:06 +05:30
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-28 06:36:22 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-19 14:58:59 +05:30
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-27 21:07:21 +05:30
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-29 02:30:44 -07:00
2026-08-31 13:00:33 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-28 12:15:24 -07:00
2026-08-14 02:04:24 +05:30
2026-07-29 13:10:23 -07:00
2026-08-23 18:25:19 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-30 09:03:57 -07:00
2026-08-08 05:09:43 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-29 12:06:48 +05:30
2026-07-29 13:10:23 -07:00
2026-08-23 13:34:32 +05:30
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-19 22:41:05 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 21:30:53 -07:00
2026-08-13 23:15:25 +05:30
2026-08-24 21:45:30 -07:00
2026-08-13 23:15:25 +05:30
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-06-19 15:23:41 +08:00
2026-08-15 01:04:19 -07:00
2026-08-20 00:03:50 +05:30
2026-08-17 12:58:51 -07:00
2026-08-17 12:58:51 -07:00
2026-08-07 19:44:35 +05:30
2026-08-14 22:04:16 -07:00
2026-07-29 13:10:23 -07:00
2026-08-01 14:27:12 +05:30
2026-07-01 06:02:33 -07:00
2026-08-03 22:43:15 +05:30
2026-07-23 16:17:27 -07:00
2026-08-13 23:10:16 +05:30
2026-08-14 21:36:41 -07:00
2026-07-29 13:10:23 -07:00
2026-07-23 18:40:09 -07:00
2026-07-29 13:10:23 -07:00
2026-07-23 18:40:09 -07:00
2026-08-13 15:24:47 +05:30
2026-08-13 15:24:47 +05:30
2026-08-19 13:56:11 -05:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-24 03:20:57 -07:00
2026-07-29 15:12:28 -07:00
2026-08-31 12:20:02 -07:00
2026-08-12 14:42:00 -04:00
2026-08-14 03:31:22 +05:30
2026-07-29 13:10:23 -07:00
2026-08-30 05:15:46 -07:00
2026-07-29 13:10:23 -07:00
2026-07-09 21:10:07 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-29 05:02:54 -07:00
2026-07-29 15:37:24 -07:00
2026-07-29 07:47:06 +10:00
2026-08-02 15:01:11 -07:00
2026-08-28 23:38:59 -05:00
2026-08-15 00:33:01 -07:00
2026-08-24 20:25:10 -07:00
2026-08-29 19:14:15 -07:00
2026-08-25 12:59:29 -07:00
2026-07-29 13:10:23 -07:00
2026-08-12 18:41:59 -07:00
2026-08-12 16:25:20 -07:00
2026-07-29 13:10:23 -07:00
2026-08-30 01:20:27 -07:00
2026-07-29 13:10:23 -07:00
2026-08-03 22:55:36 +05:30
2026-08-31 09:57:22 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-31 11:18:53 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 15:37:24 -07:00
2026-08-06 02:22:08 +05:30
2026-08-06 02:22:08 +05:30
2026-08-23 17:47:50 -07:00
2026-08-25 12:59:29 -07:00
2026-08-17 14:06:16 -07:00
2026-08-29 06:37:06 -07:00
2026-08-29 11:33:05 +05:30
2026-08-29 11:33:05 +05:30
2026-08-13 15:24:47 +05:30
2026-08-29 12:23:41 +05:30
2026-07-29 13:10:23 -07:00
2026-08-26 10:10:11 -07:00
2026-07-29 13:10:23 -07:00
2026-08-08 23:14:30 -07:00
2026-07-29 13:10:23 -07:00
2026-07-10 05:41:59 -05:00
2026-08-19 22:56:04 -07:00
2026-08-19 16:04:22 -07:00
2026-08-27 03:24:20 -07:00
2026-08-06 22:02:37 -05:00
2026-09-01 00:25:45 +05:30
2026-08-22 16:47:39 +02:00
2026-08-05 22:40:51 -07:00
2026-08-19 22:11:13 -04:00
2026-08-13 12:23:36 -07:00
2026-08-19 08:52:03 -07:00
2026-08-19 08:52:03 -07:00
2026-08-15 00:33:01 -07:00
2026-08-19 09:14:12 -07:00
2026-08-19 08:52:01 -07:00
2026-08-16 01:55:51 -07:00
2026-08-08 17:42:34 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-07 19:44:35 +05:30
2026-08-23 19:04:37 -07:00
2026-07-21 12:11:31 +05:30
2026-08-19 16:32:17 -07:00
2026-07-29 13:10:23 -07:00
2026-08-20 11:36:54 +05:30
2026-07-29 13:10:23 -07:00
2026-08-23 20:00:30 -07:00
2026-08-21 13:21:46 +10:00
2026-08-07 16:57:11 +05:30
2026-08-16 11:32:02 -07:00
2026-08-02 16:16:36 -07:00
2026-08-23 13:34:32 +05:30
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-12 19:44:04 -07:00
2026-08-15 23:03:52 -07:00
2026-08-29 08:23:47 -07:00
2026-07-31 07:30:30 -07:00
2026-07-29 13:10:23 -07:00
2026-08-30 01:24:14 -07:00
2026-07-29 13:10:23 -07:00
2026-08-30 04:53:39 -07:00
2026-08-29 20:39:04 -07:00
2026-08-16 06:24:56 -07:00
2026-08-29 02:30:44 -07:00
2026-08-08 00:07:14 +05:30
2026-08-21 13:24:43 +05:30
2026-08-14 14:15:42 -07:00
2026-08-08 15:10:24 +05:30
2026-07-29 13:10:23 -07:00
2026-08-08 14:09:41 -07:00
2026-08-25 02:45:10 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-18 20:34:46 -04:00
2026-08-23 18:25:19 -07:00
2026-07-29 13:10:23 -07:00
2026-08-27 16:13:45 +05:30
2026-07-29 13:10:23 -07:00
2026-08-16 22:07:43 -07:00
2026-07-29 10:14:11 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-07 19:44:35 +05:30
2026-07-29 13:10:23 -07:00
2026-07-30 21:07:36 +05:30
2026-08-08 12:31:19 -07:00
2026-08-29 19:13:00 -07:00
2026-07-28 03:54:16 -05:00
2026-08-29 11:33:05 +05:30
2026-08-31 10:10:25 -07:00
2026-08-24 20:10:44 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-15 00:33:01 -07:00
2026-08-16 22:10:02 -07:00
2026-07-29 13:10:23 -07:00
2026-08-23 18:24:43 -07:00
2026-07-20 13:04:12 -07:00
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-14 21:41:26 -07:00
2026-07-29 13:10:23 -07:00
2026-08-25 01:34:56 +05:30
2026-07-29 13:10:23 -07:00
2026-07-29 13:10:23 -07:00
2026-08-31 11:18:53 -07:00
2026-07-29 13:10:23 -07:00
2026-08-29 11:33:05 +05:30
2026-07-29 13:10:23 -07:00
2026-08-16 01:56:18 -07:00
2026-09-01 03:19:59 +05:30
2026-07-29 13:10:23 -07:00
2026-08-28 03:46:24 -07:00
2026-07-29 13:10:23 -07:00
2026-08-20 12:35:20 +05:30
2026-07-29 13:10:23 -07:00
2026-07-16 04:23:12 -07:00
2026-08-28 07:51:31 -07:00
2026-08-24 03:23:07 -07:00
2026-07-24 15:55:08 -07:00
2026-08-16 00:14:58 -07:00
2026-08-03 20:43:38 +05:30
2026-08-12 01:15:25 -07:00
2026-06-30 00:59:29 -05:00
2026-08-29 12:33:44 +05:30
2026-07-29 13:10:23 -07:00
2026-07-29 18:55:10 -07:00
2026-08-22 16:07:12 +05:30