Repository navigation
Conversation
…ent#3674) Co-authored-by: Alex Tumanov <6143578+oleksii-tumanov@users.noreply.github.com>
Co-authored-by: Alex Tumanov <6143578+oleksii-tumanov@users.noreply.github.com>
…tokens (The-PR-Agent#3620) Co-authored-by: Ismael Martinez Ramos <ismaelmartinez@gmail.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
utsab345
force-pushed
the
refactor/shared-code-suggestion-thread-context
branch
from
September 25, 2026 16:37
3e6624b to
e02da50
Compare
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.
Closes The-PR-Agent#3686 (stacked on The-PR-Agent#3684).
What
GitLab(The-PR-Agent#3684) andAzure DevOpseach carried their own copy ofget_code_suggestion_thread_contextwith the same four hardcoded limits. This moves the serializing and the budgeting intoGitProviderand leaves each provider supplying only a thread iterator, plus one setting:pr_code_suggestions.max_discussion_context_chars(default 24000,0disables).A provider implements
_iter_code_suggestion_threads(), yieldingthread_id,status,file,start_line,end_line,suggestionandreplies(already filtered). The shared code owns the limits (50 threads, 10 replies, 750 chars per message), the marker cleanup and the budget.Fixes from the issue
azuredevops_provider.py:1428) and returned the indented one, so its block could overrun 24000.<!-- pr-agent ... -->is kept. Both providers cut at the first marker occurrence; now only trailing marker lines (the appended HTML comment or the markdown link reference) are removed.is_comment_authored_by_pr_agent()), so a human thread is no longer read as the agent's own. Threads are left out when authorship cannot be verified, matching how/reviewhandles unverifiable comment authorship.Behavior notes
azure_devops_server.agent_identityconfigured for the context to include threads, since that is what makes authorship verifiable. Documented indocs/docs/installation/azure.md.Tests
tests/unittest/test_code_suggestion_thread_context.pycovers the shared block: indented-budget measurement,0disabling without reading threads, a non-numeric budget falling back to the default, thread/reply caps, trailing-only marker stripping, and partial thread payloads.