Fix bounded avatar appearance recovery after login
Some checks failed
CI / rust-skia (Rust only) (push) Has been cancelled
CI / required (push) Has been cancelled

This commit is contained in:
2026-08-23 18:06:58 +02:00
parent 42f0c62b6b
commit 5a533dfa00
9 changed files with 1114 additions and 41 deletions

View File

@@ -74,6 +74,75 @@ async fn luna_describes_live_renderer_evidence() -> Result<(), Box<dyn Error>> {
}
}
#[tokio::test]
#[ignore = "sends three observer-rendered views of Myrddin to the configured vision model"]
async fn luna_confirms_myrddin_body_and_attachments() -> Result<(), Box<dyn Error>> {
let environment = live_environment()?;
let mut connection = AgentConfig::offline(
required(&environment, "OPENAPI_URL")?,
required(&environment, "OPENAPI_KEY")?,
)?
.llm;
connection.model = Some(required(&environment, "OPENAPI_MODEL")?.to_owned());
let client = LlmClient::new(connection);
let runtime = Runtime::empty_builder()
.with_store(mentra::runtime::VolatileRuntimeStore::default())
.with_registered_provider(client.mentra_provider())
.build()?;
let root = std::env::temp_dir().join(format!(
"metacrate-live-appearance-review-{}",
std::process::id()
));
let mut config = mentra::AgentConfig {
system: Some(
"Judge only visible evidence in virtual-world renders; do not infer success from the prompt."
.to_owned(),
),
..Default::default()
};
config.compaction.transcript_dir = root.join("transcripts");
config.task.tasks_dir = root.join("tasks");
config.team.team_dir = root.join("teams");
config.workspace.base_dir = root;
let mut agent = runtime.spawn_with_config(
"live-appearance-review",
ModelInfo::new(client.configured_model(), BuiltinProvider::OpenAI),
config,
)?;
let mut content = vec![ContentBlock::text(
"These are front, side, and back views rendered by a second logged-in agent. Determine whether Myrddin is visibly initialized as a recognizable male humanoid rather than a cloud, rectangle, placeholder, or missing avatar. Confirm whether a normal mesh body and coat-like worn attachment are visibly present and correctly follow the body, with no obvious detached, duplicated, or misplaced attachment geometry. Explain the visible evidence briefly. End with `APPEARANCE: PASS` only if every condition is visibly satisfied; otherwise end with `APPEARANCE: FAIL`.",
)];
for label in ["front", "side", "back"] {
let path = std::env::temp_dir().join(format!("metacrate-myrddin-appearance-{label}.jpg"));
let jpeg = std::fs::read(path)?;
content.push(ContentBlock::text(format!("{label} view:")));
content.push(ContentBlock::image_url(format!(
"data:image/jpeg;base64,{}",
base64::engine::general_purpose::STANDARD.encode(jpeg)
)));
}
let response = agent.send(content).await?;
let descriptions = response
.content
.into_iter()
.filter_map(|block| match block {
ContentBlock::Text { text } if !text.trim().is_empty() => Some(text),
_ => None,
})
.collect::<Vec<_>>();
for description in &descriptions {
println!("LIVE_APPEARANCE_LLM={description}");
}
if descriptions
.iter()
.any(|description| description.contains("APPEARANCE: PASS"))
{
Ok(())
} else {
Err("vision model rejected Myrddin appearance evidence".into())
}
}
fn live_environment() -> Result<BTreeMap<String, String>, Box<dyn Error>> {
let mut values = std::env::vars().collect::<BTreeMap<_, _>>();
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../.env");