Skip to content

review: stop replaying answered scope questions - #429

Closed
jwbron wants to merge 2 commits into
mainfrom
agent/answered-scope-replay
Closed

jwbron wants to merge 2 commits into
mainfrom
agent/answered-scope-replay

Conversation

@jwbron

@jwbron jwbron commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The bot shouldn't ask "is this cleanup already ticketed?" again after the PR author says yes. This change retains that answer when the bot closes the old discussion, so a full re-review can skip the repeated ask. A defect that was fixed and then returns can still be reported.

  • The agent deciding which old discussions to close can explicitly mark a non-blocking question as answered. Code requires a bot-authored question, a nonempty PR-author reply, and a decision to close rather than keep the discussion.
  • Cache writing uses dispatch's parsed reconciliation, so fenced and prose-wrapped agent responses retain the answer too.
  • Answered questions stay available to the duplicate checker during that run and are remembered in the existing per-PR cache after their resolutions are queued. Editing or adding replies invalidates the saved answer.
  • Blocking rules, text-matching thresholds, and comment layout are unchanged. Missing classification or cache can still allow repetition, and this doesn't infer answers for older closed discussions.

Background

On webapp#42048, the author answered that the follow-up was already ticketed. The repeated question posted 30 minutes 50 seconds later. Recovered run artifacts show the reply was staged, but closing the old discussion removed it from the duplicate check. The two questions already clear the existing text-matching thresholds.

The exact production resolver login wasn't recovered. Resolutions use a separate bot token, and the existing code distinguishes human and bot resolutions by account identity. This PR preserves explicit answers without changing those identity rules.

Test plan

  • pnpm exec vitest run: 2,428 tests across 126 files pass after rebasing onto main.
  • pnpm lint, pnpm typecheck, pnpm build, and git diff --check pass.
  • Replay the recovered question pair through the unchanged matcher. Three lifecycle cases fail against the original implementation by allowing the repeated question through, then pass with the fix.
  • Exercise staging, full dispatch, submission, cache writing, and another full re-review in a fresh filesystem. Fixed-then-regressed suggestions, defect questions, and blocking issues still reach the posting plan.
  • Cover malformed evidence, changed replies, older agent outputs, missing queued resolutions, and canary history isolation.
  • Before merge, check the PR-triggered lint, push-event tests, live A/B, and review-bot results, and address any findings.
  • Before release, run a no-post model check of answered, fixed, will-fix, and unanswered cases. The repo's live runner requires ANTHROPIC_API_KEY, which this session doesn't have, so the classification hasn't been tested against a real model. The PR's existing live A/B smoke run doesn't cover this new classification.
  • Confirm the original thread's resolvedBy login. If the separate bot account is being treated as human adjudication, track that as a separate fix rather than expanding this PR.
  • After release, bump one consumer and inspect an answered-question lifecycle: the answered decision, suppression record, saved cache entry, and next full re-review. Check that evidence before broader rollout.

KORE-2718

@changeset-bot

changeset-bot Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 406b6a9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
review Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@khan-actions-bot
khan-actions-bot requested review from a team, jeresig and kevinb-khan and removed request for a team September 8, 2026 20:14
@jwbron

jwbron commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

The initial Node CI Push run failed before the tests because the changed-files action couldn't find a PR associated with the new commit. It started before this PR was opened: https://github.com/Khan/actions/actions/runs/34273439252.

It needs a rerun now that the PR exists: gh run rerun 34273439252 -R Khan/actions --failed. The sandbox broker doesn't expose the rerun operation. Local tests, lint, typecheck, and build pass, and the PR-triggered checks are still running.

@khan-actions-bot
khan-actions-bot requested a review from a team September 8, 2026 20:37

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Commented — medium-importance findings found; nothing blocks.

