Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1e409fa

Browse files
tusharmathautofix-ci[bot]forge-code-agent
authored
feat(reasoning): add reasoning-effort config settings (#2775)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: ForgeCode <[email protected]>
1 parent d9c5f24 commit 1e409fa

31 files changed

Lines changed: 1128 additions & 126 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
name: test-reasoning
3+
description: Validate that reasoning parameters are correctly serialized and sent to provider APIs. Use when the user asks to test reasoning serialization, run reasoning tests, verify reasoning config fields, or check that ReasoningConfig maps correctly to provider-specific JSON (OpenRouter, Anthropic, GitHub Copilot, Codex).
4+
---
5+
6+
# Test Reasoning Serialization
7+
8+
Validates that `ReasoningConfig` fields are correctly serialized into provider-specific JSON
9+
for OpenRouter, Anthropic, GitHub Copilot, and Codex.
10+
11+
## Quick Start
12+
13+
Run all tests with the bundled script:
14+
15+
```bash
16+
./scripts/test-reasoning.sh
17+
```
18+
19+
The script builds forge in debug mode, runs each provider/model combination, captures the
20+
outgoing HTTP request body via `FORGE_DEBUG_REQUESTS`, and asserts the correct JSON fields.
21+
22+
## Running a Single Test Manually
23+
24+
```bash
25+
FORGE_DEBUG_REQUESTS="forge.request.json" \
26+
FORGE_SESSION__PROVIDER_ID=<provider_id> \
27+
FORGE_SESSION__MODEL_ID=<model_id> \
28+
FORGE_REASONING__EFFORT=<effort> \
29+
target/debug/forge -p "Hello!"
30+
```
31+
32+
Then inspect `.forge/forge.request.json` for the expected fields.
33+
34+
## Test Coverage
35+
36+
| Provider | Model | Config fields | Expected JSON field |
37+
| ---------------- | ---------------------------- | ------------------------------------------------- | --------------------------------- |
38+
| `open_router` | `openai/o4-mini` | `effort: none\|minimal\|low\|medium\|high\|xhigh` | `reasoning.effort` |
39+
| `open_router` | `openai/o4-mini` | `max_tokens: 4000` | `reasoning.max_tokens` |
40+
| `open_router` | `openai/o4-mini` | `effort: high` + `exclude: true` | `reasoning.effort` + `.exclude` |
41+
| `open_router` | `openai/o4-mini` | `enabled: true` | `reasoning.enabled` |
42+
| `open_router` | `anthropic/claude-opus-4-5` | `max_tokens: 4000` | `reasoning.max_tokens` |
43+
| `open_router` | `moonshotai/kimi-k2` | `max_tokens: 4000` | `reasoning.max_tokens` |
44+
| `open_router` | `moonshotai/kimi-k2` | `effort: high` | `reasoning.effort` |
45+
| `open_router` | `minimax/minimax-m2` | `max_tokens: 4000` | `reasoning.max_tokens` |
46+
| `open_router` | `minimax/minimax-m2` | `effort: high` | `reasoning.effort` |
47+
| `anthropic` | `claude-opus-4-6` | `effort: low\|medium\|high\|max` | `output_config.effort` |
48+
| `anthropic` | `claude-3-7-sonnet-20250219` | `enabled: true` + `max_tokens: 8000` | `thinking.type` + `budget_tokens` |
49+
| `github_copilot` | `o4-mini` | `effort: none\|minimal\|low\|medium\|high\|xhigh` | `reasoning_effort` (top-level) |
50+
| `codex` | `gpt-5.1-codex` | `effort: none\|minimal\|low\|medium\|high\|xhigh` | `reasoning.effort` + `.summary` |
51+
| `codex` | `gpt-5.1-codex` | `effort: medium` + `exclude: true` | `reasoning.summary = "concise"` |
52+
| all providers | one model each | `effort: invalid` | non-zero exit, no request written |
53+
54+
Tests for unconfigured providers are skipped automatically. Invalid-effort tests run regardless of credentials — the rejection happens at config parse time before any provider interaction.
55+
56+
## References
57+
58+
- [OpenAI Reasoning guide](https://developers.openai.com/api/docs/guides/reasoning)
59+
- [OpenAI Chat Completions API reference](https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create)
60+
- [Anthropic Extended Thinking](https://platform.claude.com/docs/en/build-with-claude/effort)
61+
- [OpenRouter Reasoning Tokens](https://openrouter.ai/docs/guides/best-practices/reasoning-tokens)

0 commit comments

Comments
 (0)