Fixing a regression with git bisect

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MyrinNew
    Senior Member
    • Feb 2024
    • 5168

    #1

    Fixing a regression with git bisect

    This sprint I worked on chatcraft.org where I had the opportunity to fix a regression using git bisect for the first time.







    tarasglek
    /
    chatcraft.org


    Developer-oriented ChatGPT clone






    ChatCraft.org


    Welcome to ChatCraft.org, your open-source web companion for coding with Large Language Models (LLMs). Designed with developers in mind, ChatCraft transforms the way you interact with GPT models, making it effortless to read, write, debug, and enhance your code.

    Whether you're exploring new designs or learning about the latest technologies, ChatCraft is your go-to platform. With a user interface inspired by GitHub, and editable Markdown everywhere, you'll feel right at home from the get-go.




    Features


    We think ChatCraft is the best platform for learning, experimenting, and getting creative with code. Here's a few of the reasons why we think you'll agree:

    🛠️ You're in Control: Customize all aspects of a chat. Use your own System Prompts, edit, delete, and retry AI messages with models from competing vendors in the same chat.

    🌍 Multiple AI Providers: ChatCraft supports both OpenAI and OpenRouter, giving you access to a…





    View on GitHub





    Issue 1

    I mostly spent time looking into this issue which listed a number of bugs in the user settings modal:







    openrouter mostly broken in settings

    FTC Issues New Proposed Rule Focused...d Testimonials








    tarasglek
    posted on Mar 04, 2025





    For repro
    1. use chatcraft.org in private window.
    2. open settings


    Click on checkbox next to openrouter



    it selects openai


    Click on openrouter api key box


    1. It now shows up the magic "get openrouter key" box...We should probably surface that better
    2. Click it, login
    3. Observe how openrouter key was not added




    View on GitHub







    This issue outlined three bugs:

    1. Clicking any of the checkboxes for choosing the LLM provider in the settings modal would always result in the first provider being selected.
    2. The "Get OpenRouter Key" button would only show when the API key input field was focused, which was bad for the option's discoverability.
    3. The button doesn't actually work.


    Bug 1: Broken LLM selection in settings

    I spent two days looking into this bug. I had a hunch it was a regression because I figured surely the UI for this must have worked at some point, but there hadn't been any recent changes to the component. I tried to investigate by checking out the last commit that touched the LLM selection code, but I ran into errors installing the dependencies. pnpm said it couldn't find the dependencies, which I assume was because the versions were just that old.


    After that I gave up on the regression idea (in hindsight, I should've kept digging) and instead tried looking into the current code. I had no luck trying to debug the existing logic, so I tried to re-create the component from scratch. I noticed it worked until I wrapped the
Working...