Skip to content

persist a claim task's resolved reviewers so the reviewer pin has one owner - #4811

Merged
atomantic merged 1 commit into
mainfrom
claim/issue-4770
Aug 22, 2026
Merged

persist a claim task's resolved reviewers so the reviewer pin has one owner#4811
atomantic merged 1 commit into
mainfrom
claim/issue-4770

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

  • Claim tasks now persist the reviewers their prompt names. All three claim generators (/do:next button, JIRA play button, scheduled claim-work router) stamp the resolved bundle — list, @user tokens, ~opt set, and the three keyed pins — onto taskMetadata via reviewerConfigMetadata. resolveReviewerConfig(task.metadata, …) then resolves the same list the prompt body rendered, instead of the install-wide Code Review Defaults.
  • The "Reviewer pin" block has one owner. buildClaimFlowCompletionSection emits it once from the task record, covering all five claim task types regardless of which generator built the body. The three per-site appendReviewerPinBlock calls in cosTaskGenerator.js are gone.
  • One shared resolver. resolveClaimReviewerConfig (in server/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 to copilot, which a claim agent has no CLI to invoke (#2507).

Test plan

  • cd server && npm test — 32767 passed, 1563 files green.
  • New coverage:
    • server/lib/cosValidation.test.js — round-trip: persisting reviewerConfigMetadata makes a second resolveClaimReviewerConfig reproduce the first CSV; a different install's defaults cannot override what the task persisted; junk keys/values are sanitized out; an empty patch (not null) 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/~effort suffixes survive into the pinned flag; a legacy claim task never gets a bare copilot; a non-claim task gets no pin.
    • server/services/cosTaskGenerator.test.jsbuildClaimWorkTask and buildJiraTicketTask persist the bundle their prompt named and no longer append the pin.
    • server/routes/cos.test.js — the /tasks/slashdo next branch carries the bundle through to addTask.

Closes #4770

… 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.
@atomantic
atomantic merged commit 87da234 into main Aug 22, 2026
7 checks passed
@atomantic
atomantic deleted the claim/issue-4770 branch August 22, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persist the claim flow's resolved reviewers into taskMetadata so the pin has one owner

1 participant