agent icon: 404 when unconfigured, client-side fallback

hive_sh4re::assets::branding_svg() resolved a server-side default
icon at runtime from HIVE_ASSETS_DIR — the only consumer was
serve_icon(), which fell back to it whenever the agent had no
`hyperhive.icon` override. Removed both the fallback and the
function: serve_icon() now 404s when /etc/hyperhive/icon.svg is
absent, and the per-agent web UI (app.js) picks up the existing
dashboard swarm.js pattern — swap the <img> src to the
frontend-bundled /favicon.svg on load failure, guarded against
looping if the fallback itself 404s.

Updated the doc/comment claims that said the server always returns
an image (docs/web-ui/agent.md, nix/agent-modules/default.nix, the
hive-c0re/forge/users.rs comment referencing the old shared-asset
set). forge-avatar-sync and the matrix avatar sync are unaffected —
both are gated on hyperhive.icon != null and never depended on the
removed fallback.
This commit is contained in:
iris 2026-08-10 20:35:23 +02:00 committed by mara
commit e525dcb6d4
6 changed files with 49 additions and 38 deletions

View file

@ -16,10 +16,13 @@
//! layout.
//!
//! Each crate that wants a specific asset goes through one of the
//! typed helpers (`branding_svg()`, `prompt_template()`, …) so the
//! lookup contract is centralised. Missing files panic at first
//! call with a clear "set `HIVE_ASSETS_DIR` + put the file at …"
//! message.
//! typed helpers (currently just `prompt_template()` — the branding
//! SVG used to live here too; the per-agent icon now 404s server-side
//! when unconfigured and falls back to a frontend-bundled default
//! client-side instead of a server-resolved runtime path, see
//! `hive-agent::web_ui::screen::serve_icon`) so the lookup contract is
//! centralised. Missing files panic at first call with a clear "set
//! `HIVE_ASSETS_DIR` + put the file at …" message.
use std::path::PathBuf;
@ -41,15 +44,6 @@ fn dir() -> PathBuf {
}
}
/// `$HIVE_ASSETS_DIR/branding/hyperhive.svg` — the project's primary
/// mark. Loaded by the per-agent web UI as its default icon
/// (`/agents/<n>/icon.svg` falls through here when the agent didn't
/// override `hyperhive.icon` in its `agent.nix`).
#[must_use]
pub fn branding_svg() -> PathBuf {
dir().join("branding/hyperhive.svg")
}
/// `$HIVE_ASSETS_DIR/prompts/system.md` — the claude system prompt
/// template. `hive-agent::prompt::render` filters the role markers
/// inside it per agent / manager flavor.