Skip to content

fix: settle reactions and clean verdicts from one authoritative run - #54

Open
cestercian wants to merge 4 commits into
Continuum-AI-Corp:mainfrom
cestercian:fix/39-authoritative-reaction-run
Open

cestercian wants to merge 4 commits into
Continuum-AI-Corp:mainfrom
cestercian:fix/39-authoritative-reaction-run

Conversation

@cestercian

@cestercian cestercian commented Sep 17, 2026 •

Copy link
Copy Markdown

Orca-Code-Review — push 4

Severity Count Δ vs previous push
P0 0 0
P1 0 -1
P2 0 0
P3 0 0

✅ no blocking findings

Summary

Fixes #39.

Reaction settle and clean-verdict publishing used per-site local guesses (hard-coded github-actions[bot], head check only on the thumb step). That let superseded runs publish “✅ No findings” and mishandle 👀 for custom App installations.

This adds scripts/authority.mjs as one planner for both call sites:

  • Identity: prefer the 👀 create response login, then /user, then {app_slug}[bot], with github-actions[bot] last.
  • Authority: publish/settle only when the run still describes the current head and no newer sibling workflow run exists (best-effort if listing is forbidden).
  • 👍: still placed and never withdrawn (The thumb is placed and never withdrawn #40); stale runs simply do not get addThumb.

Test plan

  • node --test scripts/*.test.mjs — 599 passed (32 new authority tests)

@orcacode-review orcacode-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐳 OrcaCode Review

✅ No findings — nothing to flag in this PR. Great work!

OrcaCode Review — Route Smarter. Ship Safer. Spend Less.
Engine-reported: 415 calls · 35.7M tokens · 99% cached

❤️ Share · Install OrcaCode Review

Free on GitHub — the review runs on your own OrcaRouter key. If it helped, a shout-out goes a long way.

Share: X · Reddit · LinkedIn
Follow: X · Discord · LinkedIn · OrcaRouter

@cestercian

Copy link
Copy Markdown
Author

hey, gentle ping on this one when you get a chance. happy to adjust anything, and it's still clean against main.

@cestercian

Copy link
Copy Markdown
Author

Small bump, would appreciate a look whenever someone's free.

Three findings, one root: every publication and every reaction was
decided from one run's local view. Five review rounds added a condition
per site; this is the mechanism those findings wanted.

Identity: GET /user has no authenticated user for an installation token,
so the fallback hard-coded github-actions[bot] and a custom App's 👀
never matched the delete filter. The 👀 POST already returns the author;
that login is carried in $RUNNER_TEMP/cr-actor, and settle also asks
the installation for its app slug. github-actions[bot] is last, not first.

Authority: a run may publish a clean verdict or settle reactions only
when it still describes the current head (unknown = no) and no newer
sibling of the same workflow exists. The head comparison used to live
only in the thumb step, after the clean review — including the
issue-comment fallback, which has no commit association — had already
been posted. Both call sites now consult scripts/authority.mjs.

The 👍 is still placed and never withdrawn (Continuum-AI-Corp#40). A stale run simply
does not get addThumb.

Tests: 32 new, covering identity order, superseded heads, newer
siblings, User-token decline, the CLI, and that action.yml no longer
guesses the Actions bot.
@cursor
cursor Bot force-pushed the fix/39-authoritative-reaction-run branch from 65c4309 to aa56f80 Compare November 24, 2026 09:23
Reactions settlement runs scripts/authority.mjs for clearEyes/addThumb and publishClean in the post step, but the login deleted must still be the one scripts/identity.mjs recorded (cr-identity, cr-actor, resolved bot login) — not only the planner's fallback actor.

Tests that execute the settle run: block inject the planner env the runner would set, and stub .head.sha so Continuum-AI-Corp#39's authority check can pass.
@cursor
cursor Bot force-pushed the fix/39-authoritative-reaction-run branch from 529c62c to f6f8764 Compare November 24, 2026 09:28

@orcacode-review orcacode-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Outdated review — the PR head changed from aa56f80 to f6f8764 during the review; these findings describe a diff the PR no longer has.
These findings describe aa56f8024498. Re-run the review to check the PR as it stands now.

🐳 OrcaCode Review

✅ No findings — nothing to flag in this PR. Great work!

OrcaCode Review — Route Smarter. Ship Safer. Spend Less.
Engine-reported: 219 calls · 9.9M tokens · 94% cached

❤️ Share · Install OrcaCode Review

Free on GitHub — the review runs on your own OrcaRouter key. If it helped, a shout-out goes a long way.

Share: X · Reddit · LinkedIn
Follow: X · Discord · LinkedIn · OrcaRouter

@orcacode-review orcacode-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Outdated review — the PR head changed from 529c62c to f6f8764 during the review; these findings describe a diff the PR no longer has.
These findings describe 529c62c42ade. Re-run the review to check the PR as it stands now.

🐳 OrcaCode Review

✅ No findings — nothing to flag in this PR. Great work!

OrcaCode Review — Route Smarter. Ship Safer. Spend Less.
Engine-reported: 167 calls · 7.9M tokens · 93% cached

❤️ Share · Install OrcaCode Review

Free on GitHub — the review runs on your own OrcaRouter key. If it helped, a shout-out goes a long way.

Share: X · Reddit · LinkedIn
Follow: X · Discord · LinkedIn · OrcaRouter

@orcacode-review orcacode-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐳 OrcaCode Review

Found 1 issue in this PR: 🟠 1 P1.

OrcaCode Review — Route Smarter. Ship Safer. Spend Less.
Engine-reported: 238 calls · 11.2M tokens · 94% cached

❤️ Share · Install OrcaCode Review

Free on GitHub — the review runs on your own OrcaRouter key. If it helped, a shout-out goes a long way.

Share: X · Reddit · LinkedIn
Follow: X · Discord · LinkedIn · OrcaRouter

Comment thread scripts/authority.mjs
});
if (newer) {
return `a newer run (${newer.id}) is authoritative; this run is ${live(thisRunId) || "unknown"}`;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 P1 Treat a newer sibling that can never settle as permanently authoritative, silencing the surviving run

Authority is "no sibling run with id > this run's id", and both drivers (action.yml post step line ~1897 and settle step line 2496-2497) strip every run to {id, name} — status and conclusion are discarded, and GitHub's actions/runs list retains cancelled runs forever. So a run that is hard-cancelled / infra-killed before its always() settle step (the repo's own comments say a hard cancel can kill a job before its always() cleanup) is treated exactly like a live newer run. Consequence: the older surviving run — the only run that will ever settle head X — stands down permanently. Its planClean gets publishClean:false, so its "✅ No findings" for the still-current head is silently dropped (cr-clean never written, no 👍, no 👀 clear); its settle step gets clearEyes:false/addThumb:false. Nothing else runs, so the 👀 the survivor placed at its start stays on the PR forever and the review verdict for the current head is never posted — while the ungated summary still announces clean. This is new: pre-change the settle step cleared 👀 unconditionally for app tokens and the clean verdict was posted unconditionally. Fix: in relevantSiblings (or the driver's --jq), drop newer siblings whose status is cancelled (they will never settle), so a dead run cannot veto a live one.

@orcacode-review orcacode-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐳 OrcaCode Review

Found 1 issue in this PR: 🟠 1 P1.

OrcaCode Review — Route Smarter. Ship Safer. Spend Less.
Engine-reported: 187 calls · 7.5M tokens · 93% cached

❤️ Share · Install OrcaCode Review

Free on GitHub — the review runs on your own OrcaRouter key. If it helped, a shout-out goes a long way.

Share: X · Reddit · LinkedIn
Follow: X · Discord · LinkedIn · OrcaRouter

Comment thread scripts/authority.mjs
const status = live(r?.status).toLowerCase();
const conclusion = live(r?.conclusion).toLowerCase();
return status !== "cancelled" && conclusion !== "cancelled";
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 P1 Exclude "skipped" sibling runs — they veto the authoritative run but never settle

siblingCanSettle() drops only cancelled siblings. The workflow ships with on: issue_comment: types: [created] (plus pull_request_target edited) and gates the real work with a job-level if: — so every ordinary PR comment, and every title/description edit, creates a NEWER workflow run on the same PR head that is skipped at the job level and never reaches the always() settle step (workflows/orca-code-review.yml line 41 documents this: "every comment starts a run in the same group, which then skips"). Those skipped runs have status "completed"/conclusion "skipped", which siblingCanSettle treats as settling-eligible. A skipped run is also typically NEWER than the review run (comments land while the review is running). Consequence in any deployment where the sibling list is visible (i.e. where actions:read is granted): the in-flight review run's publish step gets publishClean=false — the promised "✅ No findings" verdict is silently not posted (markClean never runs) — and the settle step gets clearEyes=false/addThumb=false, leaving the 👀 on the PR forever and the 👍 never placed, because the newer skipped sibling never settles either. This is exactly the class the commit fixed for cancelled runs; skipped runs (the same "never reaches settle" property, and far more common — any PR conversation) were not updated. Fix: treat conclusion/status "skipped" like "cancelled" in siblingCanSettle (a run can only veto if it will actually run its settle step).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah fair, done in 16a2e12

@orcacode-review orcacode-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐳 OrcaCode Review

✅ No findings — nothing to flag in this PR. Great work!

OrcaCode Review — Route Smarter. Ship Safer. Spend Less.
Engine-reported: 227 calls · 11.5M tokens · 94% cached

❤️ Share · Install OrcaCode Review

Free on GitHub — the review runs on your own OrcaRouter key. If it helped, a shout-out goes a long way.

Share: X · Reddit · LinkedIn
Follow: X · Discord · LinkedIn · OrcaRouter

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.

Reactions need one authoritative run, not a guard per call site

1 participant