5CypZ747c3c87onpmy3sfbhVvCCdUkTNecGWECwAViNsjoGj#1592
Conversation
OpenRouter PR JudgeVerdict: WARN
SummaryLarge (~1600 line) but mechanically substantive PR. Headline change is a new <parallel_edits> fanout that parses an Static Checks
Judge Reasons
Risks
Required Changes
|
358143f to
48c912b
Compare
Ninja PR Scope GuardVerdict: PASS This PR satisfies the external contributor file-scope and agent.py contract rules. Changed Files
|
a2cc513 to
574cf83
Compare
…t `+1412/-221` in `agent.py`, single file, no contract / sampling / hostname changes. Companion-test gate and other base infrastructure preserved unchanged. --- **Core mechanism**: `<parallel_edits>` XML protocol fans out independent file edits to child `_solve_attempt` calls via `ThreadPoolExecutor`. Children run in lean mode (skip preload) with the brief carrying target-file content + siblings + issue. Per-batch wall cap 200s, size cap `_RALPH_MAX_PER_BATCH=5`, `_RALPH_MAX_WORKERS=4`, child `max_steps=_RALPH_CHILD_MAX_STEPS=10`. Suppressed for single-file batches. **Safety invariants**: - **Recursion-depth guard**: children get `_lean_mode=True` + `_recursion_depth=1`. Triple-checked: (a) `_solve_attempt` entry asserts `_recursion_depth < 2`, (b) the `<parallel_edits>` extraction site sets `_is_child` and skips parsing, (c) `_ralph_subagent` dispatch site asserts child kwargs match the invariant before spawn. - **Worst-case inference**: `_RALPH_MAX_WORKERS × _RALPH_CHILD_MAX_STEPS = 4 × 10 = 40` chat calls per round, bounded further by `WALL_CLOCK_BUDGET_SECONDS=248`. - **Validator routing**: every child + critic `chat_completion` threads validator-supplied `(api_base, api_key, model)`. No new endpoints, no env reads. **Context-quality levers**: - Distinctive-phrase preload — grep issue-quoted strings + multilingual tokens. - Read-cache short-circuit + pagination-loop detector — close pagination-evasion paths. - Path-segment vs substring token matching. - Canonical-file content grep — boost files containing issue-quoted snake_case keys; guides edits to where keys already live (avoids orphan-duplicate creation in parallel locations). **Defensive passes**: - `_revert_syntactically_broken_files` — `ast.parse` + brace-balance for JS/TS/Rust/Go/Java/C/Kotlin/C#/PHP. Reverts to HEAD on partial-edit breakage. - `_revert_docker_mount_mode_artifacts` — restores HEAD mode on files whose diff is mode-only and content-empty (docker volume mounts emit spurious `100755 → 100644` on shell scripts the agent never touched). Validator generates the submitted diff from working tree, so the on-disk restore is required. **Prompt work**: Style-task gate suppresses `_strip_low_signal_hunks` on formatting sweeps (those whitespace-only hunks are the work product). --- **Base preserved unchanged**: `solve()` signature + return shape; `_resolve_inference_config`; all `DEFAULT_MODEL` / `API_BASE` / `API_KEY` constants; every refinement gate including companion-test execution; multi-shot wrapper; `DANGEROUS_PATTERNS`; `# MINER-EDITABLE` / `# VALIDATOR CONTRACT` markers; `_EDGECASE_GUARDRAIL`; `extract_command` / `_read_context_file` helpers. Stdlib only (`concurrent.futures`). No sampling/hostname/env changes.
Sub-agent fanout architecture + supporting context-quality levers. Net
+1412/-221inagent.py, single file, no contract / sampling / hostname changes. Companion-test gate and other base infrastructure preserved unchanged.Core mechanism:
<parallel_edits>XML protocol fans out independent file edits to child_solve_attemptcalls viaThreadPoolExecutor. Children run in lean mode (skip preload) with the brief carrying target-file content + siblings + issue. Per-batch wall cap 200s, size cap_RALPH_MAX_PER_BATCH=5,_RALPH_MAX_WORKERS=4, childmax_steps=_RALPH_CHILD_MAX_STEPS=10. Suppressed for single-file batches.Safety invariants:
_lean_mode=True+_recursion_depth=1. Triple-checked: (a)_solve_attemptentry asserts_recursion_depth < 2, (b) the<parallel_edits>extraction site sets_is_childand skips parsing, (c)_ralph_subagentdispatch site asserts child kwargs match the invariant before spawn._RALPH_MAX_WORKERS × _RALPH_CHILD_MAX_STEPS = 4 × 10 = 40chat calls per round, bounded further byWALL_CLOCK_BUDGET_SECONDS=248.chat_completionthreads validator-supplied(api_base, api_key, model). No new endpoints, no env reads.Context-quality levers:
Defensive passes:
_revert_syntactically_broken_files—ast.parse+ brace-balance for JS/TS/Rust/Go/Java/C/Kotlin/C#/PHP. Reverts to HEAD on partial-edit breakage._revert_docker_mount_mode_artifacts— restores HEAD mode on files whose diff is mode-only and content-empty (docker volume mounts emit spurious100755 → 100644on shell scripts the agent never touched). Validator generates the submitted diff from working tree, so the on-disk restore is required.Prompt work: Style-task gate suppresses
_strip_low_signal_hunkson formatting sweeps (those whitespace-only hunks are the work product).Base preserved unchanged:
solve()signature + return shape;_resolve_inference_config; allDEFAULT_MODEL/API_BASE/API_KEYconstants; every refinement gate including companion-test execution; multi-shot wrapper;DANGEROUS_PATTERNS;# MINER-EDITABLE/# VALIDATOR CONTRACTmarkers;_EDGECASE_GUARDRAIL;extract_command/_read_context_filehelpers. Stdlib only (concurrent.futures). No sampling/hostname/env changes.