Skip to content

Commit 6fa8ed8

Browse files
committed
Fix runtime model detection using script path instead of CLAUDE_PLUGIN_ROOT
CLAUDE_PLUGIN_ROOT is a config-time template variable that Claude Code substitutes when loading plugin configs, not a runtime environment variable. The previous check always evaluated to false, causing gpt-5.2 to be selected even in plugin mode. Use BASH_SOURCE path to detect if the script runs from .claude/plugins/cache/ instead.
1 parent 553c03c commit 6fa8ed8

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

hooks/lib/loop-common.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,19 @@ readonly FIELD_AGENT_TEAMS="agent_teams"
4343
# Both use :- so scripts can override before sourcing (e.g. PR loop sets different model/effort).
4444
#
4545
# Runtime-aware model selection:
46-
# - Claude Code plugin flow (CLAUDE_PLUGIN_ROOT set) -> gpt-5.3-codex
47-
# - Skill mode (Codex/Kimi, no CLAUDE_PLUGIN_ROOT) -> gpt-5.2
46+
# Detect Claude Code plugin mode by checking if this script lives under
47+
# .claude/plugins/cache/ (CLAUDE_PLUGIN_ROOT is a config-time template
48+
# variable, not a runtime env var, so we cannot check it directly).
49+
# - Claude Code plugin mode -> gpt-5.3-codex
50+
# - Skill mode (Codex/Kimi) -> gpt-5.2
4851
if [[ -z "${DEFAULT_CODEX_MODEL:-}" ]]; then
49-
if [[ -n "${CLAUDE_PLUGIN_ROOT:-}" ]]; then
52+
_LOOP_COMMON_SELF="${BASH_SOURCE[0]:-$0}"
53+
if [[ "$_LOOP_COMMON_SELF" == */.claude/plugins/cache/* ]]; then
5054
DEFAULT_CODEX_MODEL="gpt-5.3-codex"
5155
else
5256
DEFAULT_CODEX_MODEL="gpt-5.2"
5357
fi
58+
unset _LOOP_COMMON_SELF
5459
fi
5560
DEFAULT_CODEX_EFFORT="${DEFAULT_CODEX_EFFORT:-xhigh}"
5661

0 commit comments

Comments
 (0)