{"record":{"id":"39a5ec840cf3871d","repo":"bytedance/deer-flow","slug":"input-polishing-is-disabled","errorCode":null,"errorMessage":"Input polishing is disabled","messagePattern":"Input polishing is disabled","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"warning","filePath":"backend/app/gateway/routers/input_polish.py","lineNumber":73,"sourceCode":"    return f\"Locale hint: {locale_hint}\\n\\nRewrite this draft while preserving its intent:\\n<draft>\\n{text}\\n</draft>\"\n\n\n@router.post(\n    \"/input-polish\",\n    response_model=InputPolishResponse,\n    summary=\"Polish Composer Input\",\n    description=\"Rewrite a draft message before it is sent. This does not create a thread run or persist any message.\",\n)\n@require_permission(\"runs\", \"create\")\nasync def polish_input(\n    body: InputPolishRequest,\n    request: Request,\n    config: AppConfig = Depends(get_config),\n) -> InputPolishResponse:\n    del request  # Required by the auth decorator.\n\n    if not config.input_polish.enabled:\n        raise HTTPException(status_code=404, detail=\"Input polishing is disabled\")\n\n    # Validate the same normalized view of the input that we send to the model,\n    # so the user-facing length boundary and the model input cannot disagree\n    # (e.g. a padded draft passing the check but arriving with stray whitespace).\n    text = body.text.strip()\n    if not text:\n        raise HTTPException(status_code=400, detail=\"Input text is required\")\n\n    max_chars = config.input_polish.max_chars\n    if len(text) > max_chars:\n        raise HTTPException(status_code=400, detail=f\"Input text exceeds {max_chars} characters\")\n\n    model_name = config.input_polish.model_name\n    try:\n        raw = await run_oneshot_llm(\n            system_instruction=_build_system_instruction(),\n            user_content=_build_user_content(text, body.locale),\n            run_name=\"input_polish\",","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/app/gateway/routers/input_polish.py#L55-L91","documentation":"Raised by POST /input-polish with status 404 when config.input_polish.enabled is false. The endpoint exists but the feature is disabled in config.yaml, so it reports 404 (feature not available) rather than 403 — clients should treat this as 'no polishing capability' and simply skip polishing.","triggerScenarios":"Calling the polish endpoint while config.yaml's input_polish section has enabled: false (or is defaulted off); a frontend build that always shows the polish button regardless of server feature flags; config hot-reload disabling the feature mid-session.","commonSituations":"Fresh deployments where input_polish is off by default to save LLM cost; disabling the feature in prod but the UI bundle still exposes the affordance; per-environment config divergence (enabled in dev, disabled in prod).","solutions":["Enable the feature in config.yaml: set input_polish.enabled: true (then restart/reload the Gateway).","Gate the UI polish affordance on the server-advertised feature state so users never reach the 404.","If disabled intentionally, have the client catch 404 and send the draft unpolished."],"exampleFix":"# before (config.yaml)\ninput_polish:\n  enabled: false\n\n# after\ninput_polish:\n  enabled: true\n  max_chars: 8000\n  model_name: gpt-4o-mini","handlingStrategy":"type-guard","validationCode":"// gate the UI affordance on server capability\nconst caps = await getServerCapabilities();\nif (caps.input_polish?.enabled) showPolishButton();","typeGuard":"const inputPolishEnabled = (caps: Caps) => Boolean(caps?.input_polish?.enabled === true);","tryCatchPattern":"try { await polish({ text }); } catch (e) { if (e.status === 404) return text; /* feature off — skip */ throw e; }","preventionTips":["Check config.input_polish.enabled before exposing the polish action","Treat 404 from polish as 'feature absent' and degrade silently","Restart the Gateway after config changes"],"tags":["http-404","feature-flag","configuration","input-polish"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}