Refactor Code Generation to use Prompt Registry in all cases

Overview

After completing the refactor in #906 (closed) to use the Prompt Registry for code completion requests, we need to apply a similar refactor for code generation requests coming from legacy clients. Currently, code generation is handled by /v3/code/completions or /v4/code/suggestions, which are both handled by this code_generations method.

Changes

The code generation path default path without prompt_id should still use the default code generations agent ("code_suggestions/generations"), with either anthropic or vertex based on the model_provider. Previously without prompt_id the vertex case used Code Bison and the Anthropic case used Sonnet 3.5 V2. Since neither of these are viable models we should instead use Sonnet 4.5 on Anthropic and Vertex in the without prompt_id case.

Acceptance Criteria

  • All code generation requests from legacy clients use the Prompt Registry
  • Prompt versions are properly resolved and model selection is consistent
  • Code generation requests are instrumented through the shared metrics stack
  • Backward compatibility is maintained for legacy clients
  • Comprehensive test coverage for all code paths
Edited by Allen Cook