fix: preserve model/provider/temperature across Hand respawn#699
Open
Fail-Safe wants to merge 3 commits intoRightNow-AI:mainfrom
Open
fix: preserve model/provider/temperature across Hand respawn#699Fail-Safe wants to merge 3 commits intoRightNow-AI:mainfrom
Fail-Safe wants to merge 3 commits intoRightNow-AI:mainfrom
Conversation
When a Hand agent is respawned (on daemon restart or reactivation),
activate_hand() rebuilds the manifest entirely from HAND.toml, silently
discarding any tool_allowlist/tool_blocklist changes made via the API.
The API returned {"status":"ok"} for these updates, creating a broken
contract: changes appeared to succeed but were lost on the next restart.
Fix: capture the existing agent's tool filters before killing it at
respawn time, and reapply them to the freshly-built manifest. Empty
filters are treated as "no override" (not "block all") so hands with no
API-set filters continue to get the full tool list from HAND.toml.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends the API-patch preservation introduced in 81eb7cb to cover model config fields. Previously, provider, model, and temperature changes made via the agents API were lost every time a Hand was respawned (daemon restart, crash recovery, or manual reactivation) because activate_hand() rebuilt the AgentManifest entirely from the compile-time-embedded HAND.toml. Changes: - kernel.rs: single registry scan now captures both tool filters and model config before rebuild; existing_model_override carries provider/model/ temperature and is reapplied after the manifest is built, only when the live values differ from what HAND.toml would produce. system_prompt is intentionally excluded — it is assembled dynamically from HAND.toml plus settings context and must stay live. - registry.rs: add update_temperature() for hot-patching sampling temp. - routes.rs: expose temperature in list/get responses; add temperature field to PatchAgentConfigRequest and implement it in patch_agent_config with 0.0–2.0 validation. - index_body.html + agents.js: temperature input in the agent config tab. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every time a Hand agent was respawned (daemon restart, crash recovery, or manual reactivation),
activate_hand()rebuilt theAgentManifestentirely from the compile-time-embeddedHAND.toml, silently discarding any changes made via the agents API. This caused a persistent revert loop:researcher-handvia API (model, provider, tool filters) ✅activate_hand()rebuilds fromHAND.toml→ changes gone ❌Changes
Commit 1 — preserve API-patched tool filters across Hand respawn
activate_hand()now reads the existing agent'stool_allowlistandtool_blocklistfrom the registry before rebuilding the manifest, and reapplies them after. Only applied when non-empty — an empty list means "no override set", not "block all".Commit 2 — preserve model/provider/temperature + temperature API
Extends the same pattern to model config fields. A single registry scan captures the existing agent's
provider,model, andtemperaturebefore rebuild. After computinghand_provider/hand_modelfromHAND.toml, any difference from the live values indicates an API patch — those values are reapplied after the manifest build.system_promptis intentionally excluded: it is assembled dynamically fromHAND.toml+ settings context and must stay live.Also adds:
registry::update_temperature()for hot-patching sampling temperaturetemperatureexposed inGET /api/agentsandGET /api/agents/{id}responsestemperaturefield inPATCH /api/agents/{id}/configwith0.0–2.0validationWhat survives respawn after this PR
tool_allowlisttool_blocklistprovidermodeltemperaturesystem_promptTest plan
PUT /api/agents/{id}/model, restart daemon — agent should come back with the patched modelPUT /api/agents/{id}/tools, restart — filters should be preservedPATCH /api/agents/{id}/configwith{"temperature": 0.5}, restart — temperature should be preserveddefault_modelfrom config correctly (override path should beNone)cargo test --workspacepasses🤖 Generated with Claude Code