fix(run_agent): gate concurrent checkpoint preflight on block_result (fixes #34827)#34856
Conversation
…ixes NousResearch#34827) In the concurrent tool-execution path, checkpoint preflight (write_file, patch, destructive terminal) fired BEFORE plugin guardrail block_result was computed. A blocked write_file could still dirty checkpoint state (doc_modified_this_turn, _last_write_file_call_id, turn_counter). Move checkpoint preflight to AFTER block_result computation, gated on `if block_result is None:` — matching the invariant the sequential path already enforces.
ec7666a to
e275f25
Compare
|
Verified: Correct fix for checkpoint-before-block evaluation ordering.
The original code creates checkpoints for The fix reorders the code so:
This is correct -- Test coverage is thorough: 4 new tests covering blocked Fixes #34827. |
What does this PR do?
In the concurrent tool-execution path, checkpoint preflight (write_file, patch, destructive terminal) fired BEFORE plugin guardrail block_result was computed. A blocked write_file could still dirty checkpoint state (doc_modified_this_turn, _last_write_file_call_id, turn_counter).
This PR moves checkpoint preflight to AFTER block_result computation, gated on
if block_result is None:— matching the invariant the sequential path already enforces.Related Issue
Fixes #34827
Type of Change
Changes Made
agent/tool_executor.py: Reorder concurrent path so block evaluation happens before checkpoint preflight. Checkpoint preflight now only runs whenblock_result is None.tests/run_agent/test_run_agent.py: 4 new tests verifying blocked tools (write_file, patch, terminal) don't trigger checkpoint, and blocked write doesn't consume the dedup slot.How to Test
pytest tests/run_agent/test_run_agent.py -v -k concurrent— all 26 tests should passChecklist