[PR #302] [CLOSED] fix: anchor tool schema messages to English #307

Closed
opened 2026-06-06 22:10:09 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/vxcontrol/pentagi/pull/302
Author: @mason5052
Created: 5/6/2026
Status: Closed

Base: mainHead: codex/issue-285-english-only-tool-schema


📝 Commits (2)

  • e9c06d8 fix: anchor tool schema messages to English
  • 7437520 fix(tools): broaden English-anchor regression guard for #285

📊 Changes

2 files changed (+118 additions, -32 deletions)

View changed files

📝 backend/pkg/tools/args.go (+32 -32)
📝 backend/pkg/tools/args_test.go (+86 -0)

📄 Description

Summary

Hard-codes the user-facing description text in the tool JSON schema to English so the LLM never sees the legacy "in user's language only" hint. This stops Russian/mixed-language message and result fields from leaking into traces and the UI when a flow is created in English.

Problem

backend/pkg/tools/args.go declared jsonschema_description tags that told the model to answer "in user's language only" / "in the user's language only" / "in the user's language". Because the schema is reflected once at startup and shared across flows, a flow in English would still receive the Russian-leaning hint baked into the tool definitions, producing the mixed-language tool-call output reported in #285.

Solution

Replace every in user's language only, in the user's language only, and in the user's language occurrence with in English in the struct tags across backend/pkg/tools/args.go. The follow-up commit also removed the remaining in the user's language (without "only") schema hints on the search action Message fields, so no schema description still instructs the model to answer in the user's language. No runtime locale logic, no schema re-shape, no API/DB/UI change.

User Impact

  • New flows: tool-call message / result / clarification fields render in English regardless of UI locale.
  • No migration, config, or restart steps for users.
  • Flow.language is unchanged; if multilingual support is added later, this is a one-line edit per field.

Test Plan

  • TestToolSchemasDoNotInstructUsersLanguage sweeps every tool returned by GetRegistryDefinitions() and fails if any of the broader forbidden patterns (user's language, the user's language) reappear in any tool schema, not just the old exact user's language only phrase.
  • TestUserFacingMessageDescriptionsAreEnglishAnchored asserts the eight user-facing message/result properties carry the "in English" anchor, going through the same reflector.Reflect path the LLM sees.
  • go test ./pkg/tools/... passes locally.
  • rg "user's language|the user's language" backend/pkg/tools/args.go returns no matches (verified).

Closes #285


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/vxcontrol/pentagi/pull/302 **Author:** [@mason5052](https://github.com/mason5052) **Created:** 5/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/issue-285-english-only-tool-schema` --- ### 📝 Commits (2) - [`e9c06d8`](https://github.com/vxcontrol/pentagi/commit/e9c06d8f8515e525a8da093fc6a2b95045c7bff3) fix: anchor tool schema messages to English - [`7437520`](https://github.com/vxcontrol/pentagi/commit/7437520e784490458fdf9fdd552a773b91f7878f) fix(tools): broaden English-anchor regression guard for #285 ### 📊 Changes **2 files changed** (+118 additions, -32 deletions) <details> <summary>View changed files</summary> 📝 `backend/pkg/tools/args.go` (+32 -32) 📝 `backend/pkg/tools/args_test.go` (+86 -0) </details> ### 📄 Description ## Summary Hard-codes the user-facing description text in the tool JSON schema to English so the LLM never sees the legacy "in user's language only" hint. This stops Russian/mixed-language `message` and `result` fields from leaking into traces and the UI when a flow is created in English. ## Problem `backend/pkg/tools/args.go` declared `jsonschema_description` tags that told the model to answer "in user's language only" / "in the user's language only" / "in the user's language". Because the schema is reflected once at startup and shared across flows, a flow in English would still receive the Russian-leaning hint baked into the tool definitions, producing the mixed-language tool-call output reported in #285. ## Solution Replace every `in user's language only`, `in the user's language only`, and `in the user's language` occurrence with `in English` in the struct tags across `backend/pkg/tools/args.go`. The follow-up commit also removed the remaining `in the user's language` (without "only") schema hints on the search action `Message` fields, so no schema description still instructs the model to answer in the user's language. No runtime locale logic, no schema re-shape, no API/DB/UI change. ## User Impact - New flows: tool-call `message` / `result` / clarification fields render in English regardless of UI locale. - No migration, config, or restart steps for users. - `Flow.language` is unchanged; if multilingual support is added later, this is a one-line edit per field. ## Test Plan - `TestToolSchemasDoNotInstructUsersLanguage` sweeps every tool returned by `GetRegistryDefinitions()` and fails if any of the broader forbidden patterns (`user's language`, `the user's language`) reappear in any tool schema, not just the old exact `user's language only` phrase. - `TestUserFacingMessageDescriptionsAreEnglishAnchored` asserts the eight user-facing `message`/`result` properties carry the "in English" anchor, going through the same `reflector.Reflect` path the LLM sees. - `go test ./pkg/tools/...` passes locally. - `rg "user's language|the user's language" backend/pkg/tools/args.go` returns no matches (verified). Closes #285 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-06 22:10:09 -04:00
yindo closed this issue 2026-06-06 22:10:09 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vxcontrol/pentagi#307