mirror of
https://github.com/stablyai/orca.git
synced 2026-11-18 11:54:46 +00:00
Let Send-now steer a queued message while an earlier steer is unechoed (#43293)
This commit is contained in:
+11
-12
@@ -134,20 +134,19 @@ export function sendQueuedStructuredAgentMessage(
|
||||
if (row.body.command && work.working()) {
|
||||
return invalid("A command can't be sent while the agent is working.")
|
||||
}
|
||||
// An earlier unechoed send never blocks: delivery orders handovers behind it and its opening turn.
|
||||
if (
|
||||
(work.activeTurnId() !== null || work.queueState().owedEnteredSubmissions.length > 0) &&
|
||||
(work.activeTurnId() === null ||
|
||||
work.queueState().owedEnteredSubmissions.length > 0 ||
|
||||
!canSteerStructuredQueuedMessage(
|
||||
{
|
||||
record,
|
||||
work,
|
||||
child: context.sessions.get(ctx.sessionId)?.child,
|
||||
stopping: await context.readStopping(ctx.sessionId),
|
||||
adapter: context.deps.adapter
|
||||
},
|
||||
row
|
||||
))
|
||||
!canSteerStructuredQueuedMessage(
|
||||
{
|
||||
record,
|
||||
work,
|
||||
child: context.sessions.get(ctx.sessionId)?.child,
|
||||
stopping: await context.readStopping(ctx.sessionId),
|
||||
adapter: context.deps.adapter
|
||||
},
|
||||
row
|
||||
)
|
||||
) {
|
||||
return {
|
||||
ok: false,
|
||||
|
||||
+13
@@ -72,3 +72,16 @@ it('a steer send waiting on approval joins the running turn when approval clears
|
||||
await eventually(async () => expect((await rig.handoff(steer.id))?.handedOverAt).toBeDefined())
|
||||
expect(await rig.handoff(queueOnly.id)).toBeUndefined()
|
||||
})
|
||||
|
||||
it('Send-now steers a second card while the first steer is still unechoed', async () => {
|
||||
const opener = await rig.workingSend()
|
||||
await rig.settleAccepted(opener, 'opening')
|
||||
await openRigTurnFor(rig, opener)
|
||||
const first = rig.send('first card', 'queue-if-active')
|
||||
const second = rig.send('second card', 'queue-if-active')
|
||||
await Promise.all([first.result, second.result])
|
||||
expect(await rig.sendNow(first.id)).toMatchObject({ ok: true })
|
||||
await eventually(async () => expect((await rig.handoff(first.id))?.handedOverAt).toBeDefined())
|
||||
expect(await rig.sendNow(second.id)).toMatchObject({ ok: true })
|
||||
await eventually(async () => expect((await rig.handoff(second.id))?.handedOverAt).toBeDefined())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user