Xore
1c19e2c034
fix(compression): place output-style instruction in top-level system, not messages[0] ( #13383 )
...
* fix(compression): place output-style instruction in top-level system, not messages[0]
Anthropic-shaped bodies reject a synthetic system-role entry unshifted at
messages[0] (the claude passthrough forwards messages unchanged, and the
upstream API requires system content in the top-level system parameter).
Output styles and the caveman output mode now land their instruction in
the top-level system field when it exists (string or content-block array)
and only fall back to a trailing system message for OpenAI-shaped bodies,
which the claude system-role extraction hoists. Custom endpoint system
prompts skip the unshift whenever a top-level system field is present.
All compression options stay enabled; placement-only fix.
Fixes #12584
* test(compression): cover system-instruction placement branches 4 and 6
Adds direct unit cases for the placement ladder branches that had no
coverage, asserting where the instruction lands:
- branch 4: merge into a system message at index >= 1, leaving
messages[0] untouched (plus the skip-over-a-block-content system
message variant).
- branch 6: trailing append when the body has neither a `system` field
nor a string-content system message.
- block-array `system`: appends one block and is idempotent on a second
pass (first coverage of the array path of the marker check).
Also normalizes a malformed non-string/non-array top-level `system`
(e.g. `null`) to "" before the format branch in injectSystemPrompt and
injectCustomSystemPrompt. Previously such a body entered the `system`
branch, matched neither format, and silently dropped the prompt without
falling back to the messages path. Both new guards fail without this
change.
* chore(compression): add changelog fragment for top-level system placement
2026-09-18 11:31:27 -03:00
..
2026-06-22 03:17:02 -03:00
2026-08-29 01:17:40 -03:00
2026-06-23 17:06:18 -03:00
2026-06-23 17:06:18 -03:00
2026-08-29 01:17:40 -03:00
2026-06-23 17:06:18 -03:00
2026-06-23 17:06:18 -03:00
2026-08-11 09:20:41 -03:00
2026-06-20 07:09:43 -03:00
2026-09-10 18:12:45 -03:00
2026-06-19 06:49:01 -03:00
2026-06-30 06:54:29 -03:00
2026-06-15 03:32:11 -03:00
2026-08-11 04:25:55 -03:00
2026-07-02 10:47:13 -03:00
2026-07-20 17:53:04 -03:00
2026-08-29 01:17:40 -03:00
2026-06-09 22:57:12 -03:00
2026-08-19 13:00:27 -03:00
2026-08-23 10:20:06 -03:00
2026-08-06 05:58:58 -03:00
2026-08-23 10:20:06 -03:00
2026-08-19 12:11:11 -03:00
2026-07-21 11:50:02 -03:00
2026-08-22 22:53:26 -03:00
2026-08-22 22:53:26 -03:00
2026-08-23 10:20:06 -03:00
2026-06-28 06:58:29 -03:00
2026-06-28 06:58:29 -03:00
2026-07-17 02:39:40 -03:00
2026-07-22 07:03:02 -03:00
2026-07-10 18:05:55 -03:00
2026-08-29 01:17:40 -03:00
2026-06-19 06:49:01 -03:00
2026-06-19 06:49:01 -03:00
2026-08-29 01:17:40 -03:00
2026-08-29 01:17:40 -03:00
2026-06-23 03:08:29 -03:00
2026-07-18 15:12:38 -03:00
2026-08-29 01:17:40 -03:00
2026-06-19 06:49:01 -03:00
2026-09-17 10:43:37 -03:00
2026-06-19 06:49:01 -03:00
2026-06-19 06:49:01 -03:00
2026-09-01 15:37:48 -03:00
2026-09-17 12:34:09 -03:00
2026-08-29 01:17:40 -03:00
2026-07-22 02:35:26 -03:00
2026-06-14 10:45:22 -03:00
2026-07-22 07:03:02 -03:00
2026-06-17 19:26:32 -03:00
2026-06-17 02:43:21 -03:00
2026-09-17 18:46:45 -03:00
2026-06-21 08:56:51 -03:00
2026-09-11 22:05:40 -03:00
2026-06-21 08:56:51 -03:00
2026-06-28 06:58:29 -03:00
2026-06-19 06:49:01 -03:00
2026-06-21 08:56:51 -03:00
2026-06-30 06:54:29 -03:00
2026-07-17 22:09:21 -03:00
2026-09-17 18:46:45 -03:00
2026-08-18 12:06:19 -03:00
2026-06-23 17:06:18 -03:00
2026-06-23 17:06:18 -03:00
2026-06-23 17:06:18 -03:00
2026-06-23 17:06:18 -03:00
2026-06-23 17:06:18 -03:00
2026-06-23 17:06:18 -03:00
2026-06-23 17:06:18 -03:00
2026-06-23 17:06:18 -03:00
2026-06-23 17:06:18 -03:00
2026-06-23 17:06:18 -03:00
2026-06-27 09:07:12 -03:00
2026-06-27 09:07:12 -03:00
2026-06-27 09:07:12 -03:00
2026-06-27 09:07:12 -03:00
2026-06-27 09:07:12 -03:00
2026-06-19 06:49:01 -03:00
2026-08-21 02:13:04 -03:00
2026-06-20 07:09:43 -03:00
2026-08-21 02:13:04 -03:00
2026-06-29 08:40:06 -03:00
2026-08-03 18:09:31 -03:00
2026-07-16 14:13:11 -03:00
2026-09-17 18:46:45 -03:00
2026-07-12 03:30:43 -03:00
2026-06-29 08:40:06 -03:00
2026-08-14 21:18:38 -03:00
2026-08-18 12:13:48 -03:00
2026-06-27 09:07:12 -03:00
2026-06-27 09:07:12 -03:00
2026-06-27 09:07:12 -03:00
2026-06-20 07:09:43 -03:00
2026-06-16 09:12:35 -03:00
2026-09-17 18:46:45 -03:00
2026-07-18 15:12:38 -03:00
2026-07-02 10:47:13 -03:00
2026-06-17 02:43:21 -03:00
2026-09-16 13:36:02 -03:00
2026-08-29 01:17:40 -03:00
2026-06-23 17:06:18 -03:00
2026-08-29 01:17:40 -03:00
2026-09-11 13:27:38 -03:00
2026-08-20 22:02:14 -03:00
2026-08-29 01:17:40 -03:00
2026-06-20 07:09:43 -03:00
2026-06-19 06:49:01 -03:00
2026-06-19 06:49:01 -03:00
2026-09-02 00:01:59 -03:00
2026-06-20 07:09:43 -03:00
2026-08-18 12:13:48 -03:00
2026-08-18 12:13:48 -03:00
2026-08-18 12:13:48 -03:00
2026-08-18 12:13:48 -03:00
2026-08-29 01:17:40 -03:00
2026-08-29 01:17:40 -03:00
2026-07-08 07:56:44 -03:00
2026-08-18 12:13:48 -03:00
2026-08-18 12:13:48 -03:00
2026-09-02 00:01:59 -03:00
2026-09-18 11:31:27 -03:00
2026-06-23 17:06:18 -03:00
2026-09-01 11:13:26 -03:00
2026-06-23 17:06:18 -03:00
2026-09-01 11:13:26 -03:00
2026-06-23 17:06:18 -03:00
2026-09-18 11:31:27 -03:00
2026-08-18 10:50:54 -03:00
2026-07-23 11:21:53 -03:00
2026-07-02 10:47:13 -03:00
2026-06-25 13:17:40 -03:00
2026-09-14 23:52:14 -03:00
2026-08-29 01:17:40 -03:00
2026-07-02 10:47:13 -03:00
2026-09-14 23:36:36 -03:00
2026-08-29 01:17:40 -03:00
2026-08-29 01:17:40 -03:00
2026-08-29 01:17:40 -03:00
2026-08-29 01:17:40 -03:00
2026-08-29 01:17:40 -03:00
2026-08-29 01:17:40 -03:00
2026-08-29 01:17:40 -03:00
2026-08-29 01:17:40 -03:00
2026-08-29 01:17:40 -03:00
2026-06-29 08:40:06 -03:00
2026-06-29 08:40:06 -03:00
2026-06-29 08:40:06 -03:00
2026-07-02 10:47:13 -03:00
2026-06-29 08:40:06 -03:00
2026-06-29 08:40:06 -03:00
2026-07-11 11:21:52 -03:00
2026-07-11 11:21:52 -03:00
2026-06-21 08:56:51 -03:00
2026-08-06 22:54:42 -03:00
2026-08-27 22:14:57 -03:00
2026-08-29 01:17:40 -03:00
2026-08-29 01:17:40 -03:00
2026-06-29 08:40:06 -03:00
2026-06-29 08:40:06 -03:00
2026-06-29 08:40:06 -03:00
2026-06-21 08:56:51 -03:00
2026-06-22 03:17:02 -03:00
2026-06-29 08:40:06 -03:00
2026-08-29 01:17:40 -03:00
2026-06-14 10:45:22 -03:00
2026-06-14 10:45:22 -03:00
2026-08-20 20:34:19 -03:00
2026-09-17 12:38:16 -03:00
2026-06-25 13:17:40 -03:00
2026-06-19 06:49:01 -03:00
2026-06-19 06:49:01 -03:00
2026-06-19 06:49:01 -03:00
2026-08-29 01:17:40 -03:00
2026-06-14 10:45:22 -03:00
2026-06-20 07:09:43 -03:00
2026-06-14 10:45:22 -03:00
2026-07-18 15:12:43 -03:00
2026-06-27 09:07:12 -03:00
2026-09-17 02:31:53 -03:00
2026-08-20 13:10:58 -03:00
2026-08-29 01:17:40 -03:00
2026-06-19 06:49:01 -03:00
2026-06-29 08:40:06 -03:00
2026-06-29 08:40:06 -03:00
2026-06-29 08:40:06 -03:00
2026-06-29 08:40:06 -03:00
2026-08-29 01:17:40 -03:00
2026-06-29 08:40:06 -03:00
2026-08-29 01:17:40 -03:00
2026-07-18 15:12:43 -03:00
2026-06-14 10:45:22 -03:00
2026-07-06 23:53:52 -03:00
2026-08-08 23:24:11 -03:00
2026-08-06 11:09:05 -03:00
2026-06-27 09:07:12 -03:00
2026-06-28 06:58:29 -03:00
2026-06-29 08:40:06 -03:00
2026-06-30 06:54:29 -03:00
2026-08-07 20:52:23 -03:00
2026-07-07 20:08:27 -03:00
2026-06-20 07:09:43 -03:00
2026-06-21 08:56:51 -03:00
2026-06-28 06:58:29 -03:00
2026-07-22 07:03:02 -03:00
2026-06-23 17:06:18 -03:00
2026-09-14 23:44:26 -03:00
2026-06-23 17:06:18 -03:00
2026-06-19 06:49:01 -03:00
2026-09-11 13:27:45 -03:00