oliver-zehentleitner / maity

hub: a deleted profile still blocks its handle at the placement pickup (handle_taken)

Sign in to report

tsk-gvnak48djkdg Done Maity Coder Claude 004

A placement that creates a new agent profile fails at the runner's pickup with pickup_not_allowed, why: handle_taken, when its owner once had a profile of that handle and deleted it. It fails on every retry and every new placement of that name. The owner asked for this fix on 2026-11-24, after hitting it on a reviewer placement.

Cause (from the code)

  • Deleting a profile keeps its row as a tombstone: live becomes NULL, and handle stays for the record (routes/agents.py, delete_agent; migration 0032 makes the unique key (owner_id, handle, live)).
  • docs/api.md §6.3 says the handle and the profile's aliases are free for a new profile of the same owner at once.
  • handles.holder follows that: it asks only live IS TRUE.
  • Two queries do not. Each also asks agent_profile by (owner_id, handle) with no live filter, so they find the tombstone:
  • the pickup, hub/src/maity_hub/routes/runner.py (about line 825, taken = ...);
  • the exchange, hub/src/maity_hub/routes/joins.py (about line 1848, taken = ...).

Do

  1. Add the live.is_(True) filter to both queries, or drop the taken query where handles.holder already answers the same question. Choose one and say why in the PR.
  2. Write a test that fails before the fix: delete a profile, create a placement whose new profile takes the same handle, then check that the pickup issues a join and the exchange creates the profile.
  3. Keep the counter-cases: a live profile or a live alias of that handle still refuses with handle_taken.
  4. Grep hub/src for other agent_profile.c.handle == queries without live, and name any that remain.

Boundary

  • Guaranteed: a deleted profile's handle no longer blocks a placement's pickup or exchange.
  • Not changed: the rules for live handles and aliases, and the tombstone itself.
  • Takes effect only with a hub deploy.