mirror of
https://github.com/stablyai/orca.git
synced 2026-10-01 08:01:56 +00:00
Keep the model report current across an acquisition fence bump
This commit is contained in:
@@ -24,6 +24,7 @@ function sessionFor(send = vi.fn().mockResolvedValue(undefined)): ClaudeSession
|
||||
options: new Map(),
|
||||
reportedOptions: {},
|
||||
reportedModelMutation: 0,
|
||||
confirmedOptions: new Set(),
|
||||
restoreSkippedOptions: new Set(),
|
||||
capabilities: [],
|
||||
events: undefined,
|
||||
|
||||
@@ -70,6 +70,7 @@ describe('Claude effort readback', () => {
|
||||
session: {
|
||||
options: new Map<string, string>(),
|
||||
optionMutationSequence: 0,
|
||||
confirmedOptions: new Set<string>(),
|
||||
connection: {
|
||||
applyFlagSettings: async (settings: { effortLevel?: string }) => {
|
||||
// The measured behaviour: an unknown effort is accepted and ignored.
|
||||
|
||||
@@ -97,6 +97,7 @@ describe('Claude effort the settings readback cannot report', () => {
|
||||
session: {
|
||||
options: new Map<string, string>(),
|
||||
optionMutationSequence: 0,
|
||||
confirmedOptions: new Set<string>(),
|
||||
connection: {
|
||||
applyFlagSettings: async (settings: { effortLevel?: string }) => {
|
||||
calls.push(`apply:${settings.effortLevel}`)
|
||||
|
||||
@@ -19,6 +19,7 @@ function sessionFor(setModel: ClaudeSession['connection']['setModel']): ClaudeSe
|
||||
options: new Map(),
|
||||
reportedOptions: {},
|
||||
reportedModelMutation: 0,
|
||||
confirmedOptions: new Set(),
|
||||
restoreSkippedOptions: new Set(),
|
||||
capabilities: [],
|
||||
events: undefined,
|
||||
|
||||
@@ -96,6 +96,10 @@ export async function restoreClaudeStructuredSessionOptions(
|
||||
// Any write that was already in flight belongs to the previous acquisition
|
||||
// state and must not repopulate this map after restore starts.
|
||||
session.optionMutationSequence += 1
|
||||
// The fence bump is not a write, so the report the session already holds is still
|
||||
// current as of this instant; leaving the stamp behind would make every restored
|
||||
// session read as unconfirmed until its next turn.
|
||||
session.reportedModelMutation = session.optionMutationSequence
|
||||
const options = [...session.options.entries()]
|
||||
session.options.clear()
|
||||
for (const [key, value] of options) {
|
||||
|
||||
@@ -573,7 +573,7 @@ describe('ClaudeStructuredSessionAdapter turns and controls', () => {
|
||||
},
|
||||
{ id: 'sonnet', label: 'Sonnet', isDefault: false, efforts: [] }
|
||||
],
|
||||
current: { model: 'sonnet', effort: 'high' }
|
||||
current: { model: 'sonnet', effort: 'high', confirmed: ['model', 'effort'] }
|
||||
})
|
||||
})
|
||||
|
||||
@@ -596,7 +596,11 @@ describe('ClaudeStructuredSessionAdapter turns and controls', () => {
|
||||
'haiku',
|
||||
'custom-model'
|
||||
])
|
||||
expect(result.current).toEqual({ model: 'custom-model', effort: 'high' })
|
||||
expect(result.current).toEqual({
|
||||
model: 'custom-model',
|
||||
effort: 'high',
|
||||
confirmed: ['model', 'effort']
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user