summaryrefslogtreecommitdiff
path: root/src/gap_pipeline/pipeline.py
diff options
context:
space:
mode:
authorAnonymous Authors <anonymous@invalid.example>2026-07-24 14:03:51 -0500
committerAnonymous Authors <anonymous@invalid.example>2026-07-24 14:03:51 -0500
commit708f2af9c6985e9cb5cd53e434a7d3b8dfa2b4ac (patch)
treef4aa3d2240a621e9057ddad2a4d8ec7820db5cde /src/gap_pipeline/pipeline.py
parentd4eb26780a8a8c70ca75812af0c3c6a295c0797c (diff)
Validate path-structured proof-plan DAGHEADmain
Diffstat (limited to 'src/gap_pipeline/pipeline.py')
-rw-r--r--src/gap_pipeline/pipeline.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/gap_pipeline/pipeline.py b/src/gap_pipeline/pipeline.py
index 307ba81..76ae722 100644
--- a/src/gap_pipeline/pipeline.py
+++ b/src/gap_pipeline/pipeline.py
@@ -15,6 +15,7 @@ from .models import (
KernelPlan,
KernelRunResult,
ModelCallRecord,
+ ProofPlanDAG,
)
from .prompts import (
FIX_SYSTEM_PROMPT,
@@ -91,7 +92,10 @@ class KernelPipeline:
)
return response.data
- async def extract_plan(self, item: CanonicalItem) -> KernelPlan:
+ async def extract_plan(
+ self,
+ item: CanonicalItem,
+ ) -> tuple[KernelPlan, ProofPlanDAG]:
request_id = f"{item.item_id}.plan"
payload = await self._call(
self.proposer,
@@ -100,21 +104,10 @@ class KernelPipeline:
user_prompt=kernel_plan_user(item),
)
plan = KernelPlan.model_validate(payload)
- nodes = [
- {
- "node_id": f"n{index}",
- "method_label": step,
- "dependencies": [] if index == 1 else [f"n{index - 1}"],
- }
- for index, step in enumerate(plan.core_steps, start=1)
- ]
+ dag = ProofPlanDAG.from_plan(plan)
self.store.write_stage(
"01_proof_dag",
- {
- "nodes": nodes,
- "terminal_node_id": nodes[-1]["node_id"],
- "construction": "ordered core_steps returned verbatim by Prompt-A",
- },
+ dag,
request_id=request_id,
)
self.store.write_stage(
@@ -130,7 +123,7 @@ class KernelPipeline:
},
request_id=request_id,
)
- return plan
+ return plan, dag
async def generate_candidate(
self,
@@ -163,6 +156,7 @@ class KernelPipeline:
*,
item: CanonicalItem,
plan: KernelPlan,
+ dag: ProofPlanDAG,
candidate: KernelCandidate,
iteration: int,
judge_id: int,
@@ -172,9 +166,9 @@ class KernelPipeline:
judge,
request_id=request_id,
system_prompt=JUDGE_SYSTEM_PROMPT,
- user_prompt=judge_user(item, plan, candidate),
+ user_prompt=judge_user(item, plan, dag, candidate),
)
- return JudgeVerdict.model_validate(payload)
+ return JudgeVerdict.model_validate(payload).validate_coverage(dag)
async def _repair(
self,
@@ -220,8 +214,10 @@ class KernelPipeline:
*,
item: CanonicalItem,
plan: KernelPlan,
+ dag: ProofPlanDAG,
candidate: KernelCandidate,
) -> KernelRunResult:
+ dag.validate_plan(plan)
current = candidate
iterations: list[IterationRecord] = []
pass_streak = 0
@@ -236,6 +232,7 @@ class KernelPipeline:
judge,
item=item,
plan=plan,
+ dag=dag,
candidate=current,
iteration=iteration,
judge_id=judge_id,
@@ -269,6 +266,7 @@ class KernelPipeline:
item_id=item.item_id,
status="accepted",
plan=plan,
+ proof_dag=dag,
accepted_candidate=current,
iterations=iterations,
accepted_candidate_sha256=current_sha,
@@ -288,6 +286,7 @@ class KernelPipeline:
item_id=item.item_id,
status="rejected",
plan=plan,
+ proof_dag=dag,
iterations=iterations,
rejection_reason="no two consecutive unanimous rounds within T=15",
)
@@ -297,10 +296,11 @@ class KernelPipeline:
async def run(self, item: CanonicalItem) -> KernelRunResult:
self.store.write_input(item)
self.store.write_config(self.config)
- plan = await self.extract_plan(item)
+ plan, dag = await self.extract_plan(item)
candidate = await self.generate_candidate(item, plan)
return await self.verify_candidate(
item=item,
plan=plan,
+ dag=dag,
candidate=candidate,
)