@@ -104,10 +104,7 @@ pub struct ManagedAgentRecord {
104104 /// `#[serde(default)]` so pre-existing records deserialize as `None`.
105105 #[ serde( default ) ]
106106 pub avatar_url : Option < String > ,
107- /// True when `avatar_url: None` came from an explicit user clear. Legacy
108- /// records without an avatar also deserialize as `None`, so this flag lets
109- /// profile reconciliation distinguish "clear the relay picture" from
110- /// "backfill the legacy missing value".
107+ /// True when `avatar_url: None` came from an explicit user clear.
111108 #[ serde( default ) ]
112109 pub avatar_url_cleared : bool ,
113110 pub acp_command : String ,
@@ -697,40 +694,11 @@ mod tests {
697694 assert_eq ! ( record. avatar_url, None ) ;
698695 assert ! ( !record. avatar_url_cleared) ;
699696 assert_eq ! ( record. pubkey, "abcd1234" ) ;
700- }
701-
702- #[ test]
703- fn managed_agent_record_preserves_explicit_avatar_clear ( ) {
704- let record: ManagedAgentRecord = serde_json:: from_str (
705- r#"{
706- "pubkey": "abcd1234",
707- "name": "test-agent",
708- "private_key_nsec": "nsec1fake",
709- "relay_url": "wss://localhost:3000",
710- "avatar_url": null,
711- "avatar_url_cleared": true,
712- "acp_command": "buzz-acp",
713- "agent_command": "goose",
714- "agent_args": [],
715- "mcp_command": "",
716- "turn_timeout_seconds": 320,
717- "system_prompt": null,
718- "created_at": "2026-01-01T00:00:00Z",
719- "updated_at": "2026-01-01T00:00:00Z",
720- "last_started_at": null,
721- "last_stopped_at": null,
722- "last_exit_code": null,
723- "last_error": null
724- }"# ,
725- )
726- . expect ( "explicit avatar clear should deserialize" ) ;
727-
728- assert_eq ! ( record. avatar_url, None ) ;
729- assert ! ( record. avatar_url_cleared) ;
730697
731- let serialized = serde_json:: to_value ( & record) . expect ( "should serialize" ) ;
732- assert_eq ! ( serialized[ "avatar_url" ] , serde_json:: Value :: Null ) ;
733- assert_eq ! ( serialized[ "avatar_url_cleared" ] , true ) ;
698+ let mut value = serde_json:: to_value ( & record) . expect ( "should serialize" ) ;
699+ value[ "avatar_url_cleared" ] = true . into ( ) ;
700+ let cleared: ManagedAgentRecord = serde_json:: from_value ( value) . unwrap ( ) ;
701+ assert ! ( cleared. avatar_url_cleared) ;
734702 }
735703
736704 /// Agent records WITH an auth_tag round-trip correctly through serde.
0 commit comments