feat: Task Pipeline + Planner E2E 성공 — stdin기반 GeminiCaller 확정 #task-189 #task-190

This commit is contained in:
quantlab
2026-03-06 17:37:06 +09:00
parent 9192770300
commit 57c9cb6143
7 changed files with 357 additions and 26 deletions

View File

@@ -0,0 +1,56 @@
"""E2E Test: Task Pipeline with real Gemini CLI.
Tests Planner phase against the variet-agent project.
"""
import sys
import io
import asyncio
import json
if sys.stdout.encoding != "utf-8":
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
sys.path.insert(0, r"C:\Users\CafeVariet-GL552VW\Desktop\source_diff\variet-agent")
from core.task_pipeline import TaskPipeline
PROJECT = r"C:\Users\CafeVariet-GL552VW\Desktop\source_diff\variet-agent"
async def test_planner():
print("=" * 60)
print("E2E TEST: Planner")
print("=" * 60)
pipeline = TaskPipeline(PROJECT, token_budget=30_000)
pipeline.setup()
plan = await pipeline.plan(
"project_indexer.py의 find_relevant 함수가 공백이 포함된 쿼리를 처리하지 못합니다. "
"'gemini caller'로 검색하면 gemini_caller.py를 찾지 못합니다. "
"밑줄과 공백을 동일하게 처리하도록 개선해주세요."
)
print(f"\n📋 Plan result:")
print(json.dumps(plan, ensure_ascii=False, indent=2))
if plan.get("tasks"):
print(f"\n✅ Planner returned {len(plan['tasks'])} tasks")
for t in plan["tasks"]:
print(f" - {t.get('title', t.get('id', '?'))}: {t.get('description', '')[:80]}")
else:
print(f"\n⚠️ No structured tasks, raw response:")
print(plan.get("raw", plan.get("summary", ""))[:500])
return plan
async def main():
plan = await test_planner()
print(f"\n{'=' * 60}")
print(f"Gemini calls: {1}")
print(f"✅ E2E Planner test complete!")
if __name__ == "__main__":
asyncio.run(main())

38
tests/test_quick.py Normal file
View File

@@ -0,0 +1,38 @@
"""Debug: test --system flag with stdin."""
import asyncio, tempfile, os
async def test():
# Write system prompt to temp file
sys_file = tempfile.NamedTemporaryFile(mode="w", suffix=".md", delete=False, encoding="utf-8")
sys_file.write("You are a planner. Respond with a JSON object containing: summary, tasks array.")
sys_file.close()
ctx = "List 2 tasks to improve a Python project. Respond in JSON format."
print(f"System file: {sys_file.name}")
print(f"Context length: {len(ctx)}")
# Test 1: with --system
proc = await asyncio.create_subprocess_exec(
"cmd", "/c",
f"gemini --system {sys_file.name} --approval-mode yolo",
stdin=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
stdout, stderr = await asyncio.wait_for(
proc.communicate(input=ctx.encode("utf-8")),
timeout=90
)
out = stdout.decode('utf-8', errors='replace')
err = stderr.decode('utf-8', errors='replace')
lines = [l for l in out.splitlines() if "YOLO" not in l and "Loaded cached" not in l]
print(f"\nSTDOUT ({len(out)} bytes): {out[:500]}")
print(f"STDERR ({len(err)} bytes): {err[:500]}")
print(f"CLEANED: {'|'.join(lines[:10])}")
os.unlink(sys_file.name)
asyncio.run(test())