Skip to content

fix(apply-review-hold): carry a cost decision only from an unedited hold marker - #878

Merged
kyle-sexton merged 1 commit into
mainfrom
fix/hold-marker-unedited
Oct 24, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
fix/hold-marker-unedited

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Refs: melodic-software/claude-code-plugins#9436

Summary

The hold step carries a recorded cost decision onto a later head only when the head matches the decided head, or the net diff is unchanged since it. The decided head comes from the sha= of this lane's newest cost hold marker comment before the decision. That comment can be edited after it is posted, so an edited marker is not trusted: it no longer decides which head a cost decision covers.

Fix

  • carryDecision() selects the marker exactly as before (newest marker of this lane, with cost in its criteria, created before the decision), then requires that this one marker was never edited.
  • The edit check is the one costDecided() already applied to decision comments (GraphQL node(id) { ... on IssueComment { lastEditedAt } }, lastEditedAt null), hoisted to a shared editState() helper that also tells "edited" from "could not read". Decision comments behave as before.
  • An edited marker, or a failed or empty edit read, carries nothing, logged as "the decided-head marker was edited" or "could not confirm the marker is unedited". No older marker is used in its place.
  • The carry path makes one extra GraphQL read. The pr-review-cli.yml hold-step contract comment states the rule.

Verification

  • node --test .github/scripts/apply-review-hold.test.cjs: 38 pass. New cases: an edited marker at the head's sha holds although the decision exists; an edited newest marker with an unedited older one at the head holds (no fallback); a failed marker edit check holds. Call-sequence tests now expect the marker's edit read. Against the old hold.cjs, all three new cases and the three updated call-count cases fail.
  • node --test .github/scripts/pr-review-cli-api-calls.test.cjs: 10 pass. node --test .github/scripts/pr-review-cli.test.cjs: 24 pass.
  • biome ci --error-on-warnings .github/scripts (2.5.11, the pinned version): clean. actionlint from the repository root (1.7.12, with .github/actionlint.yaml): clean.
  • Left out: a live run against a PR with an edited marker; the GraphQL response shape is the one the decision check already relies on.

Related

🤖 Generated with Claude Code

…old marker

The decided head is read from the sha= of this lane's newest cost hold
marker before the decision. An edited marker is not trusted: after
selecting that marker exactly as before, carryDecision now checks it
was never edited, with the same GraphQL lastEditedAt read costDecided
applies to decision comments (hoisted to a shared editState helper).
An edited marker, or one whose edit state cannot be read, carries
nothing, and no older marker is used. The carry path makes one extra
GraphQL read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 24, 2026 06:57
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T06:58:29.030473Z 995403e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 1m 35s —— View job


Security review

  • Gather context (diff, PR description)
  • Review hold.cjs changes (editState/carryDecision)
  • Review workflow comment changes
  • Post findings

Scope: .github/actions/apply-review-hold/hold.cjs, .github/scripts/apply-review-hold.test.cjs, .github/workflows/pr-review-cli.yml.

Analysis. Before this change, carryDecision trusted the sha= in the lane's own hold-marker comment with no edit check, so a cost decision could be made to cover a head it never actually reviewed if that marker's sha=/criteria= were edited after posting (e.g., to make an old decision appear to cover a new, unreviewed head and bypass the cost hold). The fix hoists the edit check costDecided() already used for decision comments into a shared editState() (hold.cjs#L82-L94) and applies it to the selected marker before trusting its sha (hold.cjs#L258-L262):

  • "edited" → does not carry ("the decided-head marker was edited")
  • anything other than "unedited" (failed read, missing node, missing field) → does not carry (fail-closed: "could not confirm the marker is unedited")
  • only "unedited" lets the sha/compare path proceed

This closes the gap without adding one: the marker is selected only from comments whose user.login === "github-actions[bot]" (not forgeable by a commenter), and the new behavior fails closed (keeps the cost hold) on any ambiguity. No fallback to an older marker is attempted, matching the stated design and the new test cases. The pr-review-cli.yml change is comment-only (documents the new rule); no workflow trigger, permission, or job logic changed, so it's outside zizmor's and this lane's Actions-hardening surface anyway.

No .claude-plugin/plugin.json or marketplace.json changes, and no instruction-file (CLAUDE.md/AGENTS.md/rules) deletions or softenings in this diff.

Result: No security issues found. The change is a net hardening of the cost-decision carry path and fails closed in every new branch it adds.

critical-findings: 0

claude-lane-summary: lane=claude-security-review sha=995403e55770c2006f317f1980b217c8e3c8f209 run=40072232844

@claude

claude Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 2m 19s —— View job


Code review — fix/hold-marker-unedited

  • Gather context (diff, PR body, rules, CLAUDE.md/REVIEW.md)
  • Review hold.cjs changes (correctness, edit-state handling)
  • Review test coverage changes
  • Review workflow comment changes
  • Check closing-issue criteria and path-scoped rules
  • Post findings

No findings. The change is correct and consistent with its own documentation:

  • editState() (hold.cjs#L85-L94) is a faithful hoist of the prior inline unedited() check used by costDecided: decision-comment behavior is unchanged (a failed/edited/missing read still causes newest() to skip to an older candidate, exactly as before).
  • carryDecision() (hold.cjs#L236-L262) now tracks the selected marker comment (held) alongside its sha (decided) and requires it be confirmed unedited before trusting the sha, with no fallback to an older marker — matching the PR description and the updated pr-review-cli.yml contract comment.
  • The held/edit-check ordering means the extra GraphQL read happens even when decided === HEAD_SHA, which matches the "one edit read ... at most two compare reads" doc comment and the updated call-count assertions.
  • Test additions cover the three new branches (edited-at-head, edited-newest-with-unedited-older, failed read) plus updated call-sequence/call-count expectations for the two call sites that now make an extra graphql read.

Two minor, non-blocking observations (not reported as findings — no linter/formatter catches them and they don't affect behavior):

  • The wrapped comment block in pr-review-cli.yml has one noticeably longer line than its neighbors (status, previous_filename and patch text. A base-only merge or a rebase that leaves every patch alone — pr-review-cli.yml#L117), where the rest of the block wraps near the same column.
  • Author-claimed test/lint results (38/10/24 passing, biome/actionlint clean) were not independently re-run by this review — this lane has no Bash execution available — and are reported here as author-claimed, not independently verified.

Closing-issue criteria: no .claude-lane/pr-context.md was present, so any linked-issue acceptance criteria are unread rather than confirmed met. The PR body's Refs: melodic-software/claude-code-plugins#9436 points to another repository, outside this repo's own issue tracking.

No .claude/rules/*.md file carries a paths: frontmatter matching the changed files, so no path-scoped rule criteria apply here. This change doesn't touch cost, trust-gate, or critical-security surfaces, so no hold applies.

claude-lane-summary: lane=claude-review sha=995403e55770c2006f317f1980b217c8e3c8f209 run=40072232844

@github-actions

Copy link
Copy Markdown

claude-security-review has reviewed this pull request through 995403e; a later push is reviewed from there.

@github-actions

Copy link
Copy Markdown

claude-review has reviewed this pull request through 995403e; a later push is reviewed from there.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit f109660 Oct 24, 2026
58 checks passed
@kyle-sexton
kyle-sexton deleted the fix/hold-marker-unedited branch October 24, 2026 07:03
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.

1 participant