@@ -111,3 +111,49 @@ func TestHandleAnthropicRequest_PreservesLegacyThinkingForOldModels(t *testing.T
111111 require .True (t , hasOutputConfig )
112112 assert .Equal (t , "low" , outputConfig ["effort" ])
113113}
114+
115+ func TestHandleAnthropicRequest_ContextManagementUsesResolvedModel (t * testing.T ) {
116+ m := meta .NewMeta (nil , mode .Anthropic , "claude-sonnet-4-6" , coremodel.ModelConfig {})
117+ m .ActualModel = "claude-opus-4-7"
118+
119+ reqBody := map [string ]any {
120+ "model" : "claude-sonnet-4-6" ,
121+ "max_tokens" : 4096 ,
122+ "messages" : []map [string ]any {
123+ {"role" : "user" , "content" : "hello" },
124+ },
125+ "context_management" : map [string ]any {
126+ "edits" : []map [string ]any {
127+ {"type" : "clear_tool_uses_20250919" },
128+ {"type" : "unsupported" },
129+ },
130+ },
131+ }
132+
133+ data , err := sonic .Marshal (reqBody )
134+ require .NoError (t , err )
135+
136+ req , err := http .NewRequestWithContext (
137+ t .Context (),
138+ http .MethodPost ,
139+ "http://localhost/v1/messages" ,
140+ bytes .NewBuffer (data ),
141+ )
142+ require .NoError (t , err )
143+
144+ adaptor := & awsa.Adaptor {}
145+ _ , err = adaptor .ConvertRequest (m , nil , req )
146+ require .NoError (t , err )
147+
148+ converted , ok := m .Get (awsa .ConvertedRequest )
149+ require .True (t , ok )
150+
151+ body , ok := converted .([]byte )
152+ require .True (t , ok )
153+
154+ var awsReq map [string ]any
155+ require .NoError (t , sonic .Unmarshal (body , & awsReq ))
156+
157+ _ , ok = awsReq ["context_management" ]
158+ assert .False (t , ok )
159+ }
0 commit comments