Skip to content

feat: reload configuration in chat and add a built-in /config skill - #1508

Merged
edenreich merged 5 commits into
mainfrom
feat/reload-config-and-config-skill
Oct 2, 2026
Merged

edenreich merged 5 commits into
mainfrom
feat/reload-config-and-config-skill

Conversation

@edenreich

@edenreich edenreich commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • /reload (closes [FEATURE] Reload configuration in chat with /reload #1502). Re-reads the config files and INFER_* env through the same loader startup uses (State.LoadConfig). Applies the keys a running chat can pick up: gateway.timeout, agent.model, agent.max_turns, agent.max_tokens, agent.reasoning_effort and the whole chat.status_bar section, which the TUI reads on every repaint.
    • Every other changed key is named in the status line as taking effect on restart. It is never copied into the live config, so tools, sandbox and approval policy stay fixed for the session.
    • A reload that fails validation, or arrives while the agent is busy, keeps the previous config and shows the error.
  • Built-in config skill (closes [FEATURE] Built-in /config skill to change settings from chat #1499). /config <request> maps the request onto a dotted key and shows key: old -> new. It writes with infer config set only after the user confirms, then hands /reload back to apply the change.
    • Unknown keys get a clear "no such key" instead of a guessed write.
    • Tool, sandbox, MCP, channel, plugin, hook and judge policy and secrets are refused, with a pointer to the file to edit by hand.
  • Fix found while testing. infer config set wrote any value of the right type. A bad enum such as agent.reasoning_effort=bogus therefore broke every later infer call, including the config set that would repair it. The write is now checked with the startup loader and rolled back when rejected.

How it works

  • config.ChangedKeys diffs two configs by yaml tag. Split-file sections are named in snake_case, e.g. tools.safety.approval_behaviour.
  • ServiceContainer.ReloadConfig computes two diffs:
    • Hot keys against the live config. A /model or /effort choice survives a reload that leaves those keys untouched.
    • Restart-only keys against a baseline loaded at chat start. A pending restart-only change keeps showing until it is reverted or the chat restarts.
  • Hot values are copied into the live *config.Config, so every service keeps its pointer. agent.model and agent.reasoning_effort go through SelectModel and SetReasoningEffort, so the status bar follows.
  • The agent now reads gateway.timeout and agent.max_tokens per request instead of copying them at construction.

Notes

  • gateway.url and gateway.api_key are restart-only. About 12 SDK clients and the managed gateway are built from them at startup.
  • output.* and logging.level from the issue do not exist. logging.debug stays restart-only, because re-initialising the logger would bring stdout logging back over the TUI.
  • infer config get is deliberately not allow-listed. It would let the agent read gateway.api_key without approval.
  • Headless and daemon are out of scope. There, /reload says it is only available in infer chat.

Test plan

  • go test ./..., plus -race on container, agent loop, config, cmd/config, cmd/runtime and shortcuts.
  • Unit tests for each new path:
    • ChangedKeys.
    • The shortcut summary.
    • ReloadConfig: applies gateway.timeout, keeps tools.safety.approval_behaviour until restart, switches model and effort, and rejects an invalid config, a busy agent, and reload not being enabled.
    • config set rollback.
  • Manual check in infer chat with the mock gateway and a throwaway HOME:
    • /reload after infer config set gateway.timeout 300 → Reloaded gateway.timeout.
    • A tools.yaml approval change → Restart to apply tools.safety.approval_behaviour.
    • An invalid effort → Command failed: … invalid agent.reasoning_effort, with the old config kept.
    • A model switch → the status bar shows the new model.
    • Hiding the model, theme and tools indicators → Reloaded chat.status_bar, and they disappear right away.
  • /config skill end to end against a real model.

Docs

Follow-up for the docs site: inference-gateway/docs#916

/reload re-reads the config files and INFER_* env through the same loader
startup uses and applies the keys a running chat can pick up: gateway.timeout,
agent.model, agent.max_turns, agent.max_tokens and agent.reasoning_effort.
Every other changed key is named in the status line as taking effect on
restart and is never copied into the live config, so tools, sandbox and
approval policy stay fixed for the session. A reload that fails validation or
arrives while the agent is busy keeps the previous config and shows the error.

The agent now reads gateway.timeout and agent.max_tokens per request instead
of copying them at construction.

Closes #1502
infer config set wrote any value of the right type, so a bad enum such as
agent.reasoning_effort=bogus left a config.yaml that failed validation. Every
later infer call failed at startup, including the config set that would fix
it. The write is now checked with the same loader startup uses and the previous
file is restored when it is rejected.
/config <request> maps a plain-language request onto a dotted config key,
shows key: old -> new, writes it with infer config set only after the user
confirms and hands /reload back to apply it to the running chat. Unknown keys
get a clear answer instead of a guessed write. Tool, sandbox, MCP, channel,
plugin, hook and judge policy and secrets are refused with a pointer to the
file to edit by hand.

Closes #1499
Hiding status bar indicators with infer config set and /reload only reported
them as needing a restart, although the TUI reads chat.status_bar on every
repaint. /reload now copies the whole section into the running config and
reports it once as chat.status_bar instead of one entry per indicator.
@edenreich
edenreich merged commit d777ef3 into main Oct 2, 2026
1 check passed
@edenreich
edenreich deleted the feat/reload-config-and-config-skill branch October 2, 2026 23:23
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.223.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Reload configuration in chat with /reload [FEATURE] Built-in /config skill to change settings from chat

1 participant