mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-09 04:02:35 +00:00
test(agent-loop): account for route switch notice during prompt admission
The plain-to-capable transition emits the model-selection notice inherited from master. Preserve the exact in-history system ordering and assert both the admitted user input and the single durable notice instead of expecting the obsolete five-message request. Reproduces the identical Linux and Windows CI failure; all 57 adjacent admission, projection, reconstruction and selection tests pass.
This commit is contained in:
@@ -205,7 +205,22 @@ describe('prepared-route prompt admission', () => {
|
||||
expect(systemTexts(h.capable.requests[0]!)).toEqual([
|
||||
[{ type: 'text', text: 'prompt one' }], [{ type: 'text', text: 'prompt two' }],
|
||||
])
|
||||
expect(h.capable.requests[0]!.messages.map(message => message.role)).toEqual(['system', 'user', 'assistant', 'system', 'user'])
|
||||
const messages = h.capable.requests[0]!.messages
|
||||
expect(messages.map(message => message.role)).toEqual(['system', 'user', 'assistant', 'system', 'user', 'user'])
|
||||
const notice = [{
|
||||
type: 'text',
|
||||
text: '[model changed: assistant turns above this point were generated by plain/model; the session continues with capable/model]',
|
||||
}]
|
||||
expect(messages.slice(-2).map(message => message.content)).toEqual([
|
||||
[{ type: 'text', text: 'second' }], notice,
|
||||
])
|
||||
const notices = h.agent.session.snapshotEvents().filter(event => event.type === 'user/message'
|
||||
&& event.data.source.kind === 'plugin' && event.data.source.plugin === 'model-selection')
|
||||
expect(notices).toHaveLength(1)
|
||||
expect(notices[0]!.data).toMatchObject({
|
||||
content: notice,
|
||||
source: { kind: 'plugin', plugin: 'model-selection', form: 'notice', summary: 'plain/model → capable/model' },
|
||||
})
|
||||
})
|
||||
|
||||
it.each([false, true])('resumes capable history with first pre-step replacement=%s', async (replace) => {
|
||||
|
||||
Reference in New Issue
Block a user