Skip to content

gepa: copilot gate and warning fix#1013

Merged
leonardmq merged 4 commits intosfierro/optimizers-gepafrom
leonard/gepa-optimizer-fixes
Feb 12, 2026
Merged

gepa: copilot gate and warning fix#1013
leonardmq merged 4 commits intosfierro/optimizers-gepafrom
leonard/gepa-optimizer-fixes

Conversation

@leonardmq
Copy link
Collaborator

@leonardmq leonardmq commented Feb 11, 2026

What does this PR do?

PR going into: #1012

GEPA-related UI tweaks:

  • fix warning when unexpected error occurs during precheck
  • add Copilot connection gate when user goes to Create an optimizer prompt without having Kiln Copilot
  • refactor Copilot connection into reusable component (to use it in both Specs and here)

User gets this if they do not have Copilot when clicking Create Optimized Prompt:
image

image image

Arbitrary errors show this warning - the Copilot API key missing should no longer show up since we now have the gate upstream:
image

Checklists

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

Summary by CodeRabbit

  • New Features
    • Added a dedicated Kiln Copilot authentication page and route to let users connect Copilot.
    • New UI cards and prompts guide users to connect Copilot when required (shown in task creation and spec flows).
    • App now checks Copilot availability and displays appropriate loading, connect, or fallback states during workflows.
  • UX
    • Streamlined Copilot setup experience by consolidating multi-step flows into the new auth page.

@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 significantly improves the user experience around Kiln Copilot integration, particularly for prompt optimization and spec creation. It introduces a proactive check for Copilot connectivity, guiding users to establish the connection before they can access Copilot-dependent features. By centralizing the authentication flow into a reusable component, it ensures consistency and simplifies future maintenance. Additionally, it refines error reporting, offering clearer, context-specific messages to users when issues arise during prechecks.

Highlights

  • Copilot Connection Gate: Implemented a gate to check for Kiln Copilot connection when users attempt to create an optimized prompt, preventing access to the feature if Copilot is not connected.
  • Reusable Copilot Authentication Component: Refactored the Kiln Copilot connection logic into a new, reusable Svelte component (CopilotAuthPage) to streamline its integration across different parts of the application, such as GEPA and Specs.
  • Improved Error Handling for GEPA: Enhanced the display of warning messages during GEPA prechecks, providing more specific feedback for issues like unsupported tools or models, and preventing generic 'API key missing' warnings.

🧠 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/web_ui/src/lib/ui/kiln_copilot/copilot_auth_page.svelte
    • Added a new Svelte component to provide a generic page for Kiln Copilot authentication, accepting dynamic props for title, docs link, breadcrumbs, and redirect URLs.
  • app/web_ui/src/lib/ui/kiln_copilot/copilot_required_card.svelte
    • Added a new Svelte component to display a standardized card indicating that Kiln Copilot is required for a specific feature, including options to connect or go back.
  • app/web_ui/src/lib/utils/copilot_utils.ts
    • Added a new utility file containing the checkKilnCopilotAvailable function, which asynchronously checks if Kiln Copilot is connected by verifying the presence of an API key.
  • app/web_ui/src/routes/(app)/gepa/[project_id]/[task_id]/create_gepa/+page.svelte
    • Modified to import new Copilot utility functions and components.
    • Integrated a check for Kiln Copilot availability on mount, conditionally rendering a loading spinner or the CopilotRequiredCard.
    • Updated run configuration validation logic to include a run_config_blocking_reason state, allowing for more specific warning messages based on whether tools are used, the model is unsupported, or other errors occur.
  • app/web_ui/src/routes/(app)/gepa/copilot_auth/+page.svelte
    • Added a new Svelte page that acts as a wrapper for the CopilotAuthPage component, configuring it specifically for GEPA-related authentication flows.
  • app/web_ui/src/routes/(app)/gepa/copilot_auth/+page.ts
    • Added a new TypeScript file to disable server-side rendering (SSR) for the GEPA Copilot authentication page.
  • app/web_ui/src/routes/(app)/specs/[project_id]/[task_id]/+page.svelte
    • Modified to import the checkKilnCopilotAvailable utility from the new shared copilot_utils.ts file.
  • app/web_ui/src/routes/(app)/specs/[project_id]/[task_id]/spec_builder/+page.svelte
    • Modified to import the checkKilnCopilotAvailable utility from the new shared copilot_utils.ts file.
  • app/web_ui/src/routes/(app)/specs/[project_id]/[task_id]/spec_utils.ts
    • Removed the checkKilnCopilotAvailable function, as it was refactored and moved to the shared copilot_utils.ts.
  • app/web_ui/src/routes/(app)/specs/copilot_auth/+page.svelte
    • Refactored to utilize the new generic CopilotAuthPage component, replacing its previous custom implementation for Copilot authentication.
Activity
  • Tests have been run locally and passed.
  • New tests have been added to any work in /lib.
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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

Walkthrough

Adds Kiln Copilot UI and utilities: new CopilotAuthPage and CopilotRequiredCard components, a shared checkKilnCopilotAvailable() utility, updates to multiple routes to gate flows on Copilot availability, and a GEPA create page integration that conditionally shows the required card and refines run-config validation blocking reasons.

Changes

