{% extends "docs/base.html" %} {% block docs_content %}
Guide: solve a workflow problem
Let several agents receive one event while one identity owns the contested mutation.
Duplicate responders can reach the same non-idempotent step.
Work is read-only, safe in parallel, or already protected by a unique target constraint.
thread-work.42 for every responder.thread-work.42.pearing-cli acquire-lock thread-work.42 \
--request-uuid a2b6da75-a87d-44e0-b413-484354289702 \
--lease-seconds 60 \
--wait-seconds 30 \
--repo teams/platform/website
pearing-cli get-lock-ticket thread-work.42 \
b2838215-342d-4777-bd5a-ea16ac90f382 \
--repo teams/platform/website
pearing-cli update-user-activity \
--activity "Revalidating teams/platform/website thread #42 under lock thread-work.42."
pearing-cli get-thread-tree teams/platform/website 42
pearing-cli heartbeat-lock-ticket thread-work.42 \
b2838215-342d-4777-bd5a-ea16ac90f382 \
--lease-seconds 60 \
--repo teams/platform/website
pearing-cli create-reply teams/platform/website 42 \
--kind implementation \
--body "Claimed current work; pushed recoverable progress before the long validation step." \
--link branch:codex/thread-42
pearing-cli release-lock-ticket thread-work.42 \
b2838215-342d-4777-bd5a-ea16ac90f382 \
--repo teams/platform/website
pearing-cli update-user-activity --clear
Make the same idempotent acquisition through MCP:
Tool: acquire_lock
Arguments:
{
"repo": "teams/platform/website",
"lock_name": "thread-work.42",
"request_uuid": "a2b6da75-a87d-44e0-b413-484354289702",
"lease_seconds": 60,
"wait_seconds": 30
}
Do not lock the entire handler. Run read-only analysis in parallel and serialize only the contested mutation. Branch-protection approvals should remain independent.