mirror of
https://github.com/stablyai/orca.git
synced 2026-09-24 16:02:41 +00:00
Merge remote-tracking branch 'origin/main' into brennanb2025/sta7416-cmd-admission
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="106" height="20" role="img" aria-label="downloads: 56m">
|
||||
<title>downloads: 56m</title>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="106" height="20" role="img" aria-label="downloads: 58m">
|
||||
<title>downloads: 58m</title>
|
||||
<linearGradient id="s" x2="0" y2="100%">
|
||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||
<stop offset="1" stop-opacity=".1"/>
|
||||
@@ -15,7 +15,7 @@
|
||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="11">
|
||||
<text x="37" y="15" fill="#010101" fill-opacity=".3">downloads</text>
|
||||
<text x="37" y="14">downloads</text>
|
||||
<text x="90" y="15" fill="#010101" fill-opacity=".3">56m</text>
|
||||
<text x="90" y="14">56m</text>
|
||||
<text x="90" y="15" fill="#010101" fill-opacity=".3">58m</text>
|
||||
<text x="90" y="14">58m</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 935 B After Width: | Height: | Size: 935 B |
+15
-12
@@ -9,20 +9,25 @@ import type { AgentSessionTurnContext } from './structured-agent-session-turns'
|
||||
const CURRENT_FENCE = 4
|
||||
|
||||
function contextWith(
|
||||
backgroundTasks: AgentSessionBackgroundTaskState | null,
|
||||
submissions: readonly AgentJournalSubmission[] = []
|
||||
backgroundTasks: AgentSessionBackgroundTaskState | null
|
||||
): AgentSessionTurnContext {
|
||||
return {
|
||||
sessionId: 'session-1',
|
||||
fence: CURRENT_FENCE,
|
||||
journal: {
|
||||
snapshot: () => ({ items: [] }),
|
||||
submissions: () => submissions
|
||||
submissions: () => []
|
||||
},
|
||||
adapter: { backgroundTaskState: () => backgroundTasks }
|
||||
} as unknown as AgentSessionTurnContext
|
||||
}
|
||||
|
||||
function contextHolding(submissions: AgentJournalSubmission[]): AgentSessionTurnContext {
|
||||
const ctx = contextWith(null)
|
||||
ctx.fence = CURRENT_FENCE
|
||||
ctx.journal.submissions = () => submissions
|
||||
return ctx
|
||||
}
|
||||
|
||||
function submission(
|
||||
dispatchState: AgentJournalSubmission['dispatchState'],
|
||||
overrides: Partial<AgentJournalSubmission> = {}
|
||||
@@ -98,33 +103,31 @@ describe('conversationCommandBlocked unsettled submissions', () => {
|
||||
// Crash recovery skips rows it already marked, the restart reconciler only
|
||||
// narrows accepted outcomes, and Retry drops the outbox entry without
|
||||
// touching the journal. Refusing here asks for a step that does not exist.
|
||||
const ctx = contextWith(null, [submission('unknown', { recovered: true })])
|
||||
const ctx = contextHolding([submission('unknown', { recovered: true })])
|
||||
expect(conversationCommandBlocked(ctx, RECORD)).toBeNull()
|
||||
})
|
||||
|
||||
it('admits the command on a legacy host that publishes the reason without the marker', () => {
|
||||
const ctx = contextWith(null, [
|
||||
submission('unknown', { reason: DISPATCH_DOUBT_HOST_RESTARTED })
|
||||
])
|
||||
const ctx = contextHolding([submission('unknown', { reason: DISPATCH_DOUBT_HOST_RESTARTED })])
|
||||
expect(conversationCommandBlocked(ctx, RECORD)).toBeNull()
|
||||
})
|
||||
|
||||
it('admits the command on a dead generation the current fence has passed', () => {
|
||||
const ctx = contextWith(null, [submission('pending', { fence: CURRENT_FENCE - 1 })])
|
||||
const ctx = contextHolding([submission('pending', { fence: CURRENT_FENCE - 1 })])
|
||||
expect(conversationCommandBlocked(ctx, RECORD)).toBeNull()
|
||||
})
|
||||
|
||||
it('still refuses while this generation owes an answer', () => {
|
||||
expect(conversationCommandBlocked(contextWith(null, [submission('pending')]), RECORD)).toBe(
|
||||
expect(conversationCommandBlocked(contextHolding([submission('pending')]), RECORD)).toBe(
|
||||
UNSETTLED_REFUSAL
|
||||
)
|
||||
expect(conversationCommandBlocked(contextWith(null, [submission('unknown')]), RECORD)).toBe(
|
||||
expect(conversationCommandBlocked(contextHolding([submission('unknown')]), RECORD)).toBe(
|
||||
UNSETTLED_REFUSAL
|
||||
)
|
||||
})
|
||||
|
||||
it('admits the command once every submission is terminally settled', () => {
|
||||
const ctx = contextWith(null, [
|
||||
const ctx = contextHolding([
|
||||
submission('accepted', { clientMessageId: 'm1' }),
|
||||
submission('rejected', { clientMessageId: 'm2' })
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user