Add bugfix benchmark run live-4b3698c4
Browse files- runs/live-4b3698c4.json +66 -0
runs/live-4b3698c4.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"run_id": "live-4b3698c4",
|
| 3 |
+
"created_at": "2026-11-19T19:03:58.273507+00:00",
|
| 4 |
+
"repo": "/tmp/bugfix-clone-v9gbv1nt",
|
| 5 |
+
"issue_title": "backend/agent.py \u2013 clean_json_response returns None instead of cleaned JSON string",
|
| 6 |
+
"issue_body": "In the function `backend.agent.clean_json_response`, when called with a string that contains a JSON code block (e.g., \"```json\\n{\\\"key\\\": \\\"value\\\"}\\n```\"), the function extracts the inner JSON text but never returns it. The current behavior is that the function returns `None`, causing downstream code that expects a JSON string to fail with a TypeError or JSONDecodeError. The function should return the cleaned JSON string (or the original text if no code block is found). Example:\n```python\ntext = \"```json\\n{\\\"answer\\\": 42}\\n```\"\nresult = clean_json_response(text)\n# Expected result: '{\"answer\": 42}'\n# Actual result: None\n```",
|
| 7 |
+
"status": "escalated",
|
| 8 |
+
"iterations": 0,
|
| 9 |
+
"findings_count": 7,
|
| 10 |
+
"findings": [
|
| 11 |
+
{
|
| 12 |
+
"severity": "Critical",
|
| 13 |
+
"file_path": "backend/agent.py",
|
| 14 |
+
"title": "clean_json_response does not return the cleaned JSON string",
|
| 15 |
+
"description": "The function extracts JSON from markdown code fences but never returns the cleaned text, resulting in `None` being propagated to callers. This leads to downstream JSON parsing errors and crashes when the LLM response is wrapped in a code block.",
|
| 16 |
+
"suggested_fix": "Add a `return clean_text` statement at the end of the function. Also ensure that when no code block is found, the original stripped text is returned."
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"severity": "Medium",
|
| 20 |
+
"file_path": "backend/app.py",
|
| 21 |
+
"title": "Potential ValueError in provider selectbox default index",
|
| 22 |
+
"description": "The Streamlit sidebar uses `list.index(st.session_state.config.get(\"llm_provider\", \"gemini\"))` to set the default index of the provider selectbox. If the stored config contains a value not present in the allowed list (e.g., a typo or deprecated provider), `list.index` raises a `ValueError`, crashing the app on startup.",
|
| 23 |
+
"suggested_fix": "Replace the direct `index(...).` call with a safe lookup, e.g., `providers = [\"gemini\", \"groq\", \"openai\", \"ollama\"]; default = st.session_state.config.get(\"llm_provider\", \"gemini\"); index = providers.index(default) if default in providers else 0`."
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"severity": "Low",
|
| 27 |
+
"file_path": "run.py",
|
| 28 |
+
"title": "Missing verification of successful dependency installation",
|
| 29 |
+
"description": "After attempting to install missing packages via `subprocess.check_call`, the script prints a success message regardless of whether the installation actually succeeded (e.g., network failure). Subsequent imports may still fail, leading to obscure errors later.",
|
| 30 |
+
"suggested_fix": "Capture the return code of `check_call` or wrap it in a try/except that re\u2011raises or exits with a clear error if installation fails."
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"severity": "Low",
|
| 34 |
+
"file_path": "backend/app.py",
|
| 35 |
+
"title": "Static files directory may be unintentionally exposed",
|
| 36 |
+
"description": "The FastAPI app mounts the `frontend` directory as static files without restricting paths. If sensitive files are added to that folder, they could be served publicly.",
|
| 37 |
+
"suggested_fix": "Serve only the necessary static assets or configure a more restrictive static files mount, e.g., `app.mount(\"/static\", StaticFiles(directory=FRONTEND_DIR, html=True), name=\"static\")` and ensure no secret files reside there."
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"severity": "High",
|
| 41 |
+
"file_path": "backend/rag_engine.py",
|
| 42 |
+
"title": "Inconsistent return type in get_embeddings for single string input",
|
| 43 |
+
"description": "When `texts` is a string, `get_embeddings` returns a flat list of floats instead of a list containing one embedding list. This breaks the contract that the function always returns a list of embedding vectors, leading to potential TypeErrors in callers that iterate over embeddings.",
|
| 44 |
+
"suggested_fix": "Wrap the single\u2011string embedding in a list before returning, e.g., `return [model.encode(texts).tolist()]`."
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"severity": "Low",
|
| 48 |
+
"file_path": "backend/rag_engine.py",
|
| 49 |
+
"title": "extract_text_from_file silently ignores unsupported file extensions",
|
| 50 |
+
"description": "The function parses only `.pdf`, `.docx`, `.txt`, and `.md` files. For any other extension it returns an empty list without warning, which can make debugging difficult and may hide user errors.",
|
| 51 |
+
"suggested_fix": "Add an `else` clause that raises a clear `ValueError` or logs a warning for unsupported extensions."
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"severity": "Medium",
|
| 55 |
+
"file_path": "backend/config.py",
|
| 56 |
+
"title": "load_config swallows JSON decode errors and returns defaults without fixing the corrupted file",
|
| 57 |
+
"description": "If `config.json` exists but contains invalid JSON, `load_config` catches the exception, prints an error, and returns the default configuration. The corrupted file remains on disk, causing the same error on every load and potentially confusing users.",
|
| 58 |
+
"suggested_fix": "After catching the exception, rename or delete the corrupted file and write a fresh default config, or at least provide a way to recover the file."
|
| 59 |
+
}
|
| 60 |
+
],
|
| 61 |
+
"repro_test_path": "test_repro_bug.py",
|
| 62 |
+
"repro_test": "import sys\nimport types\nimport importlib\n\n# Prepare a lightweight dummy module for backend.rag_engine to avoid heavy imports\ndummy_rag_engine = types.ModuleType(\"backend.rag_engine\")\n# The agent only needs the `search_similar_chunks` symbol at import time\ndummy_rag_engine.search_similar_chunks = lambda *args, **kwargs: None\n# Insert the dummy into sys.modules before importing the agent\nsys.modules[\"backend.rag_engine\"] = dummy_rag_engine\n\n# Now import the function under test\nfrom backend.agent import clean_json_response\n\n\ndef test_clean_json_response_extracts_json():\n \"\"\"The function should strip markdown code\u2011block fences and return the inner JSON string.\n The current buggy implementation returns ``None`` which makes this test fail.\n \"\"\"\n text = \"```json\\n{\\\"answer\\\": 42}\\n```\"\n result = clean_json_response(text)\n assert result == '{\"answer\": 42}', \"clean_json_response did not return the expected JSON string\"\n\n\ndef test_clean_json_response_without_code_block_returns_original():\n \"\"\"When no markdown fences are present the original (stripped) text should be returned.\n This ensures the function behaves sensibly for non\u2011code\u2011block inputs.\n \"\"\"\n text = \" {\\\"key\\\": \\\"value\\\"} \"\n result = clean_json_response(text)\n assert result == '{\"key\": \"value\"}'\n",
|
| 63 |
+
"fix_rationale": "",
|
| 64 |
+
"patch_unified_diff": "",
|
| 65 |
+
"commit_sha": null
|
| 66 |
+
}
|