@@ -323,23 +323,23 @@ describe('requestSession', () => {
323323 expect ( s3 . status ) . toBe ( 'active' )
324324 } )
325325
326- // Per-user rate limit (5 GLM admissions per 20h ) — the wire limit is
326+ // Per-user rate limit (5 GLM admissions per 12h ) — the wire limit is
327327 // hard-coded in public-api.ts, so tests seed the fake admit log directly
328328 // rather than configuring it. GLM also has deployment-hours gating, so
329329 // these tests bump `now` into the open window (12pm ET on a weekday)
330330 // before issuing the request.
331331 const GLM_MODEL = 'z-ai/glm-5.1'
332332 const GLM_LIMIT = 5
333- const GLM_WINDOW_HOURS = 20
333+ const GLM_WINDOW_HOURS = 12
334334 const GLM_OPEN_TIME = new Date ( '2026-04-17T16:00:00Z' )
335335
336336 test ( 'rate_limited: 5th GLM admit in window blocks the 6th attempt' , async ( ) => {
337337 deps . _tick ( GLM_OPEN_TIME )
338- // Seed 5 admits inside the 20h window, spaced so we can verify retryAfter
338+ // Seed 5 admits inside the 12h window, spaced so we can verify retryAfter
339339 // points at the oldest one sliding off.
340340 const now = deps . _now ( )
341- // Oldest: 19h ago (still in window). Next 4: 1h, 2h, 3h, 4h ago.
342- const ages = [ 19 , 4 , 3 , 2 , 1 ]
341+ // Oldest: 11h ago (still in window). Next 4: 1h, 2h, 3h, 4h ago.
342+ const ages = [ 11 , 4 , 3 , 2 , 1 ]
343343 for ( const hoursAgo of ages ) {
344344 deps . admits . push ( {
345345 user_id : 'u1' ,
@@ -359,15 +359,15 @@ describe('requestSession', () => {
359359 expect ( state . limit ) . toBe ( GLM_LIMIT )
360360 expect ( state . windowHours ) . toBe ( GLM_WINDOW_HOURS )
361361 expect ( state . recentCount ) . toBe ( GLM_LIMIT )
362- // Oldest admit is 19h ago; slot opens when it hits 20h , i.e. in 1h.
362+ // Oldest admit is 11h ago; slot opens when it hits 12h , i.e. in 1h.
363363 expect ( state . retryAfterMs ) . toBe ( 60 * 60 * 1000 )
364364 // Blocked before any row is written — the user doesn't take a queue slot.
365365 expect ( deps . rows . has ( 'u1' ) ) . toBe ( false )
366366 } )
367367
368- test ( 'rate_limited: admits outside the 20h window do not count' , async ( ) => {
368+ test ( 'rate_limited: admits outside the 12h window do not count' , async ( ) => {
369369 deps . _tick ( GLM_OPEN_TIME )
370- // 5 admits, each just over 20h old → all fall off the window.
370+ // 5 admits, each just over 12h old → all fall off the window.
371371 const now = deps . _now ( )
372372 for ( let i = 0 ; i < 5 ; i ++ ) {
373373 deps . admits . push ( {
@@ -446,7 +446,7 @@ describe('requestSession', () => {
446446 const now = deps . _now ( )
447447 // Seed 5 prior admits (the cap), with the latest one matching the
448448 // active row we're about to install.
449- const ages = [ 19 , 4 , 3 , 2 , 0 ]
449+ const ages = [ 11 , 4 , 3 , 2 , 0 ]
450450 for ( const hoursAgo of ages ) {
451451 deps . admits . push ( {
452452 user_id : 'u1' ,
@@ -527,7 +527,7 @@ describe('requestSession', () => {
527527 // must be blocked by the quota.
528528 deps . _tick ( GLM_OPEN_TIME )
529529 const now = deps . _now ( )
530- const ages = [ 19 , 4 , 3 , 2 , 1 ]
530+ const ages = [ 11 , 4 , 3 , 2 , 1 ]
531531 for ( const hoursAgo of ages ) {
532532 deps . admits . push ( {
533533 user_id : 'u1' ,
@@ -660,7 +660,7 @@ describe('getSessionState', () => {
660660 expect ( state . rateLimit ) . toEqual ( {
661661 model : 'z-ai/glm-5.1' ,
662662 limit : 5 ,
663- windowHours : 20 ,
663+ windowHours : 12 ,
664664 recentCount : 1 ,
665665 } )
666666 } )
0 commit comments