Query-based static analyzers such as CodeQL encode vulnerability patterns in detection queries. Existing queries can miss vulnerabilities or flag benign code, and broadening them can trade false negatives for false positives. We present ARQ, an agentic framework that refines C/C++ CodeQL queries with execution-grounded evidence from synthesized programs. ARQ compares a program's instrumented behavior with CodeQL's verdict, then uses validated false-negative and false-positive witnesses, including near-identical program pairs, to guide LLM-based refinement and regression testing. We evaluate ARQ by refining 12 official CodeQL queries with GPT-5.4, Claude-Sonnet-4.6, and Gemini-3.5-flash. On Juliet v1.3 and FormAI v2, refined queries detect up to 119.8\% more true-positive query--sample detections than the original queries while maintaining precision of at least 98.0\%. Moreover, ARQ addresses three unresolved CodeQL issues by correctly classifying their supplied reproducers and identifies two previously unreported candidate bugs in \texttt{libpng} and \texttt{zlib}. These results demonstrate that ARQ can substantially expand the execution-validated coverage of production CodeQL queries while preserving high precision across diverse benchmarks and real-world cases.
翻译:暂无翻译