Spaces:
Runtime error
Runtime error
Commit History
-
feat: add real code execution β run_code, run_tests, submit_fix toolsβ
This is what makes CodeReviewEnv different from every other submission: agents execute real Python code, see real test failures, and submit fixes that are verified by actual test execution. New tools: run_code β execute Python code, see stdout/stderr/errors (like a REPL) run_tests β run test cases against buggy code, see which fail submit_fix β submit corrected code; tests verify the fix works (60% test-based + 40% review-based reward) Also: - server/code_executor.py: sandboxed Python executor - 12 snippet test suites (binary_search, fibonacci, merge_sort, etc.) - Gradio UI for interactive testing - 8 tools total (was 5) - 32 tests, 18/18 validation checks passing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>3ea78ad -
feat: convert to MCP tool-calling pattern matching reference reposβ
Restructured to match calendar_env / repl_env pattern from OpenEnv: - MCP action space: ListToolsAction + ToolCallAction (not custom fields) - 5 tools: get_code, analyze_code, check_line, get_hint, submit_review - MCPObservation with success/error_message/tools_list/tool_result - Agent discovers tools via ListToolsAction, calls them via ToolCallAction - Gradio UI for interactive testing (server/gradio_ui.py) - Proper pyproject.toml with package-dir layout matching reference repos - Environment factory pattern: create_code_review_environment() - 32 tests, 18/18 validation checks passing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>b2b578f -
feat: major upgrade β multi-step MDP, AST injection, 5-signal rewardβ
- Multi-step episodes (up to 5 actions): analyze β flag_line β request_hint β submit_review Earlier decisions (flagged lines, hints) directly affect final reward - AST-based bug injection for Python (4 new injectors using ast module) alongside 5 regex-based injectors for JS/Go β 9 total injectors - 5-signal shaped reward: bug_detection (0.40), fix_quality (0.25), line_precision (0.15), comment_quality (0.10), efficiency (0.10) - 36 clean code snippets across Python/JS/Go with procedural generation - MCP tool endpoints: get_code_snippet, submit_review, request_hint, get_state - Concurrent session support (SUPPORTS_CONCURRENT_SESSIONS=True) - Difficulty tiers: easy (1 bug), medium (1-2), hard (2-3 + 1.5x multiplier) - 42 tests passing, 17/17 OpenEnv validation checks - Docker HEALTHCHECK, proper ENV vars, spec-compliant openenv.yaml Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>74c9d03
-
fix: send reward=None on reset, clamp all scores to strict (0,1)β
Root cause: server was sending reward=0.0 in reset observations, which violates the platform's strict (0,1) score constraint. The OpenEnv Observation type explicitly supports reward=None for reset. Changes: - server/code_review_environment.py: reward=None on reset (was 0.0) - inference.py: additional safety clamps for edge cases011679d
-
fix: clamp all task scores to strict (0,1) range β never exactly 0.0 or 1.0β
- All graders now clamp reward values to [0.01, 0.99] - inference.py score computation clamps to [0.01, 0.99] - Fixes validator rejection: 'task scores must be strictly between 0 and 1'226ad10
-
Fix 4 critical grader bugsβ
Problem 1 β Medium grader penalties too aggressive: - Critical position: -0.30 β -0.15 - Security position: -0.20 β -0.10 - tau=0.0 (mediocre) now scores ~0.25 instead of 0.0 - Heuristic medium: 0.41 β 0.47 Problem 2 β Hard grader comment spam exploit: - Agent was looping add_commentΓ3 β request_changes for guaranteed points - Added consecutive_comments tracking with decaying ack reward - Reward: 0.05 β 0.03 β 0.01 for consecutive comments without decision - Counter resets on approve/request_changes Problem 3 β Frozen observation state (comments=3 on every step): - After add_comment, observation now rebuilds from task state - comment_count properly increments in returned state - info dict now includes comments_so_far and consecutive_comments Problem 4 β Difficulty now monotonic: Easy (0.80) > Medium (0.47) > Hard (0.37) βe130396 -
CodeReviewEnv v1.0 β OpenEnv-compliant submissionβ
- 3 tasks (easy/medium/hard) with deterministic graders - Spec-compliant inference.py with [START]/[STEP]/[END] per-task logs - Root-level baseline.py (heuristic, no API key needed) - Fixed reward double-counting bug in _apply_reward_shaping - 17/17 validation checks, 21/21 tests passing - Docker-ready on port 7860 for HF Spacesdbf5e96