Skip to content

fix(paper2code): keep model wait out of the stall check - #321

Open
chuenchen309 wants to merge 1 commit into
HKUDS:mainfrom
chuenchen309:fix/stall-llm-wait
Open

chuenchen309 wants to merge 1 commit into
HKUDS:mainfrom
chuenchen309:fix/stall-llm-wait

Conversation

@chuenchen309

Copy link
Copy Markdown

Description

The Paper2Code implementation loop aborts with "Progress stall: No progress for 300s" whenever a single model call takes longer than five minutes. 3040e80 added LoopDetector.note_llm_wait() and called it after every model request in the old hand-rolled loop so slow round-trips would not count as a stall. The move to AgentRunner in df4127d removed those calls and nothing calls note_llm_wait() now, so the time spent waiting on the model counts against the stall budget again.

The same clock also starts when the workflow is constructed, so the LLM-driven file-tree step that run_workflow runs before the implementation loop counts too. If that step takes over five minutes, the run stops at the first pre-LLM check with zero files written.

Related Issues

None found.

Changes Made

  • _ImplementationHook times each model request (before_model_request to on_model_response) and passes the elapsed time to note_llm_wait().
  • _run_kernel_implementation resets the stall clock right before the runner starts.
  • CHANGELOG / CHANGELOG_ZH entry.

Additional Notes

Two tests in tests/test_unified_impl_workflow.py: one uses a provider that sleeps longer than a lowered stall_threshold on each call, the other backdates the detector's clock past the threshold before the loop starts. Both fail on main with the stall abort and pass with this change; test_unified_impl_workflow.py and test_loop_detector.py pass (30 tests).

pre-commit run --all-files passes. Full python -m pytest -q on Linux, Python 3.12: 3371 passed, 6 failed. The 6 failures (test_ci_scope.py x4, test_loop_cli.py::test_loop_cli_completes_through_the_model_goal_tool, test_shell_search_tools.py::test_bash_large_output_spilled) fail the same way on a clean checkout of bfe34b6.

The kernel refactor (df4127d) dropped the note_llm_wait() calls that
3040e80 added around each model request, so the implementation loop
counts a slow model round-trip as five minutes without progress and
aborts the run. The detector is also built with the workflow, so the
file-tree phase that runs before the loop counts against it too.

Call note_llm_wait() from the implementation hook around every model
request, and reset the stall clock when the loop starts.

This branch has not been deployed

No deployments
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