Repository navigation
fix(train): analyze agent evolution once per commit without evaluator - #6015
Open
akushonkamen wants to merge 1 commit into
Open
akushonkamen wants to merge 1 commit into
akushonkamen wants to merge 1 commit into
Conversation
Without a rollout evaluator the extracted case never reaches the model: TrajectoryRolloutAnalyzer only stamps case_name onto the extracted trajectories after extraction, so training once per case reran the identical whole-session extraction, gradient estimation and patch merge N times per commit (thinking-enabled model calls included). Run the pipeline once for the first case and link every case to the shared training result; with an evaluator the per-case rubric-specific loop is preserved. Test evidence (local minimal OPENVIKING_CONFIG_FILE; all pytest runs with -q --no-cov): - red = old source (938ef31) + this commit's test file: tests/session/test_compressor_v3.py -> 8 failed / 28 passed. Beyond the 6 pre-existing environment failures, both test_train_from_extracted_multiple_cases_train_once_without_evaluator (analyze ran twice for 2 cases) and the updated test_train_from_extracted_multiple_case_memories_analyzes_bound_rollouts (asserts one whole-session analysis) fail on the old code. - green = this commit: same file -> 6 failed / 30 passed; the 6 failures are identical to the pristine 938ef31 baseline (pre-existing, e.g. stale FakeTrainer without the batch_finalizer kwarg). - adjacency: tests/session/train/ -> 23 failed / 87 passed, failure list identical to pristine baseline; test_trajectory_analyzer_component.py + test_gradient_estimator_component.py -> 8 passed; test_session_commit.py -> 20 passed. - ruff check clean on both touched files; mypy error list unchanged (2 pre-existing errors shifted line numbers only). Refs volcengine#6006 Signed-off-by: akushonkamen <akushonkamen@163.com>
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
CompressorV3.train_from_extracted_cases()loops over the N cases extracted from one session and runs analysis → gradient estimation → patch merge once per case. Without a rollout evaluator, the case never reaches the model: the defaultTrajectoryRolloutAnalyzerhas no evaluator, so_evaluate_rollout()always returnsNone,extraction_messagesare the session messages as-is, andcase_nameis only stamped onto the extracted trajectories afterwards. Every iteration therefore feeds byte-identical input through the whole pipeline — including thinking-enabled model calls — so a commit with N cases pays for the same whole-session evolution N times and merges N copies of the same patch (_merge_memory_diffs()does not deduplicate).Fix (openviking/session/compressor_v3.py:1041-1162): when
getattr(self.rollout_analyzer, "evaluator", None) is None, run the pipeline once for the first case, cache theRolloutAnalysis+RolloutTrainingResult, and reuse them for the remaining cases, linking each case to the shared outputs via_link_case_to_training_outputs(). Skill submission and the memory diff are computed once inside the single-analysis branch. When an evaluator is present, the per-case analysis is rubric-specific, so the per-case loop is preserved unchanged.The old-behavior assertion
test_train_from_extracted_multiple_case_memories_analyzes_bound_rolloutswas updated to expect one whole-session analysis, and two tests were added (shared-pipeline behavior, evaluator-loop guard) — matching the approach proposed in the issue.Scope note: at current
main,openviking/session/policy_optimizer.py:186already readsthinking=self.memory_type in {...}(experiences/trajectories stillTrue), so the snippet quoted in the issue has drifted slightly. Makingthinkingfollow configuration is the follow-up acknowledged in the issue and is intentionally not part of this fix.Human Involvement
Related Issue
Fixes #6006
Type of Change
Changes Made
_link_case_to_training_outputs()).test_train_from_extracted_multiple_case_memories_analyzes_bound_rolloutsand addtest_train_from_extracted_multiple_cases_train_once_without_evaluator+test_train_from_extracted_multiple_cases_keeps_per_case_loop_with_evaluator.Testing
Environment:
uv sync --all-extrasandOPENVIKING_CONFIG_FILE=/tmp/ov-test-6006.conf(minimal local config; this machine has no~/.openviking— a pre-existing local-environment dependency, not a CI gap). All pytest runs with-q --no-cov.Red = old source (base
6c11075) + this PR's test file:uv run pytest tests/session/test_compressor_v3.py -q --no-cov # 8 failed, 28 passedBeyond the 6 pre-existing failures, both
test_train_from_extracted_multiple_cases_train_once_without_evaluator(analyze ran twice for 2 cases) and the updatedtest_train_from_extracted_multiple_case_memories_analyzes_bound_rollouts(asserts one whole-session analysis) fail on the old code. Pristine baseline without the new tests: 6 failed / 28 passed.Green = this PR:
The 6 failures are byte-identical to the pristine baseline (pre-existing, including the upstream test drift in
test_train_from_extracted_cases_submits_streaming_rolloutwhereFakeTrainerlacksbatch_finalizer), so the "unit tests pass" checkbox stays unchecked, same policy as #6007.Adjacency:
Quality gates:
ruff checkpasses on both touched files;ruff format --checkreports only the pre-existing drift at lines 147/282/701 ofcompressor_v3.py(identical hunks on the untouched base file);mypy openviking/session/compressor_v3.pyreports the same 7 pre-existing errors before and after — the diff is exactly 2 line-number shifts (1655→1676, 1742→1763), zero new findings.Checklist
No user-facing documentation covers this internal training-loop behavior; no doc changes were required. (Documentation checkbox left unchecked for that reason, not from omission.)
Additional Notes
main(6c11075, PR feat(cache): 增加顶层 service_name 配置, 删除 namespace/cache_key_prefix ,使用service_name 统一管理 #6011); that PR touches config/cache areas and does not overlapopenviking/session/.thinkingfollow configuration inpolicy_optimizer.py.