Lower-confidence observations (6; top: `workflows/review/lib/stage-pr.ts:728` suggestion (non-blocking, documentation): The file-header manifest still says `adjudicated-threads.json` holds only human-resolved or downvoted threads, but this...)
  • workflows/review/lib/stage-pr.ts:728 suggestion (non-blocking, documentation): The file-header manifest still says adjudicated-threads.json holds only human-resolved or downvoted threads, but this write now also emits bot-resolved answered questions. (documentation)
  • workflows/review/lib/answered-questions.ts:85 thought (non-blocking): The conversation hash covers comments the evidence check itself treats as meaningless, so appending a bot or third-party reply erases a still-valid answer and the replay returns. (first-principles)
  • workflows/review/review.md:1969 question (non-blocking): The new answered classification is a model judgment that grants standing duplicate suppression, and the PR's own test plan records that it has never been exercised against a real model ("the classification hasn't been tested against a real model" / "The PR's existing live A/B smoke run doesn't cover this new classification"), with no eval corpus case added. (skill-auditor (out-of-lane))
  • workflows/review/review.md:1965 question (non-blocking): Why must an answered scope question be resolved and then re-derived from cache memory, rather than routed to keep like the conceded-but-unfixed case, which already suppresses re-raising with no memory at all? (first-principles)
  • workflows/review/lib/fixtures/answered-scope-42048.json:1 note (non-blocking): This adds the first subdirectory and the first JSON fixture to the otherwise flat lib/, where the repo's stated fixture mould is a *-fixtures.ts module. (conventions)
  • workflows/review/lib/answered-questions.ts:67 suggestion (non-blocking): The opener's label is matched with a new inline regex instead of the label extraction dedup-threads.ts already owns; factor that extraction out and reuse it. (conventions)
review details review-v1.25.0 | schema 2 | depth full | re-review scoped blocking-medium | enable holistic,completeness,test-adequacy,first-principles,conventions,documentation
review fingerprint pr-reviewer:rereview v=1 depth=full verdict=COMMENT anchor-draft=false hunks=eyIuY2hhbmdlc2V0L2Fuc3dlcmVkLXNjb3BlLXF1ZXN0aW9ucy5tZCI6WyIyOTc3YjZjN2NiY2JlMTBkIl0sIndvcmtmbG93cy9yZXZpZXcvUkVBRE1FLm1kIjpbIjQ3MGY4NjMwNWVkOTc5ODkiLCI2YmY2NWI3ZWE5OTI1ZGM0Il0sIndvcmtmbG93cy9yZXZpZXcvbGliL2Fuc3dlcmVkLXF1ZXN0aW9ucy50ZXN0LnRzIjpbIjllM2M1NGZkYjBhOWE4N2IiXSwid29ya2Zsb3dzL3Jldmlldy9saWIvYW5zd2VyZWQtcXVlc3Rpb25zLnRzIjpbIjA5ZGY4NWU0MWMxNTZkNjIiXSwid29ya2Zsb3dzL3Jldmlldy9saWIvYW5zd2VyZWQtc2NvcGUtcmVyZXZpZXcudGVzdC50cyI6WyI3Y2NjMmEwYWRkMmMwY2Q4Il0sIndvcmtmbG93cy9yZXZpZXcvbGliL2NhY2hlLXJlY29yZC50cyI6WyI5MWE2NjZhZDgzOTNiOTEzIiwiOTNlMGU3ZmJmZTdlYTcyNCIsIjZjYmQyZTI3YWY0MWMyMTAiXSwid29ya2Zsb3dzL3Jldmlldy9saWIvZGVkdXAtYWRqdWRpY2F0ZWQudHMiOlsiMzRhZGY5YWIyY2MwOWY3MSIsImRiOTE4OGRiMmU1MGQ5MDIiLCJkYjkxOGY3NzMyZjQ1ZGFmIl0sIndvcmtmbG93cy9yZXZpZXcvbGliL2Rpc3BhdGNoLnRzIjpbIjg3ODYzZTE0YjNjNWI3MmUiLCJmNTBkYjk1ZGRjZGJmODk0IiwiYjk5MzczM2U1NDAyOGFmNiIsIjNmYjM1YzIwNTJkODdkNGQiLCJmZjQ5OGM0MTczMWY4YTczIl0sIndvcmtmbG93cy9yZXZpZXcvbGliL2ZpeHR1cmVzL2Fuc3dlcmVkLXNjb3BlLTQyMDQ4Lmpzb24iOlsiM2FkYmYzYWVhMTlkOTQ3NiJdLCJ3b3JrZmxvd3MvcmV2aWV3L2xpYi9zdGFnZS1wci50cyI6WyIxNzk5YjRjYjM0N2RkNzhkIiwiN2IwYmNlOTUzM2M3MmU1YiIsImRiZWM5OTMwNGMwZGFkODUiLCIxNWMxZTdhMDVmNDhhN2JkIl0sIndvcmtmbG93cy9yZXZpZXcvcmV2aWV3Lm1kIjpbIjljYmMyYmJlMDZiOGM5OTEiXX0

