mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
Add Codex multi-agent timeline support (#588)
* checkpoint codex multiagent UI state * fix codex multiagent event scoping * fix: stabilize codex subagent timeline * chore: remove codex subagent nesting prompt * test(web): stabilize tool result rendering tests * fix: collapse codex agent trace rows by default * fix(web): keep chat scrolled to bottom * fix(web): backfill agent-run-heavy message loads * fix(codex): fail stuck subagent spawns * fix(codex): preserve wrapped child event scope * fix(codex): surface agent tool completions
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { reduceChatBlocks } from './reducer'
|
||||
import type { NormalizedMessage } from './types'
|
||||
|
||||
describe('reduceChatBlocks', () => {
|
||||
it('ignores child agent usage when calculating parent latest usage', () => {
|
||||
const messages: NormalizedMessage[] = [
|
||||
{
|
||||
id: 'parent-usage',
|
||||
localId: null,
|
||||
createdAt: 1_700_000_000_000,
|
||||
role: 'event',
|
||||
content: { type: 'token-count', info: {} },
|
||||
isSidechain: false,
|
||||
usage: {
|
||||
input_tokens: 100,
|
||||
output_tokens: 10,
|
||||
context_tokens: 100,
|
||||
scope_role: 'parent'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'child-usage',
|
||||
localId: null,
|
||||
createdAt: 1_700_000_001_000,
|
||||
role: 'event',
|
||||
content: { type: 'token-count', info: {} },
|
||||
isSidechain: false,
|
||||
usage: {
|
||||
input_tokens: 999,
|
||||
output_tokens: 1,
|
||||
context_tokens: 999,
|
||||
scope_role: 'child'
|
||||
}
|
||||
}
|
||||
] as NormalizedMessage[]
|
||||
|
||||
const reduced = reduceChatBlocks(messages, null)
|
||||
|
||||
expect(reduced.latestUsage).toMatchObject({
|
||||
inputTokens: 100,
|
||||
outputTokens: 10,
|
||||
contextSize: 100
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user