mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
test(subagent): assert inherited runtime context
This commit is contained in:
@@ -100,7 +100,20 @@ describe('in-process policy inheritance', () => {
|
||||
const request = child.session.events.find(
|
||||
(event): event is SessionEvent<'request/header'> => event.type === 'request/header',
|
||||
)
|
||||
expect(request?.data.header.system).toContain('Approval prompts are disabled')
|
||||
const runtimeContext = child.session.events.find(
|
||||
(event): event is SessionEvent<'user/message'> => event.type === 'user/message'
|
||||
&& event.data.source.kind === 'plugin'
|
||||
&& event.data.source.plugin === '@deepseek-ai/dsh-system-prompt',
|
||||
)
|
||||
if (request === undefined || runtimeContext === undefined) throw new Error('child request lacks its runtime policy context')
|
||||
expect(runtimeContext.seq).toBeLessThan(request.seq)
|
||||
const contextText = runtimeContext.data.content
|
||||
.filter((block): block is Extract<ContentBlock, { type: 'text' }> => block.type === 'text')
|
||||
.map(block => block.text)
|
||||
.join('\n')
|
||||
expect(contextText).toContain('Current DSH file policy: read-only')
|
||||
expect(contextText).toContain('Approval prompts are disabled')
|
||||
expect(request.data.header.system).not.toContain('Approval prompts are disabled')
|
||||
expect(parent.session.events).toHaveLength(parentLogLength)
|
||||
} finally {
|
||||
await run.dispose()
|
||||
|
||||
Reference in New Issue
Block a user