Repository navigation
fix(solve): keep the remaining plan in view after each step fold - #1969
Open
KKandLL-Forever wants to merge 2 commits into
Open
KKandLL-Forever wants to merge 2 commits into
KKandLL-Forever wants to merge 2 commits into
Conversation
A checkpoint may now carry an optional `state` next to `summary`. The fold keeps appending summaries before the boundary as before and places `state` in one system message after it, so the next fold replaces the state instead of stacking stale copies. Checkpoints without `state` behave exactly as before.
solve_finish_step folds the finished step's tool chatter, and the same cut dropped the solve_plan result and the step's own `next` pointer, leaving the model only "[S1] ... — done.". Pass SolveSession.progress_text() as the checkpoint state so every fold keeps the current plan (done / next / todo) in view, including after a replan, and the persisted model turn carries it into follow-up turns. Closes HKUDS#1968
Author
|
Real-model check, in addition to the scripted tests: I ran the same open-ended deep_solve prompt 5 times on Setup
What this shows
Limitations
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
solve_finish_stepfolds the finished step's tool chatter (intended), but the same cut also dropped thesolve_planresult and the step's ownnextpointer. From step 2 onward the model only saw[S1] <goal> — done.and had to reconstruct the remaining steps from memory; the persisted model turn lost the plan too.This PR:
statenext tosummary. Summaries still accumulate before the fold boundary;stateis one system message after it, so each fold replaces it instead of stacking stale copies;solve_finish_steppassSolveSession.progress_text()(every step marked done / next / todo) as that state, so the current plan, including after a replan, stays in view and is persisted with the model turn.Checkpoints without
statebehave exactly as before;_context_checkpointis only emitted by solve.Related Issues
Module(s) Affected
agentstestscapabilities(solve)Validation
test_context_checkpoint_state_replaces_instead_of_stackingandtest_solve_checkpoint_fold_keeps_remaining_plan(tests/agents/chat/test_agent_loop.py);test_session_progress_text_marks_each_step,test_session_progress_text_after_last_step_and_replan,test_finish_step_checkpoint_carries_plan_state(tests/capabilities/test_solve_capability.py). All five fail ondevand pass here; the existingtest_context_checkpoint_folds_completed_tool_roundspasses unchanged.pytest -q tests deeptutor/learning/tests, server + partners requirements, LightRAG/GraphRAG on 3.12): 10,325 passed, 11 skipped, 2 failed. Both failures fail identically on untoucheddev(e60fb158) on my macOS machine and are unrelated:tests/runtime/test_launcher.py::test_noninteractive_restart_recovers_an_actual_orphaned_backend_listener,tests/services/sandbox/test_sandbox.py::test_runner_server_executes_and_truncates_output.ruff check .,ruff format --check .(0.16.0),lint-imports(3 kept, 0 broken) andscripts/check_architecture.pypass.pre-commit run --all-files: all hooks pass on the changed files;end-of-file-fixerflagsweb/public/provider-icons/onomeo.svg(missing trailing newline, from 47e10db), which this PR leaves untouched.Checklist
dev(notmain)pre-commit run --all-filesand fixed any issues. (One pre-existing finding in an unrelated file, noted above.)solve/session.pyandsolve/tools.py).