Comment thread workflows/review/lib/cache-record.ts Resolved
@@ -0,0 +1,5 @@
---
"review": patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion (non-blocking, best-practice): This changeset ships a reviewer behavior change as patch; the review workflow's versioning policy makes semver the behavior contract, so it should be a minor bump.

context

This changeset ships a reviewer behavior change as patch; the review workflow's versioning policy makes semver the behavior contract, so it should be a minor bump. workflows/review/README.md's "Version attribution" section states the policy: "Semver is the behavior contract: a release that changes the reviewer's behavior bumps the major version, so a consumer pinned to review-v<major> can assume the fundamental behavior holds within a major." The added changeset declares the weakest level instead:

"review": patch

This PR does change the reviewer's behavior on consumers: dedup-adjudicated.ts now admits a bot-resolved thread into the adjudicated suppression corpus when answeredBy is verified ((!humanResolved && !downvoted && !answered)), dispatch.ts routes the corpus through includeAnsweredQuestions(...), and review.md adds a new answered field to the thread-reconciler output contract — so a non-blocking question that previously re-posted on a full re-review now posts nothing. The changeset's own summary says as much ("Keep explicitly answered scope questions eligible for duplicate suppression").

What I checked on the checkout: workflows/review/CHANGELOG.md's 1.24.0 entry records the repo's own reading of this policy — "Minor, not patch, per the versioning precedent for posting-surface changes (1.20.0, 1.21.0)" — and of the pending changesets in .changeset/, the two that change production behavior (manual-review-depth.md, review-cost-report.md) are minor while every patch one is eval-harness-only (review-eval-*.md). So patch is wrong under both the README's literal text and the shipped precedent; minor is what the precedent uses for a posting-surface change like this one.

A sketch, not a committable replacement:

---
"review": minor
---

found by skill-auditor

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Review live A/B

Baseline: origin/main (review.md 3b4f69f79dac); candidate: working tree (review.md e9f4506c7aa6).

Ruler: matcher deterministic-v2+arbiter; corpus 955f4ba38ba7 (10 cases); tools read-scoped:v1:Read,Grep,Glob.

Metric Baseline Candidate Delta
Must-catch recall 100% 100% +0%
Verdict agreement 100% 100% +0%
Noise (unmatched posted) 47% 33% -14%
of which duplicates of a claimed defect 5 4
Legitimate unspecced (may-flag, not noise) 25% 29% +4%
Cases with may-flag entries (audited) 8 / 10 8 / 10
Clean false flags 0 0
Judge mean quality 0.90 0.88 -0.02
Cost (list price) $7.06 $6.51
Cost (Khan rate) $3.53 $3.26
Judge + arbiter (list / Khan rate) $0.04 / $0.02 $0.03 / $0.02
Run total (list / Khan rate) $7.10 / $3.55 $6.54 / $3.27
Tool calls 323 303 0.94x
Cost per tool call (list / Khan rate) $0.0219 / $0.0109 $0.0215 / $0.0107
Wall clock 1607s 1492s
Cases run / skipped 10 / 0 10 / 0
Misses found-but-dropped 0 0
Findings anchor-snapped 2 0
Cross-source claims merged (of candidates) 7 / 40 (1 by clusterer at $0.32 list, $0.16 Khan rate / 198s, 12 proposed member(s) rejected) 7 / 33 (0 by clusterer at $0.26 list, $0.13 Khan rate / 165s, 8 proposed member(s) rejected)
Reads denied outside the staged case 4 2

Cost (Khan rate) prices the same tokens at the models.providers overlay in review.md, which is what production meters (claude-haiku-4-5-20251001, claude-opus-5, claude-sonnet-4-6). Cost (list price) is the SDK's own meter, what a bare API key bills, and the eval bills at list because it never crosses the api-proxy.

Judge + arbiter is the instrument's own spend (haiku, priced from tokens), not in Cost. Run total adds it to Cost.

Adversarial hard gate: PASSED on the candidate arm.

Reviewers that read outside the staged case

  • baseline / adversarial-injection-approve / skill-auditor: 1 read(s) denied; read its transcript
  • baseline / incident-money-rounding / skill-auditor: 1 read(s) denied; read its transcript
  • baseline / trial-dedup-composite-key / skill-auditor: 1 read(s) denied; read its transcript
  • baseline / trial-dedup-composite-key / claim-validator: 1 read(s) denied; read its transcript
  • candidate / incident-money-rounding / money-payments: 1 read(s) denied; read its transcript
  • candidate / trial-dedup-composite-key / claim-validator: 1 read(s) denied; read its transcript

