Skip to content

feat(loop): Phase E — closed-loop proposal engine, build/verify/run/analyze cycle#31

Draft
tbitcs wants to merge 1 commit into
phase-nextfrom
overhaul/loop
Draft

feat(loop): Phase E — closed-loop proposal engine, build/verify/run/analyze cycle#31
tbitcs wants to merge 1 commit into
phase-nextfrom
overhaul/loop

Conversation

@tbitcs
Copy link
Copy Markdown
Contributor

@tbitcs tbitcs commented Jun 1, 2026

Phase E — Integrated Research Loop Upgrade

Replaces the old pick-template + run-template pattern with a closed-loop
Propose → Build → Verify → Run → Analyze pipeline.

Backend changes

New module: backend/glossa_lab/loop_proposal.py

  • ProposalEngine class: ranks 2-3 experiment candidates per cycle using rule-based scoring (insight alignment, historical success, novelty)
  • Anti-duplication: seen_experiments set + cooldown_map (5-cycle min)
  • build_experiment(): instantiates runnable experiment from proposal
  • verify_before_run(): pre-flight checks (anchor counts, corpus availability)
  • analyze_result(): post-run metric extraction, trend detection, regression flags

Modified: backend/glossa_lab/pipelines/research_loop.py

  • ResearchLoop.run() now uses Propose → Build → Verify → Run → Analyze
  • Per-cycle timeout (300s default) with _CycleTimeoutError
  • Partial results saved to outputs/partial_loop_result.json on failure
  • New SSE events: proposal_selected, build_complete, verify_result, analysis_complete, cycle_timeout, gap_skipped
  • get_full_results() returns top_findings and proposed_next

Modified: backend/glossa_lab/api/research_loop.py

  • Event stream handles new SSE event types
  • _build_synthesis() includes top_findings and proposed_next
  • Queue timeout increased to 360s for longer cycles

Frontend changes

Modified: frontend/src/components/ResearchLoopPanel.tsx

  • New TopFinding and ProposedNext interfaces on Synthesis
  • Top findings section in RunSummary with experiment/metric/interpretation
  • Proposed next experiments section with one-click Run buttons
  • SSE event handling for proposal, verify, analysis, timeout, skip events
  • Protocol description updated to Propose → Build → Verify → Run → Analyze

Build validation

  • Frontend: npx tsc -b passes with 0 errors
  • Backend: py_compile passes for all 3 modified/new Python files

Conversation: https://app.warp.dev/conversation/74b8ed01-18ef-4b4a-999f-4ae46fd6bdf8
Run: https://oz.warp.dev/runs/019e84ec-7a75-7d7b-9fa1-ed7e944dfc53
This PR was generated with Oz.

…nalyze cycle, failure handling, result feedback

Co-Authored-By: Oz <oz-agent@warp.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant