Skip to content

Commit d6d7c04

Browse files
authored
feat(config): add config-reload to clear all session overrides (#2819)
1 parent 8c0af00 commit d6d7c04

4 files changed

Lines changed: 17 additions & 11 deletions

File tree

crates/forge_main/src/built_in_commands.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"description": "Switch the model for the current session only, without modifying global config [alias: m]"
2121
},
2222
{
23-
"command": "model-reset",
24-
"description": "Reset session model to use global config [alias: mr]"
23+
"command": "config-reload",
24+
"description": "Reset all session overrides (model, provider, reasoning effort) to use global config [alias: cr]"
2525
},
2626
{
2727
"command": "reasoning-effort",

shell-plugin/lib/actions/config.zsh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,21 +358,23 @@ function _forge_action_session_model() {
358358
fi
359359
}
360360

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

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

372373
_FORGE_SESSION_MODEL=""
373374
_FORGE_SESSION_PROVIDER=""
375+
_FORGE_SESSION_REASONING_EFFORT=""
374376

375-
_forge_log success "Session model reset to global config"
377+
_forge_log success "Session overrides cleared — using global config"
376378
}
377379

378380
# Action handler: Select reasoning effort for the current session only.

shell-plugin/lib/config.zsh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ typeset -h _FORGE_PREVIOUS_CONVERSATION_ID
3434
# invocation for the lifetime of the current shell session.
3535
typeset -h _FORGE_SESSION_MODEL
3636
typeset -h _FORGE_SESSION_PROVIDER
37+
38+
# Session-scoped reasoning effort override (set via :reasoning-effort / :re).
39+
# When non-empty, exported as FORGE_REASONING__EFFORT for every forge invocation.
40+
typeset -h _FORGE_SESSION_REASONING_EFFORT

shell-plugin/lib/dispatcher.zsh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ function forge-accept-line() {
175175
model|m)
176176
_forge_action_session_model "$input_text"
177177
;;
178-
model-reset|mr)
179-
_forge_action_model_reset
178+
config-reload|cr|model-reset|mr)
179+
_forge_action_config_reload
180180
;;
181181
reasoning-effort|re)
182182
_forge_action_reasoning_effort "$input_text"

0 commit comments

Comments
 (0)