fix(review-workflow): prevent context overflow in Expert Code Review workflow#8199
Draft
Copilot wants to merge 2 commits into
Draft
fix(review-workflow): prevent context overflow in Expert Code Review workflow#8199Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
…ubagent result
The primary agent was reading the background expert-reviewer subagent's
result after launching it, causing the context to grow to 2.3M+ tokens.
When the model tried to produce a final text response, it failed with a
server error (context too large).
The fix changes the Instructions to:
1. Launch the expert-reviewer as a background task (mode: "background")
2. Immediately call noop and stop - do NOT read the background agent result
3. Add an explicit warning explaining why reading the result causes failure
The subagent already posts the review directly via safe-output tools
(create_pull_request_review_comment, add_comment, submit_pull_request_review),
so no further action from the primary agent is needed.
Since review-shared.md is loaded at runtime via {{#runtime-import}},
no lock file recompilation is required.
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix expert code review workflow failure
fix(review-workflow): prevent context overflow in Expert Code Review workflow
May 13, 2026
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.
Bug Fix
What was the bug?
The primary agent (
claude-sonnet-4.6) was reading the backgroundexpert-reviewersubagent's full result after launching it. The subagent spawns ~21 dimension sub-agents, accumulating 2.3M+ tokens. Reading that result into the primary agent's context caused the model server to return"Response was interrupted due to a server error"on every attempt, exhausting all 4 retries withexitCode=1.The review itself was posted successfully — the subagent calls the safe-output tools (
create_pull_request_review_comment,add_comment,submit_pull_request_review) directly. The primary agent reading the result was entirely unnecessary.How did you fix it?
Changed the
Instructionsbody in.github/workflows/shared/review-shared.mdto:expert-revieweras a background task (mode: "background")noopand stop — without reading the background agent resultNo lock file recompilation needed — both
review-on-open.agent.lock.ymlandreview.agent.lock.ymlload the body via{{#runtime-import}}at runtime. Only the frontmatter is compiled.