fix(prompts): expand language-mirroring carve-out + pin reasoning_content anchor

Two small follow-ups to #588's review:

* Gemini-code-assist suggested explicitly listing environment variables,
  command-line flags, and URLs alongside identifiers/tool-names in the
  carve-out clause, since those are exactly the categories an LLM is
  likeliest to "helpfully" translate (e.g. `--verbose` or `DEBUG=true`).
  Adopting verbatim — the additions are non-controversial and the failure
  mode they prevent is real.

* Copilot flagged that the structural test only checked for the `## Language`
  heading. A future edit could keep the heading but silently weaken the
  section to a generic "respond in the user's language" directive,
  dropping the cross-cutting #588 commitment that the model's
  `reasoning_content` field — not just the visible reply — follows the
  user's language. Add a second structural anchor: assert the section
  body mentions `reasoning_content`. This matches the existing rlm test's
  "anchor tokens, not prose" convention (the API field name is the
  feature contract, not a wording choice).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hunter Bown
2026-05-04 13:41:30 -05:00
parent a239968f5b
commit 4e86a0fb8e
2 changed files with 13 additions and 2 deletions
+12 -1
View File
@@ -608,7 +608,12 @@ mod tests {
/// #588: language-mirroring directive must ship in every mode so
/// DeepSeek's `reasoning_content` and final reply follow the user's
/// language. Structural test — wording is not a test concern.
/// language. Structural test — wording is not a test concern, but
/// the cross-cutting commitment of #588 is specifically that the
/// `reasoning_content` field tracks the user's language (not just
/// the visible reply); pin that anchor token so a future edit
/// can't silently weaken the section to a generic "respond in the
/// user's language" directive while keeping the heading.
#[test]
fn language_mirroring_section_present_in_all_modes() {
for mode in [AppMode::Agent, AppMode::Yolo, AppMode::Plan] {
@@ -617,6 +622,12 @@ mod tests {
prompt.contains("## Language"),
"## Language section missing from mode {mode:?}"
);
assert!(
prompt.contains("reasoning_content"),
"## Language section in {mode:?} must mention `reasoning_content` — \
that field name is the structural anchor for the #588 commitment that \
internal reasoning, not just the visible reply, follows the user's language"
);
}
}
+1 -1
View File
@@ -4,7 +4,7 @@ You are DeepSeek TUI. You're already running inside it — don't try to launch a
Detect the language the user writes in and respond in that same language — including your internal reasoning. If the user writes in Simplified Chinese (简体中文), your `reasoning_content` and final reply must both be in Simplified Chinese. If they switch languages mid-conversation, switch with them. The default when no clear signal is present is English.
Code, file paths, identifiers, tool names, and log lines stay in their original form — translating `read_file` to `读取文件` would break tool calls. Only natural-language prose mirrors the user.
Code, file paths, identifiers, tool names, environment variables, command-line flags, URLs, and log lines stay in their original form — translating `read_file` to `读取文件` would break tool calls. Only natural-language prose mirrors the user.
## Preamble Rhythm