fix(desktop): hash spawn config as the env receives it, not raw record fields#1621
Merged
Conversation
…d fields The restart-required badge compared raw record values while the spawn env gets normalized ones, so three edits badged running agents that a restart would not change: - respond_to_allowlist: spawn normalizes (trim/lowercase/dedup) and only sets BUZZ_ACP_RESPOND_TO_ALLOWLIST in allowlist mode; the hash digested the raw list in every mode. Now hashed normalized, and only when respond_to == allowlist. - max_turn_duration_seconds: spawn fills the default into BUZZ_ACP_MAX_TURN_DURATION, so None and an explicit default are the same spawned value. Now hashed with the default filled in. - mcp_toolsets: same default-fallback (BUZZ_TOOLSETS); now hashed through the new DEFAULT_MCP_TOOLSETS constant, which also replaces the string literal in the spawn path so the two can't drift. Follow-up to #1602 (parked behind the spawn_hash persona-resolution rewrite that landed in #1618). Co-authored-by: Pinky <44b8e82baa6e0e254e0208d68f335c283c94e7b78dd1fa10d5a49d3f13dd0435@sprout-oss.stage.blox.sqprod.co> Signed-off-by: Wes <wesbillman@users.noreply.github.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.
Follow-up to #1602 (restart-required badge), parked behind the spawn_hash persona-resolution rewrite that landed in #1618.
Defect
The spawn-config hash digested raw record values while the spawn env receives normalized ones, so three field edits badged running agents even when a restart would run the exact same process:
respond_to_allowlistBUZZ_ACP_RESPOND_TO_ALLOWLISTset only in allowlist mode, fromvalidate_respond_to_allowlistoutput (trim/lowercase/dedup)max_turn_duration_secondsBUZZ_ACP_MAX_TURN_DURATIONwritten with default filled inOption—None≠Some(default)mcp_toolsetsBUZZ_TOOLSETSfalls back to the default setOption—None≠ explicit defaultEqual spawned env + unequal raw field = spurious badge.
Fix
Hash what the env receives:
respond_to == Allowlist, normalized via the samevalidate_respond_to_allowlistspawn uses. On validation error the raw list is hashed — spawn rejects invalid lists, so a stamped hash always came from a valid one and the invalid edit correctly compares unequal (badge = honest "restart would change/fail" signal).DEFAULT_AGENT_MAX_TURN_DURATION_SECONDSfilled in, matching the env write.DEFAULT_MCP_TOOLSETSconst intypes.rs, which also replaces the string literal inruntime.rs's spawn path — hash and env now share one source of truth and cannot drift.respond_tomode itself stays hashed unconditionally: toggling modes is spawn-visible and must badge.Tests
+8 in
spawn_hash/tests.rs(17 total): equivalence AND sensitivity in both directions for all three fields — dormant-list edits under owner-only don't badge, real allowlist content edits do; normalization-equivalent edits don't, content changes do;None↔ explicit default doesn't, non-default values do.Full desktop-tauri suite: 1048 passed / 0 failed. Clippy
--all-targetsclean, fmt clean, file-size check clean.Cross-reviewed and approved by Brain in #centralize-personas-and-agents (verified against
build_respond_to_envand the runtime.rs env writes; independently ran the suite).