This project is a high-performance, industrial-grade autonomous agent system designed to fix build errors in OSS-Fuzz. It leverages LLMs (DeepSeek) and a multi-agent orchestration framework (google-adk) to perform environment locking, root cause analysis, and dual-track (Config vs. Source) code repair.
- 1+6 Validation Criteria: A robust verification engine that ensures a fix is truly successful.
- Step 1 (Primary Build): Successful generation of executable target binaries.
- Step 6 (Runtime Stability Audit): A mandatory 45s critical stability test ensuring execution speed (exec/s) > 0.
- Steps 2-5 (Quality Metrics): Verification of Sanitizer injection (ASan), Engine symbols (libFuzzer/AFL++), Project logic linking, and Shared dependency integrity.
- HAFix (Heuristic History-Enhanced Localization): Automatically identifies the "Buggy Commit" by analyzing Git history (
git blame,fl_diff,fn_pair) to provide temporal context for the LLM. - Physical State Tree Rollback: Utilizes Git to manage physical snapshots of the environment. If a repair path deteriorates (score > 7), the system performs a physical
git resetto a stable state and clears the previous analysis bias. - Token-Efficient Memory Management:
- Prune Session History: A whitelist-based strategy that physically wipes intermediate tool call noise (ls, find, read_file) while retaining core reasoning.
- Context Truncation: Specialized
tail_100_lineslogging and summary agents keep context within the 131k token limit.
- Expert Knowledge RAG-Lite: Matches build log patterns against a curated
expert_knowledge.jsonto inject strategic guidance for complex infrastructure issues (e.g., WORKDIR conflicts).
.
├── agent.py # Main Orchestrator & Loop Logic
├── agent_tools.py # Core Tools (Git, Build, 1+6 Validation, RAG)
├── oss-fuzz/ # Local OSS-Fuzz infrastructure (Must be at this level)
├── instructions/ # Agent Persona & Workflow Instructions
├── expert_knowledge.json # Expert Pattern Knowledge Base
├── projects.yaml # Project Task List (Metadata Source)
├── process/
│ └── project/ # Cloned Target Software (e.g., ./process/project/curl)
│ └── fixed/ # Archived successful repairs with full content
└── agent_logs/ # Real-time console & mirrored event logs
Here is the content converted into a professional Markdown format, ready to be used in your `README.md`:
---
## 🛠️ Setup Requirements
* **Python**: 3.10+
* **System Utilities**:
* **GitHub CLI (`gh`)**: Must be installed and authenticated (`gh auth login`).
* **Docker**: Required for OSS-Fuzz containerized builds.
* **Standard Tools**: `nm`, `ldd`, `python3`.
* **API Key**: A valid DeepSeek API key set in a `.env` file.
```bash
# Install required Python libraries
pip install litellm google-adk requests openpyxl pyyaml python-dotenv
DPSEEK_API_KEY='your_api_key_here'- project: example_project
sha: <oss_fuzz_commit_sha>
software_repo_url: <target_git_url>
software_sha: <target_software_commit_sha>
base_image_digest: <docker_image_hash>
engine: libfuzzer
sanitizer: address
architecture: x86_64
fixed_state: 'no'
state: 'no'initial_setup_agent locks the Docker base image digest and checkouts the exact Git SHAs. It enforces build_mode: source for local mounting.
- Build & 1+6 Audit:
run_fuzz_and_collect_log_agentexecutes the build viarun_fuzz_build_and_validate. - Decision:
decision_agentchecks if Step 1 (Build) and Step 6 (Runtime) both passed. - Reflection:
reflection_agentassigns a Deterioration Score (1-10) based on the 1+6 metrics. - Rollback: Catastrophic failures trigger a physical environment revert via Git.
- Diagnosis (HAFix):
commit_finder_agentlocates the buggy commit using temporal or trace analysis. - Solve & Apply:
fuzzing_solver_agentgenerates a multi-file Patch Plan, which is then applied bysolution_applier_agent.
Successful fixes are validated, archived to process/fixed/ with full content, and the projects.yaml report is updated.
- Anchor Integrity: Patching requires an exact byte-for-byte match of the
ORIGINALblock. - Observability: All STDOUT and STDERR are mirrored to
agent_logs/viaStreamTeefor post-mortem debugging.
python agent.py