Skip to content
SHAMPOO

Tool catalogue

job_claim

Write · Advanced · Jobs and lanes

job_claim

  • Category: jobs_lanes
  • Access: write
  • Audience: advanced (ordinary users do not normally call this directly)

Purpose

Claims one queued or lease-expired job under an atomic single-winner lease. A Job is one executable unit in Mind Quorum layering (Quorum holds what was agreed, Lane carries the coordinated stream, Job is the unit an executor runs). Call it when an executor is ready for work.

Arguments

Optional: kind, lease_seconds.

  • kind.
  • lease_seconds.

Result

JSON object with claimed (bool). When true, also job_id, kind, payload (empty string when absent), lease_until, and attempts. When false, no other keys.

Boundaries

Only entries whose project grants cover the caller are visible. Nothing available and nothing authorized answer identically, so callers cannot probe foreign projects. Attempts are bounded at 5; exhausted entries are skipped. Operates only inside the caller's profile boundary.

Lifecycle / side effects

Moves one queued or lease-expired entry to claimed with the caller as owner, a lease window, and an incremented attempt count. Expired-lease takeovers also record a reclaimed marker alongside the claim. Lost races emit nothing. The whole move fails atomically on error.

Errors

lease_seconds outside 1..3600 is rejected. Overlong kind is rejected. Unknown arguments are rejected. When nothing can be claimed the answer is claimed:false, never an error.

Example

{
  "kind": "delivery",
  "lease_seconds": 300
}

Result shape:

{
  "attempts": 1,
  "claimed": true,
  "job_id": "<uuid>",
  "kind": "delivery",
  "lease_until": "<iso-8601>",
  "payload": "{}"
}

lease_until is assigned by the server; the placeholder stands for the returned timestamp.

See also

job_create, job_complete, job_release, lane_list, inbound_list.

On this page