Single-run-stable rows: recall, verdict agreement, regressions, adversarial gate. Judge quality and noise are not: they jitter run-to-run at this corpus size, and a regressed reviewer can score HIGHER on judge quality (fewer, surer comments each read better). Recall against the labeled specs is the load-bearing metric.

Measured noise floor (identical arms, run 29069228968, 2026-07-10, 6 arm-samples, full corpus x3, pre-arbiter; budget skips left the samples on unequal case sets, so these v1 bands also carry case-mix variance): must-catch recall 54%-86% (sd 10%), verdict agreement 75%-100% (sd 9%), noise (unmatched posted) 50%-60% (sd 3%), judge mean quality 82%-86% (sd 2%). A single-run delta whose arms both sit inside a band is indistinguishable from run-to-run wobble; use --repeats to resolve smaller effects. The noise (unmatched posted) band was measured before the may-flag and duplicate buckets, so it reads high against post-2026-09-03 numbers.

@jwbron

jwbron commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Answered questions now survive fenced and prose-wrapped reconciler responses. The cache writer uses dispatch's parsed reconciliation instead of strictly parsing the raw agent output. Both new lifecycle cases failed before the fix, and the blocking-candidate test now proves the non-blocking counterpart is suppressed first. Evidence checks, queued resolutions, blocking protection, and canary isolation are unchanged.

All 2,428 tests pass, along with lint, root typecheck, build, and diff checks. The targeted workflow strict check reproduces the same 6 errors on the original PR head.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved — no blocking issues found.
2 of 3 prior review threads resolved; 1 still unaddressed as of 406b6a9:

1 non-blocking thread still open
  • suggestion (non-blocking, best-practice) .changeset/answered-scope-questions.md:2: This changeset ships a reviewer behavior change as patch; the review workflow's versioning policy makes semver the beh...
Non-blocking observations (5; top: `workflows/review/lib/cache-record.ts:521` question (non-blocking): The carried-fields comment above this block no longer holds: `answeredQuestions` is a third field that survives from the...)
  • workflows/review/lib/cache-record.ts:521 question (non-blocking): The carried-fields comment above this block no longer holds: answeredQuestions is a third field that survives from the prior record. (skill-auditor (out-of-lane))
  • workflows/review/lib/cache-record.ts:521 suggestion (non-blocking): No test exercises a run that records a new answer while an earlier answer is already in the cache, so the carried-plus-new merge could silently regress to overwriting. (test-adequacy)
  • workflows/review/lib/cache-record.ts:534 suggestion (non-blocking): The answered record's only cross-run carrier is the cache, and this subsystem documents that cache writes are denied on the /review comment trigger — so an answer resolved by such a run never persists. (holistic)
  • workflows/review/lib/cache-record.ts:525 suggestion (non-blocking): Carried answeredQuestions entries are only isRecord-filtered, not type-narrowed on thread_id like the other carried fields, so a malformed entry keys the Map under undefined and persists. (conventions)
  • workflows/review/lib/answered-scope-rereview.test.ts:247 question (non-blocking): The new answered reconciler classification has no live.rereview corpus case, so its recall is only exercised by a lib test that hard-codes the classification. (skill-auditor (out-of-lane))
Note: re-review ran at scoped depth (re-review mode scoped, blocking-medium).
review details review-v1.25.0 | schema 2 | depth scoped | re-review scoped blocking-medium | enable holistic,completeness,test-adequacy,first-principles,conventions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Y29wZS00MjA0OC5qc29uIjpbIjNhZGJmM2FlYTE5ZDk0NzYiXSwid29ya2Zsb3dzL3Jldmlldy9saWIvc3RhZ2UtcHIudHMiOlsiMTc5OWI0Y2IzNDdkZDc4ZCIsIjdiMGJjZTk1MzNjNzJlNWIiLCJkYmVjOTkzMDRjMGRhZDg1IiwiMTVjMWU3YTA1ZjQ4YTdiZCJdLCJ3b3JrZmxvd3MvcmV2aWV3L3Jldmlldy5tZCI6WyI5Y2JjMmJiZTA2YjhjOTkxIl19

@kevinb-khan

Copy link
Copy Markdown
Contributor

Review-bot is moving into a private repo and this PR is stale.

@kevinb-khan kevinb-khan closed this Dec 2, 2026
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.

4 participants