Skip to content
Merged
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 crates/forge_main/src/built_in_commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"description": "Switch the model for the current session only, without modifying global config [alias: m]"
},
{
"command": "model-reset",
"description": "Reset session model to use global config [alias: mr]"
"command": "config-reload",
"description": "Reset all session overrides (model, provider, reasoning effort) to use global config [alias: cr]"
},
{
"command": "reasoning-effort",
Expand Down
16 changes: 9 additions & 7 deletions shell-plugin/lib/actions/config.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -358,21 +358,23 @@ function _forge_action_session_model() {
fi
}

# Action handler: Reset session model and provider to defaults.
# Clears both _FORGE_SESSION_MODEL and _FORGE_SESSION_PROVIDER,
# reverting to global config for subsequent forge invocations.
function _forge_action_model_reset() {
# Action handler: Reload config by resetting all session-scoped overrides.
# Clears _FORGE_SESSION_MODEL, _FORGE_SESSION_PROVIDER, and
# _FORGE_SESSION_REASONING_EFFORT so that every subsequent forge invocation
# falls back to the permanent global configuration.
function _forge_action_config_reload() {
echo

if [[ -z "$_FORGE_SESSION_MODEL" && -z "$_FORGE_SESSION_PROVIDER" ]]; then
_forge_log info "Session model already cleared (using global config)"
if [[ -z "$_FORGE_SESSION_MODEL" && -z "$_FORGE_SESSION_PROVIDER" && -z "$_FORGE_SESSION_REASONING_EFFORT" ]]; then
_forge_log info "No session overrides active (already using global config)"
return 0
fi

_FORGE_SESSION_MODEL=""
_FORGE_SESSION_PROVIDER=""
_FORGE_SESSION_REASONING_EFFORT=""

_forge_log success "Session model reset to global config"
_forge_log success "Session overrides cleared — using global config"
}

# Action handler: Select reasoning effort for the current session only.
Expand Down
4 changes: 4 additions & 0 deletions shell-plugin/lib/config.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ typeset -h _FORGE_PREVIOUS_CONVERSATION_ID
# invocation for the lifetime of the current shell session.
typeset -h _FORGE_SESSION_MODEL
typeset -h _FORGE_SESSION_PROVIDER

# Session-scoped reasoning effort override (set via :reasoning-effort / :re).
# When non-empty, exported as FORGE_REASONING__EFFORT for every forge invocation.
typeset -h _FORGE_SESSION_REASONING_EFFORT
4 changes: 2 additions & 2 deletions shell-plugin/lib/dispatcher.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ function forge-accept-line() {
model|m)
_forge_action_session_model "$input_text"
;;
model-reset|mr)
_forge_action_model_reset
config-reload|cr|model-reset|mr)
_forge_action_config_reload
;;
reasoning-effort|re)
_forge_action_reasoning_effort "$input_text"
Expand Down
Loading