mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-08-21 14:34:32 +00:00
fix(insights): stop counting prose 'wrong answer' as a user correction
This commit is contained in:
parent
7b6757504f
commit
420f1f051f
2 changed files with 19 additions and 1 deletions
|
|
@ -20,7 +20,12 @@ export const USER_CORRECTION_PATTERNS: RegExp[] = [
|
|||
/\byou (?:missed|forgot|misunderstood|broke)\b/i,
|
||||
/\brevert (?:that|it|this|your|the last|the change)\b/i,
|
||||
/\bundo (?:that|it|this|your|the last|the change)\b/i,
|
||||
/\bwrong (?:file|approach|place|method|function|answer|way|direction)\b/i,
|
||||
// "answer" is deliberately absent from the noun list: injected skill/system
|
||||
// prose lands in the user-message slot and reads as ordinary writing where
|
||||
// "the wrong answer" is an idiom ("a well-composed page is never the wrong
|
||||
// answer" counted 4 phantom corrections on real data). The other nouns are
|
||||
// concrete work artifacts that prose rarely uses with "wrong".
|
||||
/\bwrong (?:file|approach|place|method|function|way|direction)\b/i,
|
||||
/\bstill (?:wrong|broken|failing|not working)\b/i,
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -119,12 +119,25 @@ describe('scanUserCorrections', () => {
|
|||
'undo the migration when done',
|
||||
'the build is failing, can you fix it',
|
||||
'what went wrong here',
|
||||
// Verbatim from an injected skill prompt that counted 4 phantom
|
||||
// corrections on real data: "wrong answer" is prose idiom, not a
|
||||
// correction, which is why "answer" is not in the wrong-<noun> list.
|
||||
'When unsure: a well-composed page is never the wrong answer; an over-designed visual identity sometimes is.',
|
||||
]
|
||||
const p = project([session('s1', phrases.map(m => turn({ userMessage: m })))])
|
||||
const r = scanUserCorrections([p])
|
||||
expect(r.corrections).toBe(0)
|
||||
})
|
||||
|
||||
it('still flags concrete wrong-<artifact> follow-ups', () => {
|
||||
const p = project([session('s1', [
|
||||
turn({ userMessage: 'rename the helper' }),
|
||||
turn({ userMessage: 'you edited the wrong file' }),
|
||||
turn({ userMessage: "that's the wrong approach, use the cache" }),
|
||||
])])
|
||||
expect(scanUserCorrections([p]).corrections).toBe(2)
|
||||
})
|
||||
|
||||
it('ignores continuation turns with no fresh prompt', () => {
|
||||
const p = project([session('s1', [
|
||||
turn({ userMessage: 'build the feature' }),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue