Repository navigation
fix: show header-specific MCP validation errors - #17966
Conversation
|
PR Artifact Cleanup Queued The |
|
The MCP validation fix is ready for review: Ubuntu/Windows test-and-build, description, title, and artifact checks pass. The focused MCP validation suite also passes all 12 tests locally. After marking the PR ready, the separate |
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Scope
Canvas-owned UI/i18n change (form validation message selection + src/i18n/translation.json). It belongs in OpenHands/OpenHands; no Agent Server contract, wire, or durable-state change is involved.
Assessment
The fix threads an optional errorKey through the shared validateEnvFormat helper and passes SETTINGS$MCP_ERROR_HEADER_INVALID_FORMAT from the Header branch, while the STDIO env call at line 245 keeps the default SETTINGS$MCP_ERROR_ENV_INVALID_FORMAT. The parameter is optional and defaults to the previous value, so parsing and all other callers are unchanged — the only behavioral delta is the selected message, which is exactly the reported defect.
Verified on the current head 07b762b6e9b74efaaadb04ebc544e4e3cf31088f:
- New i18n key present with all 15 supported locales;
npm run make-i18nandnpm run check-translation-completenessboth pass. __tests__/components/features/settings/mcp-settings/mcp-server-form.validation.test.tsx— 12/12 pass. The new case drives the real validator (no mock of the validation logic) and asserts the header key appears while the env key does not, so it fails if the header key stops being passed.__tests__/i18n/translation-completeness.test.ts— 10/10 pass (covers the new key's locale coverage and no English-copy regressions).- GitHub Actions for this head:
test-and-build (ubuntu)andtest-and-build (windows)success,check-pr-artifactssuccess, and the latestValidate PR descriptionruns (05:58) success. The two earlierValidate PR descriptionfailures (04:19/04:20) are superseded by the later passing runs on the same head.
Acceptance criteria checklist (#17958)
- Malformed Header-auth line shows a header-specific message —
SETTINGS$MCP_ERROR_HEADER_INVALID_FORMATnow passed from the Header branch. - Empty Headers field still shows
SETTINGS$MCP_ERROR_HEADER_REQUIRED— that branch is untouched. - Valid
KEY=valueheader still submits and is stored underauth.headersunchanged — parsing is untouched; the existing submit test passes. - STDIO env validation still shows
SETTINGS$MCP_ERROR_ENV_INVALID_FORMAT— default key preserved; existing env test passes. - Header-format message present in all 15 locales, and generation/completeness checks pass.
- Regression test extended so Header asserts the header message and STDIO keeps the env message; suite passes.
Notes
- Production evidence: the before/after screenshots under
.pr/bugs/exercise the same production entry point described in the issue reproduction. A still screenshot is the correct artifact type here, since the changed behavior is a static rendered message. - The
.pr/artifacts are temporary and are cleaned up by repo automation after merge; no action required. - Eval risk: none. This selects a localized string only; no prompt, tool-selection, conversation-payload, planning, memory, or evaluation path changes.
✅ APPROVED
all-hands-bot
left a comment
There was a problem hiding this comment.
Reusing validateEnvFormat with an errorKey parameter is the right minimal refactor, and the new key is present in all 15 locales. The test asserts the header-specific message shows and the env message doesn't. Approving.
This review was posted by an AI agent (OpenHands) on behalf of the requester.
|
🚀 Released in v1.27.0. |
HUMAN:
我检查了修复前后的运行截图,确认错误提示从环境变量改为请求头格式。
AGENT:
Fixed MCP server form validation so malformed Header authentication lines show a header-specific message, while STDIO environment validation keeps its existing message. Added the translation key in all 15 supported locales and a regression test. The
.pr/bugs/screenshots show the same production-built UI before and after the fix.Why
Header authentication reuses the KEY=value validator for environment variables, so malformed header lines incorrectly report an environment-variable error.
Summary
Issue Number
Fixes #17958
How to Test
npx vitest run __tests__/components/features/settings/mcp-settings/mcp-server-form.validation.test.tsx— 12 tests passed.npm run make-i18nandnpm run check-translation-completeness— passed.npm run build:app— passed; launched the production build withnode bin/agent-canvas.mjs --port 18321and reproduced malformedNOEQUALSheader input in the real MCP editor.npm run lint— passed with existing warnings outside this change.npm test -- --reporter=dot— 8,057 passed, 33 skipped, 7 todo; 10 failed across 7 files due Windows-specific path/platform assumptions in unrelated tests (for example, POSIX-only absolute-path expectations and a platform-name assertion).GitHub CI at commit
07b762b6e: Ubuntu and Windows test-and-build checks passed, along with PR description, title, and screenshot artifact checks. CI run.Video/Screenshots
Before fix, the malformed Header auth input displayed the environment-variable error:
After fix, the same input displays the header-specific validation message:
Type
Notes
Validation behavior and parsing are unchanged; this only selects the correct localized error message.