mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-09 04:02:35 +00:00
fix(agent-presets): treat absent turn boundary as blank
This commit is contained in:
@@ -715,10 +715,8 @@ export class AgentPresets extends TypertRemoteService {
|
||||
// model-loop execution; standalone plugin events never open one, so a
|
||||
// session that has only run commands is still blank.
|
||||
const boundary = this.selfCtx.sessionProjections.stateOf(agent.session, 'turnBoundary')
|
||||
if (boundary === undefined) {
|
||||
throw new Error('agent-presets: select requires the turnBoundary session projection')
|
||||
}
|
||||
if (boundary.openTurnStartSeq !== null || boundary.lastTurn > 0) {
|
||||
if (boundary !== undefined
|
||||
&& (boundary.openTurnStartSeq !== null || boundary.lastTurn > 0)) {
|
||||
throw new PresetLockedError(agent.id, agentPreset)
|
||||
}
|
||||
const preset = await this.recompose(agent.ctx, agentPreset)
|
||||
|
||||
@@ -366,7 +366,7 @@ describe('switching one session\'s composition', () => {
|
||||
expect(recordedPreset(agent)).toEqual({ agentPreset: 'minimal' })
|
||||
})
|
||||
|
||||
it('fails loudly when a composition omits the turn boundary projection', async () => {
|
||||
it('treats an absent turn boundary as no prior turn', async () => {
|
||||
const ctx = await harness()
|
||||
const agent = await agentOn(ctx, 'sel-no-turn-boundary', 'standard')
|
||||
const stateOf = ctx.sessionProjections.stateOf.bind(ctx.sessionProjections)
|
||||
@@ -374,12 +374,7 @@ describe('switching one session\'s composition', () => {
|
||||
key === 'turnBoundary' ? undefined : stateOf(session, key)
|
||||
))
|
||||
|
||||
const failure = await remoteFailure(ctx.agentPresets.select(agent, 'minimal'))
|
||||
|
||||
expect(failure).toMatchObject({
|
||||
code: 'internal',
|
||||
message: expect.stringContaining('select requires the turnBoundary session projection') as string,
|
||||
})
|
||||
expect(await ctx.agentPresets.select(agent, 'minimal')).toBe('minimal')
|
||||
})
|
||||
|
||||
it('serializes two concurrent switches on one session', async () => {
|
||||
|
||||
Reference in New Issue
Block a user