mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-08-21 06:24:32 +00:00
fix(hermes): only attribute PRs mentioned by the user or assistant
Tool dumps (gh pr list, changelog grep) were smearing one session across dozens of pull URLs. Capture links from user and assistant text only.
This commit is contained in:
parent
f97d084109
commit
0abbbd1b4a
2 changed files with 25 additions and 2 deletions
|
|
@ -413,8 +413,9 @@ function createParser(source: SessionSource, seenKeys: Set<string>, hermesHome:
|
|||
seenKeys.add(dedupKey)
|
||||
|
||||
const prLinks = extractGithubPullUrls(
|
||||
...messages.map(msg => msg.content),
|
||||
...messages.map(msg => msg.tool_calls),
|
||||
...messages
|
||||
.filter(msg => msg.role === 'assistant' || msg.role === 'user')
|
||||
.map(msg => msg.content),
|
||||
)
|
||||
|
||||
// Hermes bills reasoning tokens at the output rate (same as Gemini).
|
||||
|
|
|
|||
|
|
@ -520,6 +520,28 @@ skipUnlessSqlite('hermes provider', () => {
|
|||
expect(calls[0]?.project).toBe('hermes')
|
||||
})
|
||||
|
||||
it('ignores GitHub pull URLs that only appear in tool dumps', async () => {
|
||||
const dbPath = createHermesDb(tmpDir)
|
||||
withTestDb(dbPath, (db) => {
|
||||
insertSession(db, {
|
||||
id: 'tool-pr-noise',
|
||||
inputTokens: 10,
|
||||
outputTokens: 5,
|
||||
cacheReadTokens: 0,
|
||||
cacheWriteTokens: 0,
|
||||
reasoningTokens: 0,
|
||||
startedAt: 1779549200,
|
||||
})
|
||||
db.prepare('INSERT INTO messages (session_id, role, content, timestamp) VALUES (?, ?, ?, ?)')
|
||||
.run('tool-pr-noise', 'tool', 'https://github.com/getagentseal/codeburn/pull/677 https://github.com/getagentseal/codeburn/pull/691', 1779549201)
|
||||
db.prepare('INSERT INTO messages (session_id, role, content, timestamp) VALUES (?, ?, ?, ?)')
|
||||
.run('tool-pr-noise', 'assistant', 'Closed the stale draft. Next is Keychain.', 1779549202)
|
||||
})
|
||||
|
||||
const calls = await collectCalls(tmpDir, `${dbPath}#hermes-session=tool-pr-noise`)
|
||||
expect(calls[0]?.prLinks).toBeUndefined()
|
||||
})
|
||||
|
||||
it('infers projects from Windows current working directory messages', async () => {
|
||||
const dbPath = createHermesDb(tmpDir)
|
||||
withTestDb(dbPath, (db) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue