claim_bead: verify claim succeeded by reading back assignee
9p write exits 0 even when the server returns Rerror on Tclunk, so the previous exit-code check never detected failed claims. Read back the bead's assignee after writing and fail if it doesn't match. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
173746ce3b
commit
0ced30825d
|
|
@ -26,8 +26,11 @@ if [ -z "${AGENT_ID:-}" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if ! result=$(echo "claim $BEAD_ID $AGENT_ID" | 9p write anvillm/beads/$MOUNT/ctl 2>&1); then
|
||||
echo "error: claim failed: $result" >&2
|
||||
echo "claim $BEAD_ID $AGENT_ID" | 9p write anvillm/beads/$MOUNT/ctl
|
||||
|
||||
assignee=$(9p read anvillm/beads/$MOUNT/$BEAD_ID/json 2>/dev/null | jq -r '.assignee // empty')
|
||||
if [ "$assignee" != "$AGENT_ID" ]; then
|
||||
echo "error: claim failed (bead is assigned to '$assignee')" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "claimed $BEAD_ID → $AGENT_ID"
|
||||
|
|
|
|||
Reference in New Issue