Skip to content

refactor: rename gepa into prompt optimization#1034

Merged
leonardmq merged 2 commits intosfierro/optimize-featurefrom
leonard/kil-410-refactor-rename-gepa-into-prompt-optimization
Feb 16, 2026
Merged

refactor: rename gepa into prompt optimization#1034
leonardmq merged 2 commits intosfierro/optimize-featurefrom
leonard/kil-410-refactor-rename-gepa-into-prompt-optimization

Conversation

@leonardmq
Copy link
Collaborator

@leonardmq leonardmq commented Feb 16, 2026

What does this PR do?

Rename GEPA into Prompt Optimization where possible.

Checklists

  • Tests have been run locally and passed
  • New tests have been added to any work in /lib

Summary by CodeRabbit

  • Refactor
    • Rebranded GEPA jobs to Prompt Optimization jobs across the app.
    • Updated API endpoints and public schemas from /gepa_jobs/ to /prompt_optimization_jobs/.
    • Updated backend/public datamodels, API client responses, and public types to Prompt Optimization equivalents.
    • Updated UI routes, navigation, links, and pages to use Prompt Optimization terminology.
    • Tests and internal datamodel accessors renamed to match the new job type; core behavior unchanged.

@leonardmq leonardmq requested a review from sfierro February 16, 2026 09:45
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

This PR renames and remaps the GEPA job surface to a Prompt Optimization job surface across backend, frontend, API clients, datamodels, and tests — updating imports, route paths, types, models, and function names accordingly.

Changes

