← All use cases

中文

Building software · Codex

Leave an agent hunting a bug overnight against a repeatable test

Idea + starter prompt, not run by us yet

For: Developers with a bug they cannot explain and no time to dig through it by hand

The author sets Codex loose overnight, for several hours, on a bug with no clear cause. The key is a unit test that repeats the bug every time through the app's main entry point. The agent adds debug prints and tests ideas about the cause on its own.

Steps

  1. Write a test that fails the same way every time, starting from the app's normal entry point.
  2. Work on a separate branch so nothing reaches your main code.
  3. Paste the starter prompt and let it run while you are away.
  4. In the morning, read its notes and check the cause it found before keeping any change.

Starter prompt

Starter prompt. Change the [brackets] first.

The test [test name] fails every time. Run it with [command]. I do not know why.

Work on branch [branch name] only. Add debug prints, form ideas about the cause and test them one by one against this test. Keep a running log in [notes file] of each idea and what you found.

Do not push, merge or delete anything. When you stop, write a summary of the most likely cause and the evidence for it.

Original post: Hacker News · found via agentusecases.ai. Written up in our own words. We haven't run it, so test it on made-up data first.