Repository navigation
fix(parser): extractConfidence reads the last CONFIDENCE marker - #7
Merged
Merged
Conversation
…digits The protocol puts the score on the final line, but extractConfidence took the first "confidence:" hit: an earlier preview captured the score, and an inline "Confidence: high" made the whole response score 50 even with a valid trailing CONFIDENCE line. It now returns the last marker followed by digits (Roundtable's semantics); markers without digits are skipped. Default 50 and clamping are unchanged. This changes ConsensusEngine.run() scores for responses that mention "confidence:" before their trailing line. The existing test that pinned first-occurrence (with a comment misstating Roundtable's parser) is inverted; new parser and engine-level tests cover the trailing rule. extractTrailingConfidence (added in the unreleased 0.13.0, already used by Roundtable's main) stays as a deprecated alias of extractConfidence, so the order in which the repos land or release does not matter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
extractConfidencenow returns the value of the lastconfidence:marker followed by digits (case-insensitive), instead of the first marker. A marker without digits, such as "Confidence: high", is skipped rather than returning 50. The default (50 when no marker has digits) and clamping to 0–100 are unchanged.extractTrailingConfidence, added in the unreleased 0.13.0 and already imported by Roundtable'smain, stays as a deprecated alias ofextractConfidence. That way it doesn't matter in which order the three repos land or release.The 0.13.0 CHANGELOG and README are updated; the version stays 0.13.0, since nothing is published yet.
Why
You approved this as a follow-up to #6.
The protocol asks for the score on the final line (
CONFIDENCE: [number 0-100]), but the parser took the first hit:Roundtable always used last-match semantics. That mismatch was half of what blocked moving Roundtable's CVP onto
run(); only the 1-seat allowance remains.Behaviour change:
ConsensusEngine.run()scores change for responses that mention "confidence:" before their trailing line. Responses with a single trailing marker score exactly as before.How it was verified
npm run typecheck,npm test(261 tests) andnpm run buildpass on Node 24, and the tests pass on Node 20.20.2 [executed].run()scores the trailing line when a response first says "Confidence: high" or previews a number.mainpasses its 622 tests, including its own "picks the LAST CONFIDENCE marker" test. ai-consensus-mcpmaintypechecks and passes its 656 tests [executed].What is left
extractJudgeConfidencestill takes the firstJUDGE_CONFIDENCE:marker. It's the same pattern but was outside the approved change; flipping it is a one-line follow-up if wanted.extractConfidence, after which the alias can be removed in a later minor.normalize.tsheader comment still says "firstconfidence:hit".