mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
1.5 KiB
1.5 KiB
Scenario: Optimization request for "rust" returns 400 error
Context
A user reports that their optimization request fails immediately with a 400 error. The request payload is:
{
"source_code": "fn main() { println!(\"Hello, world!\"); }",
"trace_id": "abc-123",
"language": "rust",
"n_candidates": 5
}
The server log shows:
ERROR 2026-02-14 10:22:15 optimizer_router: Unhandled language dispatch for 'rust'
No candidates are returned. The response body is {"message": "Internal server error"}.
Task
Diagnose why this optimization request fails. Walk through the relevant stages of the optimization pipeline to identify the root cause. Provide:
- The exact stage where the failure occurs.
- The file(s) responsible for the failure.
- An explanation of why "rust" causes the failure.
- The fix: what would need to change to either reject "rust" cleanly with a 400 validation error, or to support it as a new language.
Expected Outputs
- Identification that the failure is at the router dispatch stage (Step 2 of the debug-optimization-failure workflow).
- Reference to
core/shared/optimizer_router.pyas the file where dispatch happens. - Explanation that "rust" is not in the set of supported languages (
python,javascript,typescript,java), so the router has no branch for it. - A recommendation to either add
"rust"validation toOptimizeSchemaincore/shared/optimizer_models.pyso it rejects unsupported languages at Step 1, or to implement Rust support following the add-language-support workflow.