Cohort / File(s) Summary
Copilot Authentication Components
app/web_ui/src/lib/ui/kiln_copilot/copilot_auth_page.svelte, app/web_ui/src/lib/ui/kiln_copilot/copilot_required_card.svelte
New Svelte components: CopilotAuthPage (props for title, docs_link, breadcrumbs, success/cancel redirect URLs; renders ConnectKilnCopilotSteps and navigates on success/cancel) and CopilotRequiredCard (props for description, auth_url, optional back link and error; navigates to auth_url).
Copilot Utilities
app/web_ui/src/lib/utils/copilot_utils.ts
New utility exporting checkKilnCopilotAvailable() that GETs /api/settings, validates response, and returns a boolean indicating presence of kiln_copilot_api_key.
GEPA Routes
app/web_ui/src/routes/(app)/gepa/copilot_auth/+page.svelte, app/web_ui/src/routes/(app)/gepa/copilot_auth/+page.ts, app/web_ui/src/routes/(app)/gepa/[project_id]/[task_id]/create_gepa/+page.svelte
New GEPA copilot auth route (SSR disabled) wiring CopilotAuthPage with dynamic breadcrumbs/redirects; GEPA create page now checks Copilot availability on mount, shows CopilotRequiredCard if unavailable, and introduces run_config blocking reasons (has_tools, unsupported_model, other) with adjusted validation flow.
Specs Routes & Utils
app/web_ui/src/routes/(app)/specs/[project_id]/[task_id]/+page.svelte, app/web_ui/src/routes/(app)/specs/[project_id]/[task_id]/spec_builder/+page.svelte, app/web_ui/src/routes/(app)/specs/[project_id]/[task_id]/spec_utils.ts, app/web_ui/src/routes/(app)/specs/copilot_auth/+page.svelte
Relocates checkKilnCopilotAvailable from spec_utils.ts to shared copilot_utils.ts; updates imports. Replaces prior AppPage/ConnectKilnCopilotSteps usage in specs copilot auth page with CopilotAuthPage component and simplifies state/navigation.

Sequence Diagram

sequenceDiagram
    participant Page as GEPA Create Page
    participant CopilotUtil as Copilot Utility
    participant API as API Server
    participant Card as CopilotRequiredCard
    participant TaskLoader as Task Loader

    Page->>CopilotUtil: checkKilnCopilotAvailable()
    activate CopilotUtil
    CopilotUtil->>API: GET /api/settings
    activate API
    API-->>CopilotUtil: { kiln_copilot_api_key: ? }
    deactivate API
    CopilotUtil-->>Page: boolean result
    deactivate CopilotUtil

    alt Copilot Available
        Page->>TaskLoader: load task, prompts, run configs, evals
        TaskLoader-->>Page: data loaded
        Page->>Page: render task UI
    else Copilot Unavailable or Error
        Page->>Card: render CopilotRequiredCard (auth_url, description, error?)
        Card-->>Page: user clicks connect -> goto auth_url
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • sfierro

Poem

🐰 Hopped in to check keys and links,
New auth pages, little hops and winks,
Cards that nudge and utils that peek,
Copilot ready — hooray! I squeak,
Off I go, to celebrate with snacks and kinks. 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'gepa: copilot gate and warning fix' directly matches the PR's main objectives: adding a Copilot connection gate and fixing warning handling in the GEPA flow.
Description check ✅ Passed The description covers all key aspects: what the PR does, related issues, and checklists. It includes helpful context with images showing the user-facing changes and notes tests have been run and added.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch leonard/gepa-optimizer-fixes

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
app/web_ui/src/routes/(app)/gepa/copilot_auth/+page.svelte (1)

17-18: Nit: success_redirect_url and cancel_redirect_url are identical.

Both redirect to /gepa/${project_id}/${task_id}/create_gepa. If cancellation should return the user to the optimizer jobs list rather than back to the create page, consider using /gepa/${project_id}/${task_id} for cancel_redirect_url. If this is intentional (the create page re-gates on mount anyway), no change needed.

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

@github-actions
Copy link

github-actions bot commented Feb 11, 2026

📊 Coverage Report

Overall Coverage: 91%

Diff: origin/sfierro/optimizers-gepa...HEAD

No lines with coverage information in this diff.


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 introduces several improvements for the GEPA optimizer, primarily by adding a gate to ensure Kiln Copilot is connected before allowing users to create an optimized prompt. The changes include refactoring the Copilot authentication flow into a reusable component and moving utility functions to a shared location, which improves code structure and reusability.

I've identified a critical issue where a duplicate onMount hook could bypass the new Copilot connection check. Additionally, there are a few issues with URL construction for navigation that could lead to broken links or a poor user experience. I've provided suggestions to fix these. Overall, the changes are well-structured and address the intended goals.

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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@app/web_ui/src/routes/`(app)/gepa/[project_id]/[task_id]/create_gepa/+page.svelte:
- Around line 216-234: There are two onMount callbacks causing duplicate loads
and bypassing the Copilot gate; remove the redundant second onMount (the one
that unconditionally calls load_task, load_task_prompts, load_task_run_configs,
load_evals_and_configs) so that only the guarded onMount remains, or merge its
logic into the first onMount while preserving the kiln_copilot_connected check
and the copilot error handling in createKilnError; locate the duplicate by the
onMount identifier and the functions load_task, load_task_prompts,
load_task_run_configs, and load_evals_and_configs to ensure you delete/merge the
correct block.
🧹 Nitpick comments (1)
app/web_ui/src/lib/ui/kiln_copilot/copilot_auth_page.svelte (1)

4-4: Inverted dependency: $lib component imports from routes/.

copilot_auth_page.svelte lives in $lib/ui/ but imports AppPage from the routes directory. This inverts the conventional dependency direction (routes/ → $lib/, not the reverse) and could complicate future refactors if AppPage moves. Consider either moving AppPage into $lib or keeping CopilotAuthPage in the routes layer.

@leonardmq leonardmq changed the title Leonard/gepa optimizer fixes gepa: copilot gate and warning fix Feb 11, 2026
@leonardmq leonardmq requested a review from sfierro February 11, 2026 12:24
@leonardmq leonardmq merged commit dc28a49 into sfierro/optimizers-gepa Feb 12, 2026
10 checks passed
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