Skip to content

feat(adapter): per-agent language instruction#4428

Open
ramonmatias19 wants to merge 1 commit intopaperclipai:masterfrom
ramonmatias19:feature/adapter-language-instruction
Open

feat(adapter): per-agent language instruction#4428
ramonmatias19 wants to merge 1 commit intopaperclipai:masterfrom
ramonmatias19:feature/adapter-language-instruction

Conversation

@ramonmatias19
Copy link
Copy Markdown

Summary

Add an optional language config field on all local adapters (Claude, Codex, Cursor, Gemini, OpenCode, Pi). When set, a final instruction is appended to the rendered prompt telling the agent to produce all outputs in that language (responses, commit messages, explanations, etc.).

  • New buildLanguageInstruction() helper in adapter-utils/server-utils
  • Each adapter's execute.ts imports the helper and appends it to its joinPromptSections call
  • Each adapter's ui/build-config.ts passes v.language to adapterConfig
  • Add language field to CreateConfigValues (optional string) + default

Test plan

  • Configure an agent with language: "Portuguese", run a heartbeat — verify the agent replies in Portuguese
  • Leave language empty — verify no language instruction is appended

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 24, 2026

Greptile Summary

This PR adds a per-agent language config field across all six local adapters (Claude, Codex, Cursor, Gemini, OpenCode, Pi). A shared buildLanguageInstruction() helper in adapter-utils constructs a final prompt instruction telling the agent to respond in the configured language; each adapter's execute.ts appends it via joinPromptSections, and each build-config.ts passes the value through. Two unrelated Windows symlink fixes (junction type on win32) are also bundled into the Codex and Cursor adapters.

The PR description does not follow the required PR template from CONTRIBUTING.md and .github/PULL_REQUEST_TEMPLATE.md. The required sections — Thinking Path, Risks, Model Used, and the Checklist — are all absent. Please update the description to include these sections before requesting merge.

Confidence Score: 5/5

Code changes are safe to merge; only the PR description needs to be updated to satisfy CONTRIBUTING.md requirements.

All 15 changed files implement the same well-guarded pattern consistently. The helper correctly short-circuits on empty input, no security or data-integrity issues are introduced, and the Windows symlink fixes are valid. Remaining findings are P2 (missing UI field and missing PR template sections) with no correctness or reliability impact.

No files require special attention from a code correctness perspective.

Important Files Changed

Filename Overview
packages/adapter-utils/src/server-utils.ts Adds buildLanguageInstruction() helper that safely guards against empty input; implementation is clean.
packages/adapter-utils/src/types.ts Adds optional language?: string field to CreateConfigValues; straightforward type change.
packages/adapters/claude-local/src/server/execute.ts Imports buildLanguageInstruction and appends result to joinPromptSections; consistent with other adapters.
packages/adapters/codex-local/src/server/execute.ts Language instruction added; also includes an unrelated Windows symlink fix (junction type on win32).
packages/adapters/cursor-local/src/server/execute.ts Language instruction added; also includes an unrelated Windows symlink fix identical to codex-local.
packages/adapters/gemini-local/src/server/execute.ts Language instruction appended after apiAccessNote; consistent pattern with other adapters.
packages/adapters/opencode-local/src/server/execute.ts Language instruction added correctly; change is inside a nested scope but logic is sound.
packages/adapters/pi-local/src/server/execute.ts Language instruction appended to userPrompt; consistent with other adapters.
packages/adapters/claude-local/src/ui/build-config.ts Passes v.language to adapterConfig if set; follows the same conditional pattern as other fields.
packages/adapters/codex-local/src/ui/build-config.ts Passes v.language to adapter config; consistent with other build-config.ts changes.
packages/adapters/cursor-local/src/ui/build-config.ts Passes v.language to adapter config; consistent with other build-config.ts changes.
packages/adapters/gemini-local/src/ui/build-config.ts Passes v.language to adapter config; consistent with other build-config.ts changes.
packages/adapters/opencode-local/src/ui/build-config.ts Passes v.language to adapter config; consistent with other build-config.ts changes.
packages/adapters/pi-local/src/ui/build-config.ts Passes v.language to adapter config; consistent with other build-config.ts changes.
ui/src/components/agent-config-defaults.ts Adds language: "" to defaultCreateValues; no corresponding UI input component visible in this PR.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: ui/src/components/agent-config-defaults.ts
Line: 28

Comment:
**Missing UI input field for `language`**

`language: ""` is added to the default config values, and all `build-config.ts` files wire it through to the adapter config, but no form input component appears to be added in this PR. Without a visible field in the agent configuration UI, users have no way to discover or set this option without editing raw config. Consider adding an input/select field (or confirming that an existing generic config editor surfaces this key automatically).

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "feat(adapter): per-agent language instru..." | Re-trigger Greptile

workspaceBranchTemplate: "",
worktreeParentDir: "",
runtimeServicesJson: "",
language: "",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Missing UI input field for language

language: "" is added to the default config values, and all build-config.ts files wire it through to the adapter config, but no form input component appears to be added in this PR. Without a visible field in the agent configuration UI, users have no way to discover or set this option without editing raw config. Consider adding an input/select field (or confirming that an existing generic config editor surfaces this key automatically).

Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/components/agent-config-defaults.ts
Line: 28

Comment:
**Missing UI input field for `language`**

`language: ""` is added to the default config values, and all `build-config.ts` files wire it through to the adapter config, but no form input component appears to be added in this PR. Without a visible field in the agent configuration UI, users have no way to discover or set this option without editing raw config. Consider adding an input/select field (or confirming that an existing generic config editor surfaces this key automatically).

How can I resolve this? If you propose a fix, please make it concise.

Add optional 'language' config field on all local adapters (Claude, Codex,
Cursor, Gemini, OpenCode, Pi). When set, a final instruction is appended
to the rendered prompt telling the agent to produce all outputs in that
language (responses, commit messages, explanations, etc.).

- New buildLanguageInstruction() helper in adapter-utils/server-utils
- Each adapter's execute.ts imports the helper and appends it to its
  joinPromptSections call
- Each adapter's ui/build-config.ts passes v.language to adapterConfig
- Add language field to CreateConfigValues (optional string) + default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant