RegoMender: A Multi-agent Framework for Automated Rego Policy Repair
Authors: Ruijie Zhang, Huaxiao Yin, Li Hu, Fanqi Kong, Haozhe Liang, Shaoyin Cheng, Kun Zhang, Bibo Tu
Organizations: Institute of Information Engineering, Chinese Academy of Sciences Beijing, China School of Cyber Security, University of Chinese Academy of Sciences Beijing, China · University of Science and Technology of China Hefei, China · Peking University Beijing, China · University of Chinese Academy of Sciences Beijing, China · Anhui Province Key Laboratory of Digital Security, Hefei, China
Policy-as-Code (PaC) has emerged as a foundational paradigm in cloud-native systems. However, repairing Rego policies remains challenging due to their strict syntax, declarative semantics, and specific verification requirements. Existing automated program repair (APR) methods are mainly designed for mainstream languages and struggle to accommodate the unique policy logic and repair workflows of Rego. Thus, Rego policy repair remains a manual process driven by trial and error. To address this, we introduce RegoBench, the first automated Rego policy benchmark comprising 1,159 real-world defects, and propose RegoMender, a feedback-guided multi-agent framework. Collaborating via a shared blackboard and an atomic toolkit, RegoMender dynamically executes patching, rewriting, or rolling back, to resolve complex repair scenarios. Evaluated on RegoBench, RegoMender achieves syntactic and test-based semantic success rates of 82.9% and 77.9%, respectively, outperforming the strongest baseline by 13.4%. Unlike other approaches whose performance drops in complex scenarios, RegoMender maintains effectiveness across single-step and chained repair tasks. Furthermore, it generalizes strongly across HCL and SQL and achieves an 86.4% repair rate on 132 real-world CVE vulnerabilities, proving its robustness and practical utility for security.
Figures & tables
Figure 1. An Example for Rego Policy Repair.
Figure 2. Overview of RegoBench Construction and RegoMender Workflow.
Defect Type
Symptom
Number
PARSE
parse error / rule-head / Rego.v1
348
BIND
binding operator / scope
93
REF
unsafe var / undefined ref / import mismatch
162
TYPE
type error / arity / built-in / helper contract
209
PATH
missing path / input shape
81
RULE
recursion / conflicting rules / defaults
70
Table 1. Defect Taxonomy of RegoBench.
Method
Pass@Tier-1 (%)
Pass@Tier-2 (%)
JudgePass (%)
Cost / Effort
Easy
Medium
Hard
Overall
Easy
Medium
Hard
Overall
Easy
Medium
Hard
Overall
Budget ($)
Time (h)
LLM Calls
Regr.%
Standalone Methods
Agentless ( Xia et al., 2024 )
66.7 ± 1.8
60.0 ± 1.6
46.7 ± 1.9
59.9 ± 1.5
61.4 ± 1.7
54.0 ± 1.5
41.1 ± 1.8
54.3 ± 1.4
58.0 ± 1.6
50.2 ± 1.5
37.0 ± 1.6
50.6 ± 1.3
4.8 ± 0.2
2.6 ± 0.2
2,614 ± 74
17.5 ± 1.6
ThinkRepair ( Yin et al., 2024 )
71.1 ± 2.0
46.9 ± 1.8
27.8 ± 1.6
53.3 ± 1.4
65.1 ± 1.9
42.0 ± 1.6
24.1 ± 1.4
48.2 ± 1.1
60.2 ± 1.9
37.9 ± 1.5
20.9 ± 1.5
43.9 ± 1.2
3.9 ± 0.2
2.2 ± 0.1
1,998 ± 61
26.3 ± 1.8
APR-MCTS ( Hu et al., 2025a )
73.3 ± 1.9
54.5 ± 1.7
46.7 ± 1.8
61.1 ± 1.5
67.4 ± 1.8
49.1 ± 1.6
41.1 ± 1.7
55.4 ± 1.7
64.0 ± 1.7
45.9 ± 1.5
37.0 ± 1.7
51.9 ± 1.6
6.2 ± 0.3
2.7 ± 0.2
4,995 ± 118
15.8 ± 1.4
RepairAgent ( Bouzenia et al., 2025 )
84.6 ± 1.6
64.2 ± 1.4
51.5 ± 1.5
70.4 ± 1.3
78.5 ± 1.5
58.4 ± 1.3
45.8 ± 1.4
64.5 ± 1.2
75.9 ± 1.4
55.4 ± 1.5
42.4 ± 1.4
61.5 ± 1.3
5.2 ± 0.2
2.9 ± 0.2
2,664 ± 72
14.8 ± 1.2
Table 2. Performance Comparison of Repair Methods on RegoBench.
Figure 3. Repair Success Rates for Different Defect Types.
Models
Size
ThinkRepair
RepairAgent
RegoMender
Easy
Medium
Hard
Overall
Budget
Time
Easy
Medium
Hard
Overall
Budget
Time
Easy
Medium
Hard
Overall
Budget
Time
Closed-Source LLMs
GPT-4.1 ( OpenAI, 2025 )
-
72.3
47.1
28.4
54.0
21.0
3.2
58.7
40.2
32.1
46.6
26.4
4.1
89.2
72.4
58.3
76.6
47.3
7.3
Claude-3.5-Sonnet ( Anthropic, 2024 )
-
82.1
55.3
33.2
62.1
27.0
2.4
72.4
58.1
48.3
62.2
33.8
3.0
92.3
76.2
60.1
79.7
60.8
5.4
Gemini-2.5-Flash ( Comanici et al., 2025 )
-
35.2
22.1
12.3
25.7
10.0
2.7
80.3
62.1
52.2
67.9
12.6
3.4
90.1
70.3
57.2
76.1
22.5
6.1
GPT-5.4 ( OpenAI, 2026b )
–
81.5
58.4
38.6
64.2
17.8
3.0
84.6
65.8
53.4
71.5
22.5
3.6
95.2
76.5
61.0
81.1
41.2
6.4
Table 3. Performance Comparison of Repair Methods on RegoBench across Different Backbones.
Figure 4. Repair Success: Single-step vs. Chained.
Figure 5. Chained Repair Process. RegoMender resolves syntax errors then passes semantic tests to produce a verified patch.
Tool
RepairAgent (%)
RegoMender (%)
Full Toolkit
64.5
77.9
w/o Context Scan
49.2 (↓15.3)
61.2 (↓16.7)
w/o Patch
51.7 (↓12.8)
64.1 (↓13.8)
w/o Rollback
—
66.4 (↓11.5)
w/o Rewrite
56.4 (↓8.1)
68.6 (↓9.3)
w/o Error Triage
55.1 (↓9.4)
67.2 (↓10.7)
Table 4. Ablation Study on Tool Effectiveness.
DSL
N
Avg.Errors
RepairAgent (%)
RegoMender (%)
Rego
1,159
6.2
64.5
77.9
HCL
300
4.6
78.2
82.3
SQL
100
1.0
84.0
84.0
Table 5. Cross-DSL Generalization Performance.
CWE
Description
N
ThinkRepair
RepairAgent
RegoMender
CWE-284
Access Control
31
28.1%
71.9%
87.5%
CWE-250
Excess Privilege
28
27.6%
72.4%
89.7%
CWE-269
Privilege Mgmt
25
26.9%
69.2%
88.5%
CWE-732
Permission Assign
21
27.3%
68.2%
82.0%
CWE-863
Incorrect Authz
19
20.0%
60.0%
80.0%
Other
Mixed Types
9
30.0%
50.0%
90.0%
Table 6. Security Policies Repair Rates by CWE Category.