Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ Current built-in keys:
| Key | Default | Description |
|-----|---------|-------------|
| `codex_model` | `gpt-5.5` | Shared default model for Codex-backed review and analysis |
| `codex_effort` | `high` | Shared default reasoning effort (`xhigh`, `high`, `medium`, `low`) |
| `codex_effort` | `high` | Shared default reasoning effort (`max`, `xhigh`, `high`, `medium`, `low`) |
| `bitlesson_model` | `haiku` | Model used by the BitLesson selector agent |
| `provider_mode` | unset | Optional runtime mode hint such as `codex-only` |
| `agent_teams` | `false` | Project-level default for agent teams workflow |
Expand All @@ -343,7 +343,7 @@ All Codex-using features (RLCR loop, ask-codex) share the same model configurati
| Key | Default | Description |
|-----|---------|-------------|
| `codex_model` | `gpt-5.5` | Model used for Codex operations (reviews, analysis, queries) |
| `codex_effort` | `high` | Reasoning effort (`xhigh`, `high`, `medium`, `low`) |
| `codex_effort` | `high` | Reasoning effort (`max`, `xhigh`, `high`, `medium`, `low`) |

To override, add to `.humanize/config.json`:

Expand Down
4 changes: 2 additions & 2 deletions hooks/lib/loop-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ elif [[ -n "$_cfg_codex_model" && ! "$_cfg_codex_model" =~ ^(gpt-|o[0-9]) ]]; th
fi
DEFAULT_CODEX_MODEL="${DEFAULT_CODEX_MODEL:-${_cfg_codex_model:-gpt-5.5}}"
_cfg_codex_effort="$(get_config_value "$_LOOP_COMMON_CONFIG" "codex_effort" 2>/dev/null || true)"
if [[ -n "$_cfg_codex_effort" && ! "$_cfg_codex_effort" =~ ^(xhigh|high|medium|low)$ ]]; then
if [[ -n "$_cfg_codex_effort" && ! "$_cfg_codex_effort" =~ ^(max|xhigh|high|medium|low)$ ]]; then
echo "Warning: Invalid codex_effort in merged config: $_cfg_codex_effort" >&2
echo " Must be one of: xhigh, high, medium, low" >&2
echo " Must be one of: max, xhigh, high, medium, low" >&2
echo " Ignoring configured codex_effort; using caller preset or fallback" >&2
_cfg_codex_effort=""
fi
Expand Down
4 changes: 2 additions & 2 deletions hooks/loop-codex-stop-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ if [[ ! "$CODEX_EXEC_MODEL" =~ ^[a-zA-Z0-9._-]+$ ]]; then
end_loop "$LOOP_DIR" "$STATE_FILE" "$EXIT_UNEXPECTED"
exit 0
fi
if [[ ! "$CODEX_EXEC_EFFORT" =~ ^(xhigh|high|medium|low)$ ]]; then
if [[ ! "$CODEX_EXEC_EFFORT" =~ ^(max|xhigh|high|medium|low)$ ]]; then
echo "Error: Invalid codex effort in state file: $CODEX_EXEC_EFFORT" >&2
echo " Must be one of: xhigh, high, medium, low" >&2
echo " Must be one of: max, xhigh, high, medium, low" >&2
end_loop "$LOOP_DIR" "$STATE_FILE" "$EXIT_UNEXPECTED"
exit 0
fi
Expand Down
8 changes: 4 additions & 4 deletions scripts/lib/model-router.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ map_effort() {
esac

case "$effort" in
xhigh|high|medium|low)
max|xhigh|high|medium|low)
;;
*)
echo "Error: Unknown effort '$effort'. Expected one of: xhigh, high, medium, low." >&2
echo "Error: Unknown effort '$effort'. Expected one of: max, xhigh, high, medium, low." >&2
return 1
;;
esac

if [[ "$target_provider" == "claude" ]] && [[ "$effort" == "xhigh" ]]; then
echo "Info: Mapping effort 'xhigh' to 'high' for provider 'claude'." >&2
if [[ "$target_provider" == "claude" ]] && [[ "$effort" =~ ^(xhigh|max)$ ]]; then
echo "Info: Mapping effort '$effort' to 'high' for provider 'claude'." >&2
echo "high"
return 0
fi
Expand Down
4 changes: 2 additions & 2 deletions scripts/setup-rlcr-loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,9 @@ if [[ ! "$CODEX_MODEL" =~ ^[a-zA-Z0-9._-]+$ ]]; then
fi

# Validate codex effort matches allowed values (consistent with stop-hook validation)
if [[ ! "$CODEX_EFFORT" =~ ^(xhigh|high|medium|low)$ ]]; then
if [[ ! "$CODEX_EFFORT" =~ ^(max|xhigh|high|medium|low)$ ]]; then
echo "Error: Invalid codex effort: $CODEX_EFFORT" >&2
echo " Must be one of: xhigh, high, medium, low" >&2
echo " Must be one of: max, xhigh, high, medium, low" >&2
exit 1
fi

Expand Down
35 changes: 35 additions & 0 deletions tests/test-model-router.sh
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,41 @@ else
fail "map_effort: unknown codex effort exits non-zero with error" "non-zero exit + error message" "exit=$exit_code, stderr=$stderr_out"
fi

# ========================================
# Test 21: max passes through for codex
# ========================================
echo ""
echo "--- Test 21: max passes through for codex ---"
echo ""

result=""
exit_code=0
result=$(map_effort "max" "codex" 2>/dev/null) || exit_code=$?

if [[ $exit_code -eq 0 ]] && [[ "$result" == "max" ]]; then
pass "map_effort: max passes through for codex"
else
fail "map_effort: max passes through for codex" "exit 0 + max" "exit=$exit_code, output=$result"
fi

# ========================================
# Test 22: max maps to high for claude
# ========================================
echo ""
echo "--- Test 22: max maps to high for claude ---"
echo ""

exit_code=0
stderr_out=""
result=$(map_effort "max" "claude" 2> "$TEST_DIR/map-effort-max-stderr.txt") || exit_code=$?
stderr_out="$(cat "$TEST_DIR/map-effort-max-stderr.txt")"

if [[ $exit_code -eq 0 ]] && [[ "$result" == "high" ]] && echo "$stderr_out" | grep -qiE "mapping effort|max|high"; then
pass "map_effort: max maps to high for claude with info log"
else
fail "map_effort: max maps to high for claude with info log" "exit 0 + high + info log" "exit=$exit_code, output=$result, stderr=$stderr_out"
fi

# ========================================
# Summary
# ========================================
Expand Down
4 changes: 2 additions & 2 deletions tests/test-unified-codex-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -657,15 +657,15 @@ fi

# Test invalid effort value
invalid_effort="superhigh"
if [[ ! "$invalid_effort" =~ ^(xhigh|high|medium|low)$ ]]; then
if [[ ! "$invalid_effort" =~ ^(max|xhigh|high|medium|low)$ ]]; then
pass "validation: invalid effort value is rejected by regex"
else
fail "validation: invalid effort value is rejected by regex"
fi

# Test valid effort values
for effort in xhigh high medium low; do
if [[ "$effort" =~ ^(xhigh|high|medium|low)$ ]]; then
if [[ "$effort" =~ ^(max|xhigh|high|medium|low)$ ]]; then
pass "validation: effort '$effort' is accepted"
else
fail "validation: effort '$effort' is accepted"
Expand Down
Loading