Inspiration
Debugging can be frustrating, especially for independent developers and small teams who may not have access to expensive debugging and monitoring tools. Developers need more than an explanation of an error — they need help investigating the cause, finding a possible fix, and checking whether that fix actually works.
That inspired us to build TraceLens AI, a debugging assistant designed to turn failing tests into a validated repair workflow.
What it does
TraceLens AI analyzes a software project, discovers its testing framework and test files, runs tests, and collects evidence from failures. It uses a locally running AI model to investigate the failure and propose a code fix. The proposed patch is then validated by running the tests again. Only after successful validation and user approval does TraceLens apply the fix.
Unlike a tool that only explains an error, TraceLens connects investigation, repair, and verification in one workflow.
How we built it
We built TraceLens AI in Python, with a Streamlit interface and Ollama to run the AI model locally using llama3.2:3b.
The project combines:
- Project discovery: Identifies test files and the testing framework.
- Automated testing: Executes tests and captures their results.
- Evidence-based investigation: Collects test failures and relevant source code before generating a diagnosis.
- AI-assisted repair: Generates a proposed code patch.
- Patch validation: Runs tests against the proposed fix before allowing it to be applied.
- User-controlled changes: Requires approval before modifying the original source file.
We also implemented safeguards, including patch-path validation and automated tests for important parts of the workflow.
Challenges we faced
One challenge was making the AI repair workflow reliable. AI models do not always return code in the same format, so we had to improve patch extraction to handle responses that were not enclosed in code fences.
Another challenge was ensuring that a plausible-looking fix was not automatically treated as a correct fix. We addressed this by making test results the deciding factor: the proposed patch must pass validation before it can be applied.
We also encountered a Windows environment issue involving Streamlit and PyArrow. We adjusted how test-file information was displayed rather than disabling system security protections.
What we learned
Building TraceLens AI taught us that an AI-generated answer is not enough for reliable software repair. A useful debugging assistant needs evidence, controlled code changes, and an independent way to verify its suggestions.
We learned how to integrate a local language model into a Python application, orchestrate subprocess-based test execution, process AI-generated patches, and design a workflow in which automated tests provide the final validation.
What's next
We want to extend TraceLens to support more testing frameworks and programming languages, improve patch generation for complex failures, and strengthen its safety and validation mechanisms.
Our goal is to make evidence-driven debugging and repair more accessible to developers without requiring expensive hosted AI services.
Built With
- 3.2
- ai
- artificial
- automated
- code
- debugging
- developer
- engineering
- intelligence
- language
- large
- llama
- local
- models
- ollama
- open
- python
- repair
- software
- source
- streamlit
- testing
- tools
- unit
Log in or sign up for Devpost to join the conversation.