feat(workforce): every mission hires its own crew
Reverses the reuse added earlier, by operator decision. Reuse hired the existing claw for a (template, slot) so the roster stayed at one team — but it also meant every mission was staffed by the same five names, and the workforce view showed one crew repeated down the page with nothing to tell the missions apart. Distinct crews read better than a bounded roster. The cost is the one reuse existed to avoid: claws are lifecycle='permanent' and nothing reaps them until their MISSION is deleted, so the roster now grows by the team size per mission. `agent_names::pick` keeps names unique workspace-wide and degrades to a numeric suffix rather than colliding, and the pool grew from 70 to 200+ given names so a workspace runs ~35 missions before the first repeat. `reusable_claw` is kept in cm-db with its tests: this policy has now flipped twice and the query is the hard part. Also revives a test that had silently stopped running. An edit stranded `runtime_data_is_scoped_to_one_mission`'s `#[test]` above its neighbour, leaving two attributes there and none here — so the neighbour ran TWICE and this one never ran at all. The total test count was unchanged by the fix (291 before and after), which is exactly why a count is not evidence: rustc had said "duplicated attribute" and "function is never used" all along, and both read as ordinary warnings. The test guards per-mission `/zeroclaw-data` isolation, i.e. one mission reading another's door token. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
c85027c83a
commit
98037f9b3e
@@ -474,20 +474,26 @@ async fn mint_team_from_template(
|
||||
template.roles.len(),
|
||||
));
|
||||
};
|
||||
// Hire the claw that already does this job, if it is free.
|
||||
// Every mission gets its OWN crew.
|
||||
//
|
||||
// Every zeroclaw mission used to mint a fresh set. They are created
|
||||
// `lifecycle = 'permanent'` and nothing reaps them until the MISSION is
|
||||
// deleted, so the roster grew by a whole team per mission while each
|
||||
// member worked once — and "My Workforce" was a list of strangers.
|
||||
let reused = cm_db::repo::agent_template_link::reusable_claw(
|
||||
pool,
|
||||
workspace_id.as_uuid().to_owned(),
|
||||
template.template.id,
|
||||
&role.slot,
|
||||
)
|
||||
.await
|
||||
.map_err(|e| format!("look up a reusable claw for {}: {e}", role.slot))?;
|
||||
// This deliberately reverses the reuse added earlier. Reuse hired the
|
||||
// existing claw for a (template, slot) so the roster stayed at one team
|
||||
// and "My Workforce" was people you keep — but it also meant every
|
||||
// mission was staffed by the same five names, and the workforce view
|
||||
// showed one crew repeated down the page with nothing to tell the
|
||||
// missions apart. Chosen by the operator: distinct crews read better
|
||||
// than a bounded roster.
|
||||
//
|
||||
// The cost is real and is the cost that reuse existed to avoid: claws
|
||||
// are `lifecycle = 'permanent'` and nothing reaps them until their
|
||||
// MISSION is deleted, so the roster now grows by the team size on every
|
||||
// mission. `agent_names::pick` keeps names unique workspace-wide and
|
||||
// falls back to a numeric suffix once the pool is exhausted, so growth
|
||||
// degrades the naming gracefully rather than colliding.
|
||||
//
|
||||
// `reusable_claw` in cm-db is kept, with its tests: this is a policy
|
||||
// choice that has now flipped twice, and the query is the hard part.
|
||||
let reused: Option<uuid::Uuid> = None;
|
||||
|
||||
let agent = Agent {
|
||||
id: cm_domain::AgentId::new(),
|
||||
|
||||
Reference in New Issue
Block a user