File tree Expand file tree Collapse file tree
packages/provider-opencode/src/server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,8 +121,9 @@ it.effect(
121121 metadata : { orgID : "workspace-id" } ,
122122 } ;
123123 const fingerprints = new Map ( [
124- [ "console-key" , "3e45cfde9158185930d4cc7020a4e390895574fd54bd8f9631d23a336bbf94f0" ] ,
125- [ "oauth-access" , "44787b5311d57ff90911ebaf148f0381be1788d003774c3b43029d6fed1d528b" ] ,
124+ // Console credentials share one workspace fingerprint across token refreshes.
125+ [ "console-key" , "b57cd91082439e0caec0a8016b42c874b7c0cb734814d5fedfca398f62a3614f" ] ,
126+ [ "oauth-access" , "b57cd91082439e0caec0a8016b42c874b7c0cb734814d5fedfca398f62a3614f" ] ,
126127 [ "go-key" , "d0e590e93fc9bd9353f2b993c0c287391cae505da2a78cb698b75418d2f5367e" ] ,
127128 [ "inline-key" , "85649de18e63305548b6407e185f708483727ee6189cc4bc9512ddb17e23e776" ] ,
128129 ] ) ;
Original file line number Diff line number Diff line change @@ -183,8 +183,12 @@ export const readOpenCodeGoUsageLimits = Effect.fn("readOpenCodeGoUsageLimits")(
183183 ] ;
184184 const crypto = yield * Crypto . Crypto ;
185185 // Unkeyed hashes match across environments; random Go keys resist offline guessing.
186+ // Console tokens rotate on refresh, so their usage is keyed by workspace instead.
187+ const fingerprintSource = credential . workspaceID
188+ ? `opencode-console\0${ credential . workspaceID } `
189+ : `opencode-go\0${ credential . token } ` ;
186190 const credentialFingerprint = yield * crypto
187- . digest ( "SHA-256" , new TextEncoder ( ) . encode ( `opencode-go\0 ${ credential . token } ` ) )
191+ . digest ( "SHA-256" , new TextEncoder ( ) . encode ( fingerprintSource ) )
188192 . pipe ( Effect . map ( Hex . encode ) , Effect . orDie ) ;
189193 return {
190194 ...makeUsageLimits ( { checkedAt, windows } ) ,
You can’t perform that action at this time.
0 commit comments