Skip to content

feat(foreman): semantic issueAsk verification instead of verbatim substring#1020

Merged
Defilan merged 1 commit into
defilantech:mainfrom
Defilan:fix/reviewer-issueask-semantic
Jul 9, 2026
Merged

feat(foreman): semantic issueAsk verification instead of verbatim substring#1020
Defilan merged 1 commit into
defilantech:mainfrom
Defilan:fix/reviewer-issueask-semantic

Conversation

@Defilan

@Defilan Defilan commented Jul 9, 2026

Copy link
Copy Markdown
Member

What

Make the reviewer's issueAsk verification semantic instead of verbatim. A faithful paraphrase of the fetched issue is now accepted; only a genuine confabulation is demoted.

Why

The issueAsk rail required the reviewer's stated ask to be a literal substring of the fetched issue body. That conflated "paraphrased but correct" with "wrong issue entirely" — both set issueAskVerified: false and demoted GO → NO-GO, penalizing reviewers who understood the scope but restated it in their own words.

How

Two-tier check in reconcileReviewerIssueAsk:

  1. Verbatim substring → verified immediately (unchanged).
  2. Keyword-overlapissueAskSemanticallyCovers extracts the issue's salient tokens (title + first two paragraphs, markdown-stripped, stop-words removed, tokens > 2 chars) and verifies when the claim covers ≥40% of them (min 2). Explainable, deterministic, no embedding model.
  3. Neither → archive claim, rewrite from body, mark unverified (unchanged).

Surfaces issueAskMethod (semantic / rewritten) alongside issueAskVerified so demotions stay auditable, and updates the compatibility doc.

Testing

  • New: ParaphraseVerified (faithful paraphrase → verified, method=semantic), HallucinationRewritten (unrelated claim → rejected + rewritten + issueAskClaimed preserved), ExtractIssueKeywords_Basic/_StopsFiltered, IssueAskSemanticallyCovers_ShortClaim.
  • The 5 pre-existing issueAsk tests (verbatim, confabulation, no-fetch, empty-claim, nil-extra) still pass — no regression.
  • go build / go vet / gofmt clean.

Checklist

  • Fixes #809
  • Positive and negative behavior covered by tests
  • No regression to the existing verbatim/confabulation paths
  • AI assistance disclosed below

Assisted-by: Claude Code — this change was generated end-to-end by Foreman (LLMKube's agentic coder, running Ornith-35B on the AMD Strix) against #809, then reviewed for correctness (logic, test quality, no confabulation) and DCO-signed by the maintainer before submission.

The reviewer's issueAsk rail previously required the model's stated ask
to be a literal substring of the fetched issue body. This conflated
"paraphrased but correct" with "wrong issue entirely": both produced
`issueAskVerified: false` and demoted GO to NO-GO, including cases
where the reviewer understood the scope faithfully.

Replace the verbatim check with a two-tier gate:
  1. Verbatim substring match -> verified immediately (unchanged).
  2. Keyword-overlap check between claim and issue body -> verified
     if the claim references a sufficient fraction of the issue's
     salient nouns/verbs (threshold: 40%, minimum 2 keywords).
  3. Neither passes -> archive claim, rewrite from body, mark
     unverified (unchanged).

The keyword extractor strips markdown, lowercases, removes common
English stop words, and filters tokens <= 2 chars. It takes the title
plus the first two paragraphs of the body. This is more explainable
than raw embedding similarity and requires no external model.

Surface the method used (`issueAskMethod: semantic` or `rewritten`)
next to `issueAskVerified` so demotions are auditable. Update the
demotion reason strings and docs to reflect the new semantics.

Fixes defilantech#809

Signed-off-by: Christopher Maher <chris@mahercode.io>
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.69767% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/foreman/agent/executor_native.go 90.69% 4 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

@Defilan Defilan merged commit 85d92ee into defilantech:main Jul 9, 2026
24 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 9, 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.

1 participant