Cohort / File(s) Summary
Server wiring
app/desktop/desktop_server.py
Replaced connect_gepa_job_api import and call with connect_prompt_optimization_job_api to register the prompt-optimization job API.
Backend Job API implementation
app/desktop/studio_server/prompt_optimization_job_api.py
Full rename and path updates: routes, request/response models, helper functions, artifact creation/update flows, and logging changed from GEPA → PromptOptimization equivalents.
API client endpoints
app/desktop/studio_server/api_client/kiln_ai_server_client/api/jobs/*
Endpoint paths and docstrings updated from /v1/jobs/gepa_job/.../v1/jobs/prompt_optimization_job/...; request/response models and type hints switched to PromptOptimization types.
API client models
app/desktop/studio_server/api_client/kiln_ai_server_client/models/*, __init__.py
Renamed model classes and exports: GEPA-related models removed/replaced (e.g., GEPAJobOutputPromptOptimizationJobOutput, GEPAJobResultResponsePromptOptimizationJobResultResponse, body start model renamed). Updated all and imports.
Frontend schema & types
app/web_ui/src/lib/api_schema.d.ts, app/web_ui/src/lib/types.ts
Public schema and TypeScript types renamed from GepaJob/PublicGEPAJob* → PromptOptimizationJob/PublicPromptOptimizationJob*; operation IDs and paths updated.
Frontend pages & UI
app/web_ui/src/routes/(app)/prompt_optimization/..., create_prompt_optimization_job/..., prompt_optimization_job/[job_id]/+page.svelte, copilot_auth/+page.svelte
Data fetchers, state vars, API calls, navigation links, and route paths updated to use prompt_optimization terminology; component bindings and error messages adjusted.
Frontend links/components
app/web_ui/src/lib/ui/kiln_copilot/copilot_required_card.svelte, app/web_ui/src/routes/(app)/prompts/..., prompt_generators/+page.svelte
Changed hrefs and redirect targets from /gepa/.../prompt_optimization/... (Copilot auth, prompts action buttons, prompt generator template).
Core datamodels & task mapping
libs/core/kiln_ai/datamodel/*, task.py
Public datamodel class renamed GepaJobPromptOptimizationJob; Task relationship mapping and accessor renamed from gepa_jobs()prompt_optimization_jobs(); field descriptions updated.
Tests
libs/core/kiln_ai/datamodel/test_prompt_optimization_job.py, test_task.py
Tests updated to reference PromptOptimizationJob and new Task accessor names; assertions and fixtures renamed accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • sfierro

Poem

🐇
I hopped through code with nimble paws,
Swapping names and fixing laws.
GEPA hopped out, Optimization hopped in,
Routes and types renewed with a grin.
Bravo! — a tiny rabbit's coding spin. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'refactor: rename gepa into prompt optimization' clearly and concisely summarizes the main change: renaming GEPA terminology to Prompt Optimization across the codebase.
Description check ✅ Passed The description covers the main objective ('Rename GEPA into Prompt Optimization where possible') and includes completed checklist items confirming tests were run and added. However, it omits the 'Related Issues' section from the template.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into sfierro/optimize-feature

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch leonard/kil-410-refactor-rename-gepa-into-prompt-optimization

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @leonardmq, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements a significant refactoring to standardize terminology by renaming all instances of 'GEPA' to 'Prompt Optimization'. This change enhances the understandability of the system by replacing an internal acronym with a more explicit and user-friendly term. The refactor touches various layers of the application, from backend API definitions and datamodels to frontend UI components and navigation, ensuring a cohesive and consistent experience for developers and users alike.

Highlights

  • Terminology Renaming: The acronym 'GEPA' has been systematically replaced with 'Prompt Optimization' across the codebase for improved clarity and descriptiveness. This includes file names, class names, function names, API endpoints, and UI text.
  • API and Client Updates: All API routes, client-side API calls, and associated model definitions related to the former 'GEPA' functionality have been updated to reflect the new 'Prompt Optimization' terminology, ensuring consistent communication between the frontend and backend.
  • Datamodel Refactoring: The core datamodel for job tracking (GepaJob) has been renamed to PromptOptimizationJob, and its integration within the Task datamodel has been updated accordingly.
  • UI Navigation and Text: User interface elements, including navigation links, page titles, and descriptive text, have been adjusted to use 'Prompt Optimization' where 'GEPA' was previously used, providing a more intuitive user experience.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • app/desktop/desktop_server.py
    • Updated import statement for the prompt optimization job API.
    • Modified the function call to connect the prompt optimization job API.
  • app/desktop/studio_server/api_client/kiln_ai_server_client/api/jobs/check_model_supported_v1_jobs_gepa_job_check_model_supported_get.py
    • Renamed file to check_prompt_optimization_model_supported_v1_jobs_prompt_optimization_job_check_model_supported_get.py.
    • Updated the URL path from gepa_job to prompt_optimization_job.
    • Modified docstrings to reflect 'Prompt Optimization Model Supported'.
  • app/desktop/studio_server/api_client/kiln_ai_server_client/api/jobs/get_gepa_job_result_v1_jobs_gepa_job_job_id_result_get.py
    • Renamed file to get_prompt_optimization_job_result_v1_jobs_prompt_optimization_job_job_id_result_get.py.
    • Updated import statements to use PromptOptimizationJobResultResponse.
    • Modified the URL path from gepa_job to prompt_optimization_job.
    • Adjusted type hints and docstrings to refer to 'Prompt Optimization Job Result'.
  • app/desktop/studio_server/api_client/kiln_ai_server_client/api/jobs/start_gepa_job_v1_jobs_gepa_job_start_post.py
    • Renamed file to start_prompt_optimization_job_v1_jobs_prompt_optimization_job_start_post.py.
    • Updated import statements to use BodyStartPromptOptimizationJobV1JobsPromptOptimizationJobStartPost.
    • Modified the URL path from gepa_job to prompt_optimization_job.
    • Adjusted type hints and docstrings to refer to 'Prompt Optimization Job'.
  • app/desktop/studio_server/api_client/kiln_ai_server_client/models/init.py
    • Updated imports to include new PromptOptimizationJob related models.
    • Removed imports for old GEPAJob related models.
    • Modified the __all__ list to export the new model names.
  • app/desktop/studio_server/api_client/kiln_ai_server_client/models/body_start_gepa_job_v1_jobs_gepa_job_start_post.py
    • Renamed file to body_start_prompt_optimization_job_v1_jobs_prompt_optimization_job_start_post.py.
    • Updated the class name from BodyStartGepaJobV1JobsGepaJobStartPost to BodyStartPromptOptimizationJobV1JobsPromptOptimizationJobStartPost.
  • app/desktop/studio_server/api_client/kiln_ai_server_client/models/gepa_job_output.py
    • Renamed file to prompt_optimization_job_output.py.
    • Updated the class name from GEPAJobOutput to PromptOptimizationJobOutput.
    • Modified the docstring to refer to 'prompt optimization job'.
  • app/desktop/studio_server/api_client/kiln_ai_server_client/models/gepa_job_result_response.py
    • Renamed file to prompt_optimization_job_result_response.py.
    • Updated the class name from GEPAJobResultResponse to PromptOptimizationJobResultResponse.
    • Modified the docstring to refer to 'prompt optimization job result'.
    • Adjusted type hints to use PromptOptimizationJobOutput.
  • app/desktop/studio_server/gepa_job_api.py
    • Renamed file to prompt_optimization_job_api.py.
    • Updated all API import paths to reflect the new prompt_optimization_job naming.
    • Modified class names like PublicGEPAJobResultResponse to PublicPromptOptimizationJobResultResponse.
    • Renamed functions like gepa_job_from_id to prompt_optimization_job_from_id.
    • Updated API endpoint decorators and their associated function names (e.g., connect_gepa_job_api to connect_prompt_optimization_job_api).
    • Adjusted error messages and log statements to use 'Prompt Optimization job'.
  • app/desktop/studio_server/test_gepa_job_api.py
    • Renamed file to app/desktop/studio_server/test_prompt_optimization_job_api.py.
  • app/web_ui/src/lib/api_schema.d.ts
    • Updated API paths in paths object from gepa_jobs to prompt_optimization_jobs.
    • Renamed component schemas (e.g., GepaJob to PromptOptimizationJob).
    • Modified operation names to align with the new terminology.
  • app/web_ui/src/lib/types.ts
    • Updated type aliases from PublicGEPAJobStatusResponse to PublicPromptOptimizationJobStatusResponse.
    • Renamed GepaJob type to PromptOptimizationJob.
  • app/web_ui/src/lib/ui/kiln_copilot/copilot_required_card.svelte
    • Updated the href for the 'Connect Kiln Copilot' button to /prompt_optimization/copilot_auth.
  • app/web_ui/src/routes/(app)/gepa/[project_id]/[task_id]/+page.svelte
    • Renamed file to app/web_ui/src/routes/(app)/prompt_optimization/[project_id]/[task_id]/+page.svelte.
    • Updated type import from GepaJob to PromptOptimizationJob.
    • Modified variable names (e.g., gepa_jobs to prompt_optimization_jobs).
    • Adjusted function calls (e.g., get_gepa_jobs to get_prompt_optimization_jobs).
    • Updated navigation links and UI text to reflect 'Prompt Optimization'.
  • app/web_ui/src/routes/(app)/gepa/[project_id]/[task_id]/+page.ts
    • Renamed file to app/web_ui/src/routes/(app)/prompt_optimization/[project_id]/[task_id]/+page.ts.
  • app/web_ui/src/routes/(app)/gepa/[project_id]/[task_id]/create_gepa/+page.svelte
    • Renamed file to app/web_ui/src/routes/(app)/prompt_optimization/[project_id]/[task_id]/create_prompt_optimization_job/+page.svelte.
    • Updated API calls to use new prompt_optimization_jobs endpoints.
    • Modified function names (e.g., create_gepa_job to create_prompt_optimization_job).
    • Adjusted navigation links and UI text.
  • app/web_ui/src/routes/(app)/gepa/[project_id]/[task_id]/create_gepa/+page.ts
    • Renamed file to app/web_ui/src/routes/(app)/prompt_optimization/[project_id]/[task_id]/create_prompt_optimization_job/+page.ts.
  • app/web_ui/src/routes/(app)/gepa/[project_id]/[task_id]/gepa_job/[job_id]/+page.svelte
    • Renamed file to app/web_ui/src/routes/(app)/prompt_optimization/[project_id]/[task_id]/prompt_optimization_job/[job_id]/+page.svelte.
    • Updated type import from GepaJob to PromptOptimizationJob.
    • Modified variable names (e.g., gepa_job_id to prompt_optimization_job_id).
    • Adjusted function calls (e.g., get_gepa_job to get_prompt_optimization_job).
    • Updated navigation links and UI text.
  • app/web_ui/src/routes/(app)/gepa/[project_id]/[task_id]/gepa_job/[job_id]/+page.ts
    • Renamed file to app/web_ui/src/routes/(app)/prompt_optimization/[project_id]/[task_id]/prompt_optimization_job/[job_id]/+page.ts.
  • app/web_ui/src/routes/(app)/gepa/copilot_auth/+page.svelte
    • Renamed file to app/web_ui/src/routes/(app)/prompt_optimization/copilot_auth/+page.svelte.
    • Updated success and cancel redirect URLs to use prompt_optimization paths.
  • app/web_ui/src/routes/(app)/gepa/copilot_auth/+page.ts
    • Renamed file to app/web_ui/src/routes/(app)/prompt_optimization/copilot_auth/+page.ts.
  • app/web_ui/src/routes/(app)/prompts/[project_id]/[task_id]/+page.svelte
    • Updated navigation link for 'Optimizer Jobs' to /prompt_optimization/{project_id}/{task_id}.
    • Modified the 'Create Optimized Prompt' link to /prompt_optimization/{project_id}/{task_id}/create_prompt_optimization_job.
  • app/web_ui/src/routes/(app)/prompts/[project_id]/[task_id]/prompt_generators/+page.svelte
    • Updated the navigation link for kiln_prompt_optimizer to /prompt_optimization/{project_id}/{task_id}/create_prompt_optimization_job.
  • libs/core/kiln_ai/datamodel/init.py
    • Removed import for GepaJob.
    • Added import for PromptOptimizationJob.
    • Updated the __all__ list to include PromptOptimizationJob and remove GepaJob.
  • libs/core/kiln_ai/datamodel/gepa_job.py
    • Renamed file to libs/core/kiln_ai/datamodel/prompt_optimization_job.py.
    • Updated class name from GepaJob to PromptOptimizationJob.
    • Modified docstrings and field descriptions to refer to 'prompt optimization job'.
  • libs/core/kiln_ai/datamodel/task.py
    • Removed import for GepaJob.
    • Added import for PromptOptimizationJob.
    • Updated the _model_map to use PromptOptimizationJob instead of GepaJob.
    • Renamed the gepa_jobs method to prompt_optimization_jobs.
  • libs/core/kiln_ai/datamodel/test_gepa_job.py
    • Renamed file to libs/core/kiln_ai/datamodel/test_prompt_optimization_job.py.
    • Updated imports from GepaJob to PromptOptimizationJob.
    • Renamed test functions (e.g., test_gepa_job_creation to test_prompt_optimization_job_creation).
    • Modified variable names and assertions to use prompt_optimization_job.
  • libs/core/kiln_ai/datamodel/test_task.py
    • Updated imports from GepaJob to PromptOptimizationJob.
    • Renamed test functions (e.g., test_task_gepa_jobs_relationship to test_task_prompt_optimization_jobs_relationship).
    • Modified variable names and assertions to use prompt_optimization_job.
Activity
  • The pull request author, leonardmq, created this pull request to refactor the codebase by renaming 'GEPA' to 'Prompt Optimization'.
  • The author has confirmed that tests have been run locally and passed, and new tests have been added where necessary.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link

github-actions bot commented Feb 16, 2026

📊 Coverage Report

Overall Coverage: 91%

Diff: origin/sfierro/optimize-feature...HEAD

  • app/desktop/desktop_server.py (100%)
  • app/desktop/studio_server/prompt_optimization_job_api.py (90.4%): Missing lines 225,236-237,240,642,678,717
  • libs/core/kiln_ai/datamodel/init.py (100%)
  • libs/core/kiln_ai/datamodel/prompt_optimization_job.py (100%)
  • libs/core/kiln_ai/datamodel/task.py (66.7%): Missing lines 192

Summary

  • Total: 81 lines
  • Missing: 8 lines
  • Coverage: 90%

Line-by-line

View line-by-line diff coverage

app/desktop/studio_server/prompt_optimization_job_api.py

Lines 221-229

  221         or not parent_project.id
  222         or not task.id
  223         or not prompt_optimization_job.id
  224     ):
! 225         raise ValueError("Cannot reload Prompt Optimization job: missing required IDs")
  226 
  227     # reload the job in case artifacts were created by another request while waiting for the lock
  228     reloaded_job = prompt_optimization_job_from_id(
  229         parent_project.id,

Lines 232-244

  232     )
  233 
  234     # check if artifacts already exist
  235     if reloaded_job.created_prompt_id:
! 236         prompt_optimization_job.created_prompt_id = reloaded_job.created_prompt_id
! 237         prompt_optimization_job.created_run_config_id = (
  238             reloaded_job.created_run_config_id
  239         )
! 240         prompt_optimization_job.optimized_prompt = reloaded_job.optimized_prompt
  241         return
  242 
  243     result_response = await get_prompt_optimization_job_result_v1_jobs_prompt_optimization_job_job_id_result_get.asyncio(
  244         job_id=prompt_optimization_job.job_id,

Lines 638-646

  638                             ],
  639                             return_exceptions=True,
  640                         )
  641             except Exception as e:
! 642                 logger.error(
  643                     f"Error updating Prompt Optimization job statuses: {e}",
  644                     exc_info=True,
  645                 )

Lines 674-682

  674                         prompt_optimization_job, server_client
  675                     )
  676                 )
  677         except Exception as e:
! 678             logger.error(
  679                 f"Error updating Prompt Optimization job status: {e}", exc_info=True
  680             )
  681 
  682         return prompt_optimization_job

Lines 713-721

  713 
  714         except HTTPException:
  715             raise
  716         except Exception as e:
! 717             logger.error(
  718                 f"Error getting prompt optimization job status: {e}", exc_info=True
  719             )
  720             raise HTTPException(
  721                 status_code=500,

libs/core/kiln_ai/datamodel/task.py

Lines 188-196

  188 
  189     def prompt_optimization_jobs(
  190         self, readonly: bool = False
  191     ) -> list[PromptOptimizationJob]:
! 192         return super().prompt_optimization_jobs(readonly=readonly)  # type: ignore
  193 
  194     # Workaround to return typed parent without importing Task
  195     def parent_project(self) -> Union["Project", None]:
  196         if self.parent is None or self.parent.__class__.__name__ != "Project":


Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a large refactoring to rename the GEPA feature to Prompt Optimization. The changes are extensive, touching many files across the backend, API client, and frontend. Overall, the renaming seems consistent. However, I've found a critical issue where an old job type enum is still being used, which will likely cause status updates for prompt optimization jobs to fail. I've also noted a change in error handling that seems to be a regression. Please see my detailed comments.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app/desktop/studio_server/prompt_optimization_job_api.py (1)

625-639: Comment about exception swallowing is slightly misleading.

The comment at line 631 says "this swallows the exceptions from each call", but asyncio.gather without return_exceptions=True does not swallow exceptions — it propagates the first one. Exceptions are actually swallowed inside update_prompt_optimization_job_and_create_artifacts itself (lines 330-333). The comment should either be moved/reworded, or return_exceptions=True should be added to match the stated intent.

Note that update_prompt_optimization_job_and_create_artifacts can raise HTTPException from lines 293-295 (before the try block), which would propagate through gather and cancel sibling tasks. This is a pre-existing concern, not introduced by this PR.

@leonardmq leonardmq merged commit 71a4d1d into sfierro/optimize-feature Feb 16, 2026
10 checks passed
@leonardmq leonardmq deleted the leonard/kil-410-refactor-rename-gepa-into-prompt-optimization branch February 16, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants