Show HN: Unbug – A free, automatic bug detector using GPT-3.5 on GitHub CI

github.com

4 points by funerr a year ago

It's an automatic bug detector for GitHub CI, leveraging OpenAI's GPT-3.5 Turbo. It adds an extra layer of scrutiny to every commit, surpassing the capabilities of local IDE checks. I've found it invaluable for my own projects and believe it can benefit teams too. It's currently in its early stages, so proceed with a bit of caution and don't hesitate to share your feedback. You're welcome to contribute (MIT).

peter_l_downs a year ago

Since you say you've found it invaluable for your own projects, can you explain why? What bugs has it found for you that you wouldn't immediately notice by running code or unit tests?

I ask because in the example, you ask it to find bugs in a script that immediately fails when you run it. So I'm not sure what the value add is here.

    $ ipython
    Python 3.11.3 (main, Apr  7 2023, 21:05:46) [Clang 14.0.0 (clang-1400.0.29.202)]
    Type 'copyright', 'credits' or 'license' for more information
    IPython 8.13.2 -- An enhanced Interactive Python. Type '?' for help.

    In [1]: def greet(name, age):
       ...:     print("hello, my name is {} and I am {} years old".format(name))
       ...:
    
    In [2]: greet("John", 25)
    ---------------------------------------------------------------------------
    IndexError                                Traceback (most recent call last)
    Cell In[2], line 1
    ----> 1 greet("John", 25)
    
    Cell In[1], line 2, in greet(name, age)
          1 def greet(name, age):
    ----> 2     print("hello, my name is {} and I am {} years old".format(name))
    
    IndexError: Replacement index 1 out of range for positional args tuple

EDIT: For anyone else who is wondering, this is just:

system prompt:

    Find bugs in the user's code.
    - Format results as JSON like so:
     [{"line":1,"reason":"short reason", "type":"type"},...]
    - It is better to return an empty array than a mistake (not really a bug).
user prompt:

    Here is my code:

    ${source_code}

    JSON Result:

@funerr why would you even create this and post it here? Is it just to try to market your newsletter? Who do you think would look at this and be impressed?
  • funerr a year ago

    I personally use a bit of a different prompt, so it's tailored for my repo. But yeah, you can also customize it pretty simply, like you mentioned in the ./src/ai.ts file.

    This is a blueprint on how to have checks in the CI, it took me sometime to build and get working - do you know anything that does this out of the box? Thanks for the feedback eitherway!