Description
There is a state leakage in the localharness Go binary when performing a CORTEX_STEP_TYPE_CODE_ACTION.
When the primary agent uses a model that supports reasoning (e.g., Gemini 3.5) and the GeminiAPIEndpoint is initialized with a specific thinking_level, the internal Go harness improperly propagates this configuration to the secondary/utility models used during the fast apply fallback. Since models like Gemini 2.5 Flash / 1.5 Flash do not support the thinking_level parameter (or use thinkingBudget instead), the Google API rejects the fallback request with an INVALID_ARGUMENT HTTP 400 error, causing the entire code editing step to fail ungracefully.
Steps to Reproduce
Initialize the SDK pipeline setting a primary model that supports thinking (e.g., Gemini 3.5) and configure GeminiModelOptions(thinking_level="high").
Allow the agent to attempt a file modification using BuiltinTools.EDIT_FILE (replace_file_content).
Ensure the targetContent generated by the LLM has a slight mismatch (e.g., whitespace or indentation) with the local file so the exact match fails.
The Go harness (log.go) catches the mismatch and automatically triggers the fast apply fallback.
The fallback invokes a secondary model, injecting the primary model's thinking_level into the payload.
The request is rejected by the API.
Error Logs
Plaintext
2026-08-31 09:19:48 INFO harness stderr: received model response error: Error 400, Message: Thinking level is not supported for this model., Status: INVALID_ARGUMENT, Details: []
2026-08-31 09:19:48 INFO harness stderr: request failed (code 400): Thinking level is not supported for this model.
2026-08-31 09:19:48 INFO harness stderr: E0831 09:19:48.123371 190914 log.go:398] error in fast apply fallback: stream error: Error 400, Message: Thinking level is not supported for this model., Status: INVALID_ARGUMENT, Details: []
2026-08-31 09:19:48 INFO harness stderr: E0831 09:19:48.130874 190914 log.go:398] error executing cascade step: CORTEX_STEP_TYPE_CODE_ACTION: fallback failed: stream error: Error 400, Message: Thinking level is not supported for this model.
Expected Behavior
The Go harness should isolate the endpoint options. When invoking utility/secondary models for fallbacks, it must strip the thinking_level parameter from the payload, or dynamically map it to thinkingBudget if the secondary model belongs to the Gemini 2.5 family.
Actual Behavior
The configuration is globally inherited, destroying the fallback mechanism for any advanced model and forcing developers to disable BuiltinTools.EDIT_FILE to build custom patchers and avoid the crash.
Description
There is a state leakage in the localharness Go binary when performing a CORTEX_STEP_TYPE_CODE_ACTION.
When the primary agent uses a model that supports reasoning (e.g., Gemini 3.5) and the GeminiAPIEndpoint is initialized with a specific thinking_level, the internal Go harness improperly propagates this configuration to the secondary/utility models used during the fast apply fallback. Since models like Gemini 2.5 Flash / 1.5 Flash do not support the thinking_level parameter (or use thinkingBudget instead), the Google API rejects the fallback request with an INVALID_ARGUMENT HTTP 400 error, causing the entire code editing step to fail ungracefully.
Steps to Reproduce
Initialize the SDK pipeline setting a primary model that supports thinking (e.g., Gemini 3.5) and configure GeminiModelOptions(thinking_level="high").
Allow the agent to attempt a file modification using BuiltinTools.EDIT_FILE (replace_file_content).
Ensure the targetContent generated by the LLM has a slight mismatch (e.g., whitespace or indentation) with the local file so the exact match fails.
The Go harness (log.go) catches the mismatch and automatically triggers the fast apply fallback.
The fallback invokes a secondary model, injecting the primary model's thinking_level into the payload.
The request is rejected by the API.
Error Logs
Plaintext
2026-08-31 09:19:48 INFO harness stderr: received model response error: Error 400, Message: Thinking level is not supported for this model., Status: INVALID_ARGUMENT, Details: []
2026-08-31 09:19:48 INFO harness stderr: request failed (code 400): Thinking level is not supported for this model.
2026-08-31 09:19:48 INFO harness stderr: E0831 09:19:48.123371 190914 log.go:398] error in fast apply fallback: stream error: Error 400, Message: Thinking level is not supported for this model., Status: INVALID_ARGUMENT, Details: []
2026-08-31 09:19:48 INFO harness stderr: E0831 09:19:48.130874 190914 log.go:398] error executing cascade step: CORTEX_STEP_TYPE_CODE_ACTION: fallback failed: stream error: Error 400, Message: Thinking level is not supported for this model.
Expected Behavior
The Go harness should isolate the endpoint options. When invoking utility/secondary models for fallbacks, it must strip the thinking_level parameter from the payload, or dynamically map it to thinkingBudget if the secondary model belongs to the Gemini 2.5 family.
Actual Behavior
The configuration is globally inherited, destroying the fallback mechanism for any advanced model and forcing developers to disable BuiltinTools.EDIT_FILE to build custom patchers and avoid the crash.