fix(CoSTEER): rebind RAG cursor when fresh evolving_trace is supplied#1409
Open
genisis0x wants to merge 1 commit into
Open
fix(CoSTEER): rebind RAG cursor when fresh evolving_trace is supplied#1409genisis0x wants to merge 1 commit into
genisis0x wants to merge 1 commit into
Conversation
CoSTEERRAGStrategyV2.generate_knowledge keeps a persistent current_generated_trace_count cursor scoped to the strategy instance, but each CoSTEER.develop() run can pass a fresh evolving_trace object. When the stale cursor happens to equal the length of a new trace, the early-return short-circuit fired and the latest repair feedback was never recorded. In multi-task repair this surfaces as already-successful candidates from the previous repair step being rescheduled, because their passing implementations were not written into success_task_to_knowledge_dict before the next round of querying. Bind the cursor to the identity of the evolving_trace object and reset it whenever a new trace is observed or the cursor is past the end of the current trace (e.g. after truncation). When the same trace object is re-supplied, the cursor still short-circuits, so we do not re-ingest the same knowledge twice. Add a regression test covering: - fresh trace of equal length is still ingested, - same trace object is not reprocessed, - cursor resets when current_generated_trace_count > len(evolving_trace). Fixes microsoft#1398
|
@genisis0x please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Author
|
Read the CLA — all clear from my side. @microsoft-github-policy-service agree |
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.
Summary
CoSTEERRAGStrategyV2.generate_knowledgekeeps a persistentcurrent_generated_trace_countcursor scoped to the strategy instance, but eachCoSTEER.develop()run can pass a freshevolving_traceobject. When the stale cursor happened to equal the length of a new trace, the early-return short-circuit fired and the latest repair feedback was never recorded.success_task_to_knowledge_dictbefore the next round of querying.evolving_traceobject and reset it whenever a new trace is observed or the cursor is past the end of the current trace (e.g. after truncation). When the same trace object is re-supplied the cursor still short-circuits, so the same knowledge is not re-ingested twice.Validation
uv run pytest test/utils/coder/test_costeer_rag_cursor.py— 3 passeduv run black --check --diff rdagent/components/coder/CoSTEER/knowledge_management.py test/utils/coder/test_costeer_rag_cursor.py -l 120— cleanuv run ruff check rdagent/core --ignore FBT001,FBT002,I001,E501— cleantest_fresh_trace_with_same_length_is_still_ingestedfails withtask_betamissing fromsuccess_task_to_knowledge_dict); reapplying the patch turns it green.Tests added
test_fresh_trace_with_same_length_is_still_ingested-- a fresh trace whose length matches the previous trace's still routes feedback into the knowledge base.test_same_trace_object_is_not_reprocessed-- the same trace object short-circuits so identical knowledge is not double-ingested.test_cursor_resets_when_trace_truncates_below_cursor-- a stalecurrent_generated_trace_countlarger than the current trace is reset to 0 before walking the trace.Fixes #1398
📚 Documentation preview 📚: https://RDAgent--1409.org.readthedocs.build/en/1409/