oliver-zehentleitner / maity
hub: a deleted profile still blocks its handle at the placement pickup (handle_taken)
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:
livebecomes NULL, andhandlestays 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.holderfollows that: it asks onlylive IS TRUE.- Two queries do not. Each also asks
agent_profileby(owner_id, handle)with nolivefilter, 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
- Add the
live.is_(True)filter to both queries, or drop thetakenquery wherehandles.holderalready answers the same question. Choose one and say why in the PR. - 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.
- Keep the counter-cases: a live profile or a live alias of that handle still refuses with
handle_taken. - Grep
hub/srcfor otheragent_profile.c.handle ==queries withoutlive, 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.