Skip to content

[bug] Sub-agents always output in English regardless of user's language #33084

Closed as not planned

Description

Description

When a user communicates with opencode in a non-English language (e.g., Chinese), the main agent correctly infers the language and responds in the same language. However, when the user invokes a sub-agent (e.g., @general or any task agent) via the task tool, the sub-agent's processing messages, intermediate outputs, and results are all displayed in English. Users who do not understand English are unable to follow what the sub-agent is doing.

This happens because:

  1. The system prompt passed to sub-agents is hardcoded in English
  2. The task.ts tool has hardcoded English strings for background task status messages
  3. There is no language detection mechanism
  4. There is no mechanism to pass the user's language preference from the parent session to sub-agent sessions
  5. There is no i18n/localization infrastructure

Code location

  1. packages/opencode/src/tool/task.ts — Background/foreground task messages hardcoded in English:

    • BACKGROUND_DESCRIPTION (line ~28): "Background mode: background=true launches the subagent asynchronously..."
    • BACKGROUND_STARTED (line ~34): "The task is working in the background..."
    • BACKGROUND_UPDATED (line ~41): "Additional context sent to the running background task..."
    • renderOutput() (line ~78): Generates <task> XML with English summaries
    • inject() (line ~136): "Background task completed: ..." / "Background task failed: ..."
    • backgroundResult() (line ~200): "Background task started"
  2. packages/opencode/src/session/system.ts — Environment prompts hardcoded in English:

    • "You are powered by the model named..."
    • "Working directory: ..."
    • "Workspace root folder: ..."
  3. packages/opencode/src/session/prompt/default.txt — Default system prompt entirely in English

  4. packages/opencode/src/session/prompt/anthropic.txt — Anthropic system prompt entirely in English

  5. packages/opencode/src/session/prompt.ts — Prompt generation logic without any language awareness

Steps to reproduce

  1. Start a conversation with opencode in Chinese (or any non-English language)
  2. Confirm the main agent responds in Chinese
  3. Type @general do something in this project or invoke any sub-agent
  4. Observe that the sub-agent's processing messages, status updates, and results are displayed in English
  5. A non-English-speaking user cannot understand what the sub-agent is doing

Expected behavior

Sub-agents should respect the user's language preference and respond in the same language as the parent conversation. Options:

  • Detect the user's language from the conversation history and pass it to sub-agents
  • Add a configurable language/locale setting
  • Include a language directive in the system prompt passed to sub-agents (e.g., "The user is communicating in Chinese. Please respond in Chinese.")
  • Implement i18n for tool output strings

Environment

  • opencode version: latest (observed on v2.x)
  • OS: cross-platform (reproducible on Windows, macOS, Linux)
  • Sub-agent types affected: all (@general, @plan, @tool, etc.)

About the duplicate flag: #12609 reports that system prompts contain an ASCII-only constraint which prevents non-English output. That is a different root cause (model prompt design). This issue is about sub-agent language inheritance — even if the main agent speaks Chinese, sub-agents created via the task tool do not receive any language context and default to English. The fix involves passing the user's detected language from parent to child session, which is separate from fixing ASCII-only constraints in system prompts.

Activity

  1. github-actions commented on Jun 20, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue specifically focuses on sub-agent language inheritance (passing language context from parent to child sessions), it may be distinct enough to remain open. Please review #12609 and comment on whether your issue is fully covered there or represents a separate concern.

  2. rekram1-node commented on Jun 22, 2026

    @rekram1-node
    Member

    STOP SPAMMING ISSUES.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions