Skip to content

fix(i18n): propagate language field in AI-Infra-Scan and MCP-Scan task creation#330

Open
boy-hack wants to merge 2 commits intomainfrom
fix/issue-324-language-v2
Open

fix(i18n): propagate language field in AI-Infra-Scan and MCP-Scan task creation#330
boy-hack wants to merge 2 commits intomainfrom
fix/issue-324-language-v2

Conversation

@boy-hack
Copy link
Copy Markdown
Collaborator

Summary

Fixes #324

Re-submission of the language fix after rebasing onto current main (the original PR #325 was closed due to a CodeQL alert that was caused by a stale TLS code path — no longer present in main after PR #306 simplified TLS handling).

Root Causes Fixed

Bug 1 — API path: language field not propagated

When creating tasks via the REST API (SubmitTask handler):

  1. AIInfraScanTaskRequest struct was missing the Language field entirely
  2. Both ai_infra_scan and mcp_scan cases in SubmitTask() built TaskCreateRequest without setting CountryIsoCode, so the language preference was silently dropped before reaching the task executor

Bug 2 — Web path: executeScan() ignores language

executeScan() built options.Options without setting the Language field, so the runner always loaded Chinese vuln descriptions from data/vuln/ regardless of user language selection.

Changes

  • common/websocket/api.go: Add Language field to AIInfraScanTaskRequest; set CountryIsoCode: req.Language in TaskCreateRequest for both mcp_scan and ai_infra_scan cases
  • common/agent/tasks.go: Derive language from request.Language inside executeScan() and pass it as opts.Language

Testing

zhuque added 2 commits April 20, 2026 09:24
…and mcp_scan

Fixes #324: scan reports were always displayed in Chinese even after
switching the language to English via the UI.

Root cause:
- AIInfraScanTaskRequest struct was missing the Language field entirely
- Both 'ai_infra_scan' and 'mcp_scan' cases in SubmitTask() built
  TaskCreateRequest without setting CountryIsoCode, so the language
  preference was silently dropped before reaching the task executor

Fix:
- Add Language field to AIInfraScanTaskRequest
- Set CountryIsoCode: req.Language in TaskCreateRequest for both
  'mcp_scan' and 'ai_infra_scan' cases
Fixes #324 (web path for AI-Infra-Scan): executeScan() built options.Options
without setting the Language field, so the runner always loaded Chinese vuln
descriptions from data/vuln/ and triggered zh-only code paths regardless of
the language the user selected in the UI.

Root cause: the 'language' variable resolved from request.Language existed in
Execute() but was never visible inside executeScan(). executeScan() read
request.Language independently but never passed it to options.Options.

Fix: derive language from request.Language inside executeScan() and pass it
as opts.Language, so runner.go correctly loads data/vuln_en/ and uses
English templates when language=en.
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@boy-hack
Copy link
Copy Markdown
Collaborator Author

boy-hack commented May 4, 2026

Friendly ping @boy-hack @pythoncheng — this PR has been open for 14+ days with all CI checks passing (CodeQL ✅, Go ✅, Python ✅, Actions ✅) and mergeable_state: clean. It fixes the i18n language propagation issue (#324). Could you please take a look and merge when convenient? 🙏

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.

AI infra scan and AI tool skill scan reports are still displayed in Chinese after switching the language to English.

1 participant