Multi-repository tasks: one mission per service
A tracker task can describe work that spans more than one repository. For such a
task Mockarty does not pick one repository and silently ignore the rest: it starts
one mission per service, each mission works only its own repository, and the
task’s status is decided by the combined result of all of them.
A service is one deployable unit of a product: one repository, optionally with
its own deploy target and its own write scope. Services are declared in the task’s
work contract (its envelope). Read Tasks for the tracker itself
and Autonomous Missions for what a mission does.
Declaring the work contract
The contract is a machine document attached to a task. Create it through the API
(or the task_envelope_set MCP tool):
curl -X PUT "$MOCKARTY_BASE_URL/api/v1/tasks/$TASK_ID/envelope" \
-H "Authorization: Bearer $MOCKARTY_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"productId": "11111111-1111-4111-8111-111111111111",
"intent": "build",
"services": [
{
"name": "api",
"repoUrl": "https://git.example.com/team/orders-api.git",
"scope": ["internal/api/"]
},
{
"name": "web",
"repoUrl": "https://git.example.com/team/orders-web.git",
"scope": ["src/api/"]
}
],
"acceptance": [
{
"id": "api-unit",
"service": "api",
"text": "the api unit tests pass",
"check": {"kind": "command", "argv": ["go", "test", "./..."], "timeoutSeconds": 900}
},
{
"id": "web-health",
"service": "web",
"text": "the staging web app answers its health check",
"check": {"kind": "http", "url": "https://staging.example.com/health", "expectStatus": 200}
}
],
"budget": {"tokens": 50000000, "attempts": 3}
}'
The task’s contract follows these rules:
productIdmust exist in the workspace, and everyrepoUrlmust be admitted by
that product’s delivery settings. Naming a repository in the contract does not
grant access to it.acceptance[].servicemust name one of the declared services. A criterion
without a service is task-wide: every service’s mission must satisfy it. A
criterion with a service is executed and shown only by that service’s mission,
so a probe of the API image is not run against the web repository.services[].scopenarrows the write set of that service’s mission. A service
without its own scope uses the task-widescope; it never inherits another
service’s scope.intentselects the class of work:build,verify,deployoroperate.
A deploy-intent task needs a deploy target for every service it must deliver.budget.attemptsandbudget.tokensbound the whole attempt, not each service.
To update the contract, send the exact current version back with the changed
document. A stale version is refused with 409 instead of overwriting a
teammate’s edit.
task_envelope_get (or GET /api/v1/tasks/{id}/envelope) reads the contract; a
task without one returns 404.
Starting the run
Start the task’s run through the task endpoint. An empty body is enough: the task’s
own title and description become the mission goal.
curl -X POST "$MOCKARTY_BASE_URL/api/v1/tasks/$TASK_ID/run" \
-H "Authorization: Bearer $MOCKARTY_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
A multi-service contract answers with one entry per service:
{
"missions": [
{"id": "a1b2c3d4-0000-4000-8000-000000000001", "subject": "api", "data": {"service": "api", "repoUrl": "https://git.example.com/team/orders-api.git"}},
{"id": "a1b2c3d4-0000-4000-8000-000000000002", "subject": "web", "data": {"service": "web", "repoUrl": "https://git.example.com/team/orders-web.git"}}
],
"created": [true, true],
"warnings": []
}
A single-service contract keeps the older shape: {mission, created, warnings}.
Repeating the same request returns the missions it already started with
created: false and HTTP 200 — it never launches a second paid run.
How the work is split
- One mission per service. Each mission’s goal names only its own repository and
tells the coder that the other services are separate runs, so it cannot wander
into a repository that belongs to another mission. - Each mission receives only its service’s acceptance criteria plus the task-wide
ones. - The attempt budget is divided evenly between the services: their total never
exceeds the contract’s ceiling. - One attempt covers all services. Retrying is an attempt-level decision: while any
service of the attempt is still running, no duplicate attempt can start; when
every service has finished and not every one is proven, the next attempt starts
missions for all services again. A success in one service does not close a
failed attempt.
How the task’s status is decided
The task’s status changes only when the whole attempt is settled:
| State of the attempt | Tracker status |
|---|---|
| Some services are still running | Unchanged. The task’s comments name how many of how many services finished and which are still awaited. |
| All services finished, every service’s typed checks ran | in_review |
| All services finished, at least one failed or was cancelled | failed |
| All services finished, at least one has no executed typed evidence | unverified |
| Delivery task, every required deployment verified | in_review |
| Delivery task, a required deployment missing or refused | failed or unverified |
Every comment names the service it is about, so a reader can follow two
repositories without opening two mission cards. When the contract cannot be read,
the combined verdict is not projected: a task must not be marked ready on an
unproven service set.
Run history
GET /api/v1/tasks/{id}/runs (or task_run_list) lists every mission the task
started, newest first. A multi-service task lists one mission per service, and each
row carries service, repoUrl and — when the run published an artifact — the
acceptedCommit, so “which repository did this run change” is answered from the
run history itself.
Agents get the same contract through task_envelope_get / task_envelope_set and
task_run_start / task_run_list.
Limitations
-
A new start held by the approved task brief returns HTTP 409 with
reviewed_attempt_unavailable. Open the task’s run history to inspect earlier
attempts. Retrying the start while the hold is in effect creates no run. -
A multi-service contract must be started through the task run endpoint. An entry
point that can only start one run for a task refuses it with
multi_service_requires_run_endpointinstead of silently running one repository
and leaving the others untouched. -
A plan or sub-task of one service cannot name another service’s repository. Such
a plan is refused before any paid work starts. -
A service that declares no deploy target cannot be delivered: a deploy-intent
task is refused at start rather than delivered to a neighbour’s target. -
The contract is created and edited through the API or the MCP tools; the tracker
page remains the human-facing task. Editing the contract changes what the next
run does, never what a finished run did.
Related pages
- Tasks — the built-in tracker, automation rules and the Start run action.
- Autonomous Missions — the mission list, cards and controls.
- Autonomous Coder — how a coding mission works and what a runner receives.
- API Reference — the endpoint reference.