persist a claim task's resolved reviewers so the reviewer pin has one owner - #4811
Merged
Conversation
… owner (#4770) The claim generators rendered their resolved reviewer list into the prompt's {reviewers} placeholder but persisted only `claimFlow: true`, so a later `resolveReviewerConfig(task.metadata, …)` answered from the install-wide Code Review Defaults instead of the list the prompt actually names. Nothing read it yet, but the two could disagree — and the workaround for that was appending the "Reviewer pin" block at each of three claim-prompt assembly sites. Now each claim generator (the /do:next button, the JIRA play button, and the scheduled claim-work router) stamps the bundle it rendered onto the task via `reviewerConfigMetadata`, and `buildClaimFlowCompletionSection` emits the pin once from that record — covering all five claim task types regardless of which generator built the body. Supporting cleanup: `resolveClaimReviewerConfig` in cosValidation.js is now the one resolver all four sites share (list + usernames + ~opt set + the three keyed pins + the emitted CSV), replacing five hand-copied resolver calls per site. A claim task queued before this change carries no reviewer metadata and still falls through to the defaults — routed through the claim copilot guard, so an in-flight legacy task can't be pinned to a reviewer it has no CLI to invoke.
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
/do:nextbutton, JIRA play button, scheduledclaim-workrouter) stamp the resolved bundle — list,@usertokens,~optset, and the three keyed pins — ontotaskMetadataviareviewerConfigMetadata.resolveReviewerConfig(task.metadata, …)then resolves the same list the prompt body rendered, instead of the install-wide Code Review Defaults.buildClaimFlowCompletionSectionemits it once from the task record, covering all five claim task types regardless of which generator built the body. The three per-siteappendReviewerPinBlockcalls incosTaskGenerator.jsare gone.resolveClaimReviewerConfig(inserver/lib/cosValidation.js) replaces five hand-copied resolver calls at each of four sites, and returns the emitted CSV alongside the bundle so the prompt text and the persisted metadata cannot describe different reviewers.Backward compatibility
A claim task queued before this change carries no reviewer metadata and still falls through to the install defaults — but now routed through the claim copilot guard (
claimSafeReviewers), so an in-flight legacy task can't be pinned tocopilot, which a claim agent has no CLI to invoke (#2507).Test plan
cd server && npm test— 32767 passed, 1563 files green.server/lib/cosValidation.test.js— round-trip: persistingreviewerConfigMetadatamakes a secondresolveClaimReviewerConfigreproduce the first CSV; a different install's defaults cannot override what the task persisted; junk keys/values are sanitized out; an empty patch (notnull) when nothing survives.server/services/agentPromptBuilder.test.js— the pin renders exactly once, ahead of the handoff, on both the light and full prompt paths; per-reviewer[model]/~opt/~max/~effortsuffixes survive into the pinned flag; a legacy claim task never gets a barecopilot; a non-claim task gets no pin.server/services/cosTaskGenerator.test.js—buildClaimWorkTaskandbuildJiraTicketTaskpersist the bundle their prompt named and no longer append the pin.server/routes/cos.test.js— the/tasks/slashdonextbranch carries the bundle through toaddTask.Closes #4770