Mathias Fredriksson
c51ffc7c88
fix(coderd/x/chatd/chatprompt): keep NUL out of jsonb chat content ( #28625 )
...
PostgreSQL jsonb rejects \u0000, so persisting Gemini responses failed
with "pq: unsupported Unicode escape sequence": binary thought
signatures reach ProviderMetadata as strings containing NUL, and the
sentinel codec only covered six fields. Real recorded Gemini
signatures contain NUL in 22 of 34 cases.
Classify every string-bearing part field in one table, partNulFields.
Free-form and opaque fields encode NUL reversibly as PUA sentinel
pairs; structured fields (identifiers, paths, URLs) reject it with an
error naming the part, field, and offset, since their consumers cannot
handle NUL anyway. Raw JSON is also normalized for lone surrogate
escapes, which jsonb equally rejects.
A reflection-driven test injects NUL into every field and fails when a
future field is missing from the table. The Gemini regression asserts
the sentinel-encoded row in the database and a byte-exact signature
round-trip.
Known limits: json.Marshal corrupts other invalid UTF-8 upstream of
this codec (CODAGT-986), and chat debug steps have always dropped
silently on NUL prompt text (CODAGT-987, pre-existing).
Fixes coder/coder#25555
Fixes CODAGT-463
2026-08-26 18:21:13 +03:00
..
2026-07-14 13:50:25 +01:00
2026-08-20 20:54:52 +00:00
2026-08-11 11:20:05 +02:00
2026-08-24 17:09:00 +02:00
2026-08-05 22:41:17 +02:00
2026-08-25 16:40:41 +07:00
2026-08-04 08:00:19 +00:00
2026-08-26 18:21:13 +03:00
2026-08-24 13:27:22 +01:00
2026-06-16 12:35:40 +00:00
2026-06-16 12:35:40 +00:00
2026-08-25 09:08:52 -04:00
2026-08-12 12:52:22 +02:00
2026-08-25 11:39:43 +02:00
2026-07-02 11:22:56 +01:00
2026-08-25 09:43:55 +00:00
2026-08-25 16:57:27 +07:00
2026-07-29 11:39:12 +00:00
2026-06-12 13:33:12 +02:00
2026-06-12 13:33:12 +02:00
2026-08-24 11:20:26 +01:00
2026-08-18 16:55:43 +02:00
2026-08-18 16:55:43 +02:00
2026-08-18 16:55:43 +02:00
2026-08-26 16:17:06 +02:00
2026-05-22 20:24:38 +10:00
2026-05-18 12:30:30 -04:00
2026-08-25 16:40:41 +07:00
2026-07-06 16:37:45 +00:00
2026-07-06 16:37:45 +00:00
2026-08-18 16:55:43 +02:00
2026-08-20 20:54:52 +00:00
2026-08-24 09:30:01 +00:00
2026-08-25 06:52:45 -04:00
2026-08-25 11:35:53 +02:00
2026-08-25 16:40:41 +07:00
2026-08-25 06:52:45 -04:00
2026-05-08 02:07:33 +10:00
2026-07-20 19:49:19 +02:00
2026-07-29 11:39:12 +00:00
2026-08-24 11:20:26 +01:00
2026-08-24 11:20:26 +01:00
2026-08-04 08:00:19 +00:00
2026-08-04 08:00:19 +00:00
2026-08-20 20:54:52 +00:00
2026-08-24 11:20:26 +01:00
2026-08-24 11:20:26 +01:00
2026-07-18 21:52:02 +02:00
2026-07-18 21:52:02 +02:00
2026-06-30 12:17:42 +01:00
2026-08-20 15:56:58 +02:00
2026-08-19 08:51:25 -05:00
2026-08-24 15:36:32 -07:00
2026-07-29 11:39:12 +00:00
2026-06-11 16:08:32 +10:00
2026-06-11 16:08:32 +10:00
2026-05-20 01:37:38 +02:00
2026-08-26 13:33:13 +02:00
2026-07-29 11:39:12 +00:00
2026-08-24 09:30:01 +00:00
2026-08-24 11:20:25 +01:00
2026-06-17 10:20:47 +00:00
2026-08-25 16:57:27 +07:00
2026-08-24 09:30:01 +00:00
2026-07-29 11:39:12 +00:00
2026-08-05 22:41:17 +02:00
2026-08-11 13:53:15 +02:00
2026-06-26 13:41:43 +03:00
2026-06-22 19:26:34 -06:00
2026-07-18 20:45:13 +02:00
2026-08-24 11:20:25 +01:00
2026-06-16 12:35:40 +00:00
2026-07-20 00:14:03 +02:00
2026-08-18 19:12:47 +02:00
2026-08-18 19:12:47 +02:00
2026-08-25 16:40:41 +07:00
2026-08-25 16:40:41 +07:00
2026-08-24 13:27:22 +01:00
2026-08-20 20:54:52 +00:00
2026-08-20 20:54:52 +00:00
2026-08-24 11:20:25 +01:00
2026-08-20 20:54:52 +00:00
2026-08-18 16:55:43 +02:00
2026-07-29 11:39:12 +00:00
2026-07-29 11:39:12 +00:00
2026-06-26 13:41:43 +03:00
2026-06-29 11:49:10 +01:00
2026-08-24 11:20:25 +01:00
2026-08-25 17:56:30 +00:00
2026-08-25 17:56:30 +00:00
2026-07-13 20:28:28 +02:00
2026-06-12 13:33:12 +02:00
2026-07-29 11:39:12 +00:00
2026-07-29 11:39:12 +00:00
2026-07-29 11:39:12 +00:00
2026-08-11 13:53:15 +02:00
2026-08-11 13:53:15 +02:00
2026-06-12 13:33:12 +02:00
2026-06-12 13:33:12 +02:00
2026-06-12 13:33:12 +02:00
2026-06-16 12:35:40 +00:00
2026-06-18 08:28:17 +00:00
2026-06-12 13:33:12 +02:00
2026-06-12 13:33:12 +02:00
2026-06-12 13:33:12 +02:00
2026-06-12 13:33:12 +02:00
2026-06-12 13:33:12 +02:00
2026-06-12 13:33:12 +02:00
2026-08-25 16:40:41 +07:00
2026-07-18 20:45:13 +02:00
2026-08-25 16:40:41 +07:00
2026-07-18 20:45:13 +02:00
2026-08-24 11:20:26 +01:00
2026-07-27 10:05:05 +01:00
2026-07-20 19:49:19 +02:00
2026-07-18 20:45:13 +02:00
2026-08-25 17:29:57 +07:00
2026-08-25 17:29:57 +07:00
2026-06-17 18:29:43 +02:00
2026-08-24 11:20:26 +01:00
2026-08-24 11:20:26 +01:00
2026-08-25 16:57:27 +07:00
2026-08-25 16:57:27 +07:00
2026-08-24 09:30:01 +00:00
2026-08-18 16:55:43 +02:00
2026-08-18 16:55:43 +02:00