codeflash-internal/tiles/codeflash-internal-skills/evals/scenario-1/task.md
2026-02-14 22:25:30 -05:00

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:

  1. The exact stage where the failure occurs.
  2. The file(s) responsible for the failure.
  3. An explanation of why "rust" causes the failure.
  4. 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.py as 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 to OptimizeSchema in core/shared/optimizer_models.py so it rejects unsupported languages at Step 1, or to implement Rust support following the add-language-support workflow.