Commit Graph

12 Commits

Author SHA1 Message Date
Glevel da40caa637 feat: trap detection - validate teacher comment before rework
New flow for rework with comments:
1. Read current code files from Gitea
2. LLM validates if comment is justified or a trap
3a. TRAP (invalid): add objection to README.md, submit without code changes
3b. VALID: analyze fixes/defenses, regenerate code

Added: _VALIDATE_PROMPT, _OBJECTION_TEMPLATE, validate_comment(),
gitea_read(), gitea_list_files()

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-06-04 19:52:36 +03:00
Glevel 7faae42204 feat: stronger defense arguments in rework analysis
Analyze prompt now asks for 4-part structured argument per defense:
  ZAMECHANIE / NEOBKHODIMOST / OPTIMALNOST / ALTERNATIVY

Generated code gets DESIGN DECISION / NECESSITY / OPTIMALITY /
ALTERNATIVES CONSIDERED comment blocks instead of bare NOTE.

Agent argues that choices were deliberate, necessary and optimal -
not just correct.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-06-04 19:41:17 +03:00
Glevel 02ed3aa99f fix: detect rework via Gitea repo existence, not BroJS answer field
BroJS clears the answer field when rejecting a task, so repo_url was
always None on rework. Now we check Gitea API directly — if the repo
exists, it's a rework regardless of BroJS answer state.
Comments are still read from BroJS task_get.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-06-04 19:30:30 +03:00
Glevel 39019e2574 feat: analyze teacher comments before rework (defend solution)
Add analyze_comments() that calls LLM to evaluate each teacher comment:
- valid criticism -> fixes list (LLM will fix these)
- incorrect/misunderstood -> defenses list (LLM adds NOTE: comments in code)
Verdict: needs_fixes | already_correct | mixed

solve() now prints analysis verdict and counts before generation.
Commit message on rework includes verdict + fix/defense counts.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-06-04 19:21:39 +03:00
Glevel 07d7d01996 fix: ban Ollama in prompt, use OpenAIEmbeddings for ChromaDB RAG
Explicitly forbid langchain_ollama/OllamaEmbeddings in _PROMPT.
ChromaDB template now uses OpenAIEmbeddings via OpenRouter.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-06-04 19:18:43 +03:00
Glevel ec197b7e98 docs: explain OpenRouter vs Ollama choice
README: add comparison table section
solve_task.py: add comment in LLM template explaining model choice

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-06-04 19:13:54 +03:00
Glevel 863ea54eaf fix: безопасная перекодировка stdout/stderr и рекурсивная проверка 429
- reconfigure() вместо нового TextIOWrapper — не ломается при редиректе
- _is_429() с рекурсивным обходом ExceptionGroup (anyio оборачивает 429)
- except BaseException в _load_mcp / mcp_call для перехвата ExceptionGroup

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-06-04 19:00:14 +03:00
Glevel 9cb3731dda fix tasks command: show all tasks with statuses, not only todo
- solve_task: add fetch_all_tasks() for monitoring all task statuses
- console.py: tasks command now uses fetch_all_tasks with formatted table

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 13:52:34 +03:00
Glevel 65fe475e42 add rework detection to solve_task: read teacher comments, pass to LLM
- _get_task_meta(): calls task_get MCP to check existing repo URL and comments
- solve(): detects rework (repo_url exists) vs fresh submission
- generate(): accepts rework_comments, injects into prompt as separate section
- _REWORK_SECTION: prompt block with teacher feedback for rework cases
- commit prefix: "fix:" for rework, "add" for fresh submissions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 12:49:59 +03:00
Glevel 928dabe10e integrate fast solver into pipeline: run_pipeline.py now fully automated
- solve_task.py: add fetch_todo_tasks(), _parse_todo_tasks(), run_all()
- run_all() auto-fetches all todo tasks from BroJS and solves each one
- run_pipeline.py: rewrite to just call run_all() from solve_task
- supports: python run_pipeline.py (auto), run_pipeline.py <id...> (targeted)
- TARGET_IDS list for hardcoded targets without CLI args
- no deepagents imports = no double MCP load on startup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 12:44:07 +03:00
Glevel bd7580c4bc optimize solve_task.py: persistent MCP client, exponential backoff, inter-call delay
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 12:38:23 +03:00
Glevel 7804122b7e feat: add solve_task.py direct solver and fix MCP rate limit issues
- Add solve_task.py: fast direct solver (1 LLM call per task, no deepagents overhead)
- Add RetryOnRateLimitMiddleware: auto-retry on 429 from any tool
- Fix double MCP load: __init__.py cleared, pipeline reuses agent.py journal tools
- Fix proxy: add NO_PROXY for openrouter.ai, platform.brojs.ru, git.brojs.ru
- Add utility scripts: get_task_ids.py, read_tasks.py
- Update run_pipeline.py: TARGET_IDS support, unbuffered output

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 12:30:05 +03:00