@@ -159,6 +159,7 @@ function fixture(options?: {
159159 readonly omitRefine ?: boolean ;
160160 readonly abortCompactionImpl ?: ( ) => Promise < unknown > ;
161161 readonly setAutoCompactionImpl ?: ( enabled : boolean ) => Promise < unknown > ;
162+ readonly setModelImpl ?: ( provider : string , modelId : string ) => Promise < unknown > ;
162163} ) {
163164 const captures : Captures = {
164165 order : [ ] ,
@@ -412,6 +413,7 @@ function fixture(options?: {
412413 }
413414 setModel ( provider : string , modelId : string ) : Promise < unknown > {
414415 captures . connectionCalls . push ( { method : "setModel" , args : [ provider , modelId ] } ) ;
416+ if ( options ?. setModelImpl ) return options . setModelImpl ( provider , modelId ) ;
415417 return Promise . resolve ( {
416418 provider,
417419 id : modelId ,
@@ -1695,6 +1697,25 @@ describe("PrimeAgentDaemonSessionRuntime", () => {
16951697 ) ,
16961698 ) ;
16971699
1700+ it . effect ( "reports a rejected model selection without leaking Prime's native error" , ( ) =>
1701+ Effect . scoped (
1702+ Effect . gen ( function * ( ) {
1703+ // A Prime release can drop a model id the thread still selects durably.
1704+ const { make } = fixture ( {
1705+ setModelImpl : ( ) =>
1706+ Promise . reject ( new Error ( "unknown model cerebras/zai-glm-4.7 at /native/secret/path" ) ) ,
1707+ } ) ;
1708+ const runtime = yield * make ( ) ;
1709+
1710+ const error = yield * runtime . setModel ( "cerebras/zai-glm-4.7" ) . pipe ( Effect . flip ) ;
1711+
1712+ expect ( error ) . toMatchObject ( { operation : "set-model" , reason : "request-failed" } ) ;
1713+ expect ( error . detail ) . toContain ( "no longer exist in Prime Agent's catalog" ) ;
1714+ expect ( error . detail ) . not . toContain ( "/native/secret/path" ) ;
1715+ } ) ,
1716+ ) ,
1717+ ) ;
1718+
16981719 it . effect ( "discovers only configured catalog models and strips native fields" , ( ) =>
16991720 Effect . scoped (
17001721 Effect . gen ( function * ( ) {
0 commit comments