Skip to content

Automatically Restart Gateway after Model Change - #266

Closed
toms119 wants to merge 1 commit into
NousResearch:mainfrom
toms119:toms119-patch-1
Closed

Automatically Restart Gateway after Model Change#266
toms119 wants to merge 1 commit into
NousResearch:mainfrom
toms119:toms119-patch-1

Conversation

@toms119

@toms119 toms119 commented Mar 2, 2026

Copy link
Copy Markdown

This patch fixes a fatal crash occurring when the model is updated via Telegram. It uses a detached subprocess to allow the gateway to restart itself in the background without severing the active connection.

fix(gateway): implement detached daemon restart on model change
@toms119 toms119 changed the title fix(gateway): implement detached daemon restart on model change. Automatically Restart Gateway after Model Change Mar 2, 2026
@teknium1

teknium1 commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for looking into this, @toms119! Really appreciate you digging into the gateway code and thinking about the user experience around model switching.

Good news — the /model command actually already applies changes on the very next message without needing a restart! Under the hood, the gateway reads the config fresh for each incoming message, so when /model writes the new model to config.yaml and updates the environment variable, the next message you send will automatically use the new model. No downtime needed!

If you were seeing a crash after changing models, that might be a separate issue worth investigating — could you share the error output if it happens again? We'd love to track down the root cause. It's possible it was a transient API error with the new model endpoint rather than the model switch itself.

The reason we're cautious about the restart approach is that killing and relaunching the gateway process would drop all active connections (Telegram, Discord, etc.) for all users, which could be disruptive in a multi-user setup. The current "hot swap" behavior avoids that entirely.

Thanks again for the contribution — always great to have more eyes on the codebase! 🙏

@toms119

toms119 commented Mar 5, 2026

Copy link
Copy Markdown
Author

Thank you Teknium for reviewing and your explanation, I'm loving hermes agent.

dizhaky added a commit to dizhaky/hermes-agent that referenced this pull request Aug 1, 2026
The installer verified the downloaded codebase-memory-mcp tarball against a
checksums.txt fetched from the same GitHub release as the tarball. That proves
the download wasn't corrupted in transit; it proves nothing about the
publisher. Anyone able to alter the release alters both files together and
verification still passes.

Replaced with per-arch sha256 values pinned in the script. A hash committed
here is an independent reference: it fails closed if the tag is ever
re-pointed or the asset re-uploaded.

This matters more than usual because cbm-code-discovery-gate executes the
binary on every PreToolUse once the hook is registered — a swapped artifact
would run constantly, not once. It is also the pattern this repo's own
gitleaks workflow already uses (pinned by version AND tarball sha256), so this
is consistency rather than novelty.

An arch with no pinned hash is now a hard stop rather than a fall-through to
an unverified install.

Provenance: both linux tarballs were downloaded and sha256sum'd locally, and
the computed digests matched the release's checksums.txt. The pinned values
are the computed ones, not transcribed.

Mirrors crm-pipeline NousResearch#266.
github-actions Bot pushed a commit to dizhaky/hermes-agent that referenced this pull request Aug 1, 2026
The installer verified the downloaded codebase-memory-mcp tarball against a
checksums.txt fetched from the same GitHub release as the tarball. That proves
the download wasn't corrupted in transit; it proves nothing about the
publisher. Anyone able to alter the release alters both files together and
verification still passes.

Replaced with per-arch sha256 values pinned in the script. A hash committed
here is an independent reference: it fails closed if the tag is ever
re-pointed or the asset re-uploaded.

This matters more than usual because cbm-code-discovery-gate executes the
binary on every PreToolUse once the hook is registered — a swapped artifact
would run constantly, not once. It is also the pattern this repo's own
gitleaks workflow already uses (pinned by version AND tarball sha256), so this
is consistency rather than novelty.

An arch with no pinned hash is now a hard stop rather than a fall-through to
an unverified install.

Provenance: both linux tarballs were downloaded and sha256sum'd locally, and
the computed digests matched the release's checksums.txt. The pinned values
are the computed ones, not transcribed.

Mirrors crm-pipeline NousResearch#266.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants