@@ -403,7 +403,7 @@ await DispatchQueuedLifecycleCommandAsync(
403403
404404 try
405405 {
406- await AwaitPendingModelPatchAsync ( threadId , cancellationToken ) ;
406+ await AwaitPendingSessionOptionPatchAsync ( threadId , cancellationToken ) ;
407407 var preparation = _state . PrepareSendAttempt (
408408 dispatch ,
409409 ProjectionContext ( ) ) ;
@@ -761,20 +761,20 @@ public async Task SetModelAsync(string threadId, string model, CancellationToken
761761 // string; a blank value here is a no-op rather than a clear. Use
762762 // ClearModelAsync to revert a session to the gateway default.
763763 if ( string . IsNullOrWhiteSpace ( model ) ) return ;
764- await TrackModelPatchAsync ( threadId , ( ) => _bridge . PatchSessionModelAsync ( threadId , model ) ) ;
764+ await TrackSessionOptionPatchAsync ( threadId , ( ) => _bridge . PatchSessionModelAsync ( threadId , model ) ) ;
765765 }
766766
767767 public async Task ClearModelAsync ( string threadId , CancellationToken cancellationToken = default )
768768 {
769769 cancellationToken . ThrowIfCancellationRequested ( ) ;
770770 // Tri-state clear: removes the session's model override (explicit null)
771771 // so it tracks the gateway/agent default again.
772- await TrackModelPatchAsync ( threadId , ( ) => _bridge . ClearSessionModelAsync ( threadId ) ) ;
772+ await TrackSessionOptionPatchAsync ( threadId , ( ) => _bridge . ClearSessionModelAsync ( threadId ) ) ;
773773 }
774774
775- private async Task TrackModelPatchAsync ( string threadId , Func < Task > patchOperation )
775+ private async Task TrackSessionOptionPatchAsync ( string threadId , Func < Task > patchOperation )
776776 {
777- var lease = _state . BeginModelPatch ( threadId ) ;
777+ var lease = _state . BeginSessionOptionPatch ( threadId ) ;
778778 Exception ? failure = null ;
779779 try
780780 {
@@ -783,7 +783,7 @@ private async Task TrackModelPatchAsync(string threadId, Func<Task> patchOperati
783783 try { await lease . Previous ; }
784784 catch ( Exception ex )
785785 {
786- Logger . Debug ( $ "ChatDataProvider: continuing model patch after previous patch failed: { ex . Message } ") ;
786+ Logger . Debug ( $ "ChatDataProvider: continuing session option patch after previous patch failed: { ex . Message } ") ;
787787 }
788788 }
789789 await patchOperation ( ) ;
@@ -795,28 +795,38 @@ private async Task TrackModelPatchAsync(string threadId, Func<Task> patchOperati
795795 }
796796 finally
797797 {
798- _state . CompleteModelPatch ( lease , failure ) ;
798+ _state . CompleteSessionOptionPatch ( lease , failure ) ;
799799 }
800800 }
801801
802- private async Task AwaitPendingModelPatchAsync ( string threadId , CancellationToken cancellationToken )
802+ private async Task AwaitPendingSessionOptionPatchAsync ( string threadId , CancellationToken cancellationToken )
803803 {
804- var pending = _state . GetPendingModelPatch ( threadId ) ;
804+ var pending = _state . GetPendingSessionOptionPatch ( threadId ) ;
805805 if ( pending is not null )
806806 {
807807 try { await pending . WaitAsync ( cancellationToken ) ; }
808808 catch ( OperationCanceledException ) { throw ; }
809809 catch ( Exception ex )
810810 {
811- Logger . Debug ( $ "ChatDataProvider: continuing send after model patch failed: { ex . Message } ") ;
811+ Logger . Debug ( $ "ChatDataProvider: continuing send after session option patch failed: { ex . Message } ") ;
812812 }
813813 }
814814 }
815815
816816 public async Task SetThinkingLevelAsync ( string threadId , string thinkingLevel , CancellationToken cancellationToken = default )
817817 {
818818 cancellationToken . ThrowIfCancellationRequested ( ) ;
819- await _bridge . PatchSessionThinkingLevelAsync ( threadId , thinkingLevel ) ;
819+ await TrackSessionOptionPatchAsync (
820+ threadId ,
821+ ( ) => _bridge . PatchSessionThinkingLevelAsync ( threadId , thinkingLevel ) ) ;
822+ }
823+
824+ public async Task ClearThinkingLevelAsync ( string threadId , CancellationToken cancellationToken = default )
825+ {
826+ cancellationToken . ThrowIfCancellationRequested ( ) ;
827+ await TrackSessionOptionPatchAsync (
828+ threadId ,
829+ ( ) => _bridge . ClearSessionThinkingLevelAsync ( threadId ) ) ;
820830 }
821831
822832 public async Task EnsureCommandCatalogAsync ( CancellationToken cancellationToken = default )
0 commit comments