refactor(#3434): drop the agent_repo identity function

mara, PR #3438 review: 'remove the identity function. agent names
are unique and all repos go into agent-configs namespace anyway'. Right --
repo==agent isn't a convention worth a name once every call site can just
say so; call create_repo/add_repo_member/seed_agent_config with &agent
directly.
This commit is contained in:
atlas 2026-08-18 20:50:51 +02:00 committed by mara
commit 6dffa74d90
2 changed files with 8 additions and 21 deletions

View file

@ -31,19 +31,12 @@ use crate::webhook::DeliveryKind;
/// The forge org that owns agent repos. Same org `hive-c0re::forge`
/// already uses for its own single-hive `CreateRepo` path — this is
/// the same forge instance, not a separate one, so the same org.
pub const AGENTS_ORG: &str = "agents";
/// The repo an agent's config lives in — one repo per agent inside
/// [`AGENTS_ORG`], named after the agent.
///
/// The identity here is the point, not an accident to be inlined: this is
/// the single home for the naming convention, so a caller holding an agent
/// name never writes the repo name itself. Callers used to pass both, which
/// meant every node payload carried the same string twice and any future
/// change to the convention would have been a search rather than an edit.
pub fn agent_repo(agent: &str) -> &str {
agent
}
/// There is no per-agent repo-vs-agent naming convention to maintain here:
/// agent names are unique and every agent's repo lives in this one org, so
/// the agent name IS the repo name at every call site (dropped the
/// `agent_repo` identity function this used to go through, per review).
pub const AGENTS_ORG: &str = "agents";
/// The `operators` team, whitelisted for the merge gate on every repo
/// this client protects — provisioned by `hive-c0re::forge::repos`

View file

@ -155,7 +155,7 @@ async fn run_swarm_node(
SWARM_CONTROLLER_FORGE_TOKEN_FILE unset)"
.to_owned(),
),
Some(client) => match client.create_repo(forge::agent_repo(&agent)).await {
Some(client) => match client.create_repo(&agent).await {
Ok(full_name) => {
tracing::info!(%full_name, "swarm jobq: create_repo done");
Outcome::Done
@ -169,10 +169,7 @@ async fn run_swarm_node(
SWARM_CONTROLLER_FORGE_TOKEN_FILE unset)"
.to_owned(),
),
Some(client) => match client
.add_repo_member(forge::agent_repo(&agent), &agent)
.await
{
Some(client) => match client.add_repo_member(&agent, &agent).await {
Ok(()) => Outcome::Done,
Err(e) => Outcome::Failed(format!("{e:#}")),
},
@ -183,10 +180,7 @@ async fn run_swarm_node(
SWARM_CONTROLLER_FORGE_TOKEN_FILE unset)"
.to_owned(),
),
Some(client) => match client
.seed_agent_config(forge::agent_repo(&agent), &agent)
.await
{
Some(client) => match client.seed_agent_config(&agent, &agent).await {
Ok(()) => Outcome::Done,
Err(e) => Outcome::Failed(format!("{e:#}")),
},