Orchestration
Handing a task off
What happens when you hand a task off: the stages, the rules that drive them, and what stays yours.
Hand a task off and Lonca carries it from a plan to a merge-ready pull request. Separate stage agents plan, implement, test and review it, each a run of its own on its own model; Lonca runs the full suite once, opens the PR, moves the Jira issue and watches CI. What drives the steps is plain code, not a model. Merging and deleting stay yours, unless you turn on Merge ready PRs (see Merging the PR).
Orchestration is always on, on every plan: handing a task off is how work gets done in Lonca. There is no switch to turn it off; Pause all in the title bar is the one way to stop everything at once. Until plans are enforced everyone runs as Pro and nothing is locked; on Free, once plans start, the whole pipeline still runs, one task at a time, and every question it cannot settle comes to you.
Handing a task off
A task that is not handed off yet opens on its Flow tab with every stage of the rail empty and one card under it. The card says what handing off does and what it approves, and has the button Hand off. Hand off in the task's menu (see The task's menu) starts it without the card, fresh, with normal priority and no dependencies.
- The Brief section above the button holds your own instructions for the task, written with its task lead (see The hand-off brief).
- Depends on takes up to ten task keys or branches this work needs merged first; the workspace’s other tasks are suggested as you type. Start on top of it, offered with exactly one dependency, stacks the task on it (below).
- Show the app during E2E shows the app’s window while its checks run. The check before the PR always runs hidden.
- High priority, shown only while load control is on, gives the task the machine first and freezes it last.
- A task without a worktree gets one first: Setup is the pipeline's first stage. There is no separate way to set up a worktree, and no way to work on a task without handing it off.
If the hand-off fails before there is a pipeline, the card says why, with Try again. An archived task is unarchived first. The orchestration: block of config.yaml is required, and the Configurator writes it from your repositories.
The stages
| Stage | Who | What happens |
|---|---|---|
| Setup | Lonca | The worktree, its port and local files, if the task has none yet (see Worktrees and setup). |
| Plan | Planner | Writes the plan. Its open contracts become questions, settled before any code is written. |
| Implement | UI implementer, implementer | The implementer codes the plan in its own terminal, test-first, and commits. A task with Figma designs first goes to the UI implementer (see Figma UI step). |
| Test | Test scenarios, E2E runner, final check | The scenario writer writes E2E scenarios from the criteria, the runner runs them, the final check holds the result against the acceptance criteria. |
| Review | Reviewer | Judges clean code, structure and security, and writes the PR’s description. |
| Gate | Lonca | Runs the full suite and the repository’s verify once, and records the result as it is. |
| Publish | Lonca | Pushes the branch, opens the PR and moves the Jira issue. |
| PR | Lonca | Watches the CI checks until the PR is merged, and handles its review comments on the plans that include them. |
A repository without an e2e: block skips the scenario and runner steps. Each stage agent is described on Stage agents; the gate on Tests, the gate and jobs; the PR on Pull requests, CI and comments.
The rules that drive it
Every step, every trip back to implementation and every push follows rules in Lonca’s code, not a model’s judgement. A model is consulted only for what a rule cannot settle (below). The rules you will notice:
- Tests are scoped. Stage agents test their own change; the full suite runs once, at the gate, by Lonca. A flake outside the change is recorded, not held against the task.
- Facts over opinions. When Lonca runs the E2E scenarios, their results tick the criteria, and no model can overrule them.
- The plan closes its open questions first. The plan has a
## Contracts and premisessection, each line tagged[confirmed: source],[premise: how it was checked],[risk]or[open]. An open or untagged line, or no section, becomes a question before any code is written. - Review findings go back as
block_onsays:minor(the default) sends every finding back,blockingonly the blocking ones. Under consultant or autopilot, a review whose findings are all minor, or all change no behaviour, is held for the task’s lead first, which may set some aside. - Findings that change no behaviour take a short path: a round whose findings all change no behaviour skips the E2E path and goes back to review, unless the files it touched say otherwise.
- Nothing runs twice for nothing. A clean verdict on unchanged code stands; a round that changed no criteria keeps the scenarios already written; busy resources (a port, a browser profile) are waits, not failures.
- The branch is kept in step with its base. Before every implementation round, and again before the gate, Lonca brings the local base up to date and rebases onto it when the branch is behind. The fetch is the one shared by every task of the repository (see The base branch); the look and the rebase never fetch themselves. With no network (a VPN down), they compare and rebase against the local base as it is. A rebase that conflicts at the start of a round is undone and left for the look before the gate, where a conflict is a round of its own, with at most 200 of its files listed (the implementer is told the total and that the list was cut). A clean rebase before the gate goes straight to the gate, which then runs whole. The gate never runs on the old base. In a shallow clone that lacks the commit the branch and its base share, Lonca fetches more history (50, 200, then 1000 commits more, then all of it) and looks again; a full clone is never fetched for this. If there is still none, an environment question says why, rather than a rebase that conflicts on every file.
- A security finding is never set aside, and publishing is refused while one is open.
Loops and limits
A loop is the same work coming back: test, review and PR each send the task back to implementation. Each trip counts against its loop, including a move back by a lead or by you.
max_rounds(default 3) is where Lonca looks, not where it stops. Past it, Lonca adds a round itself as long as each round brings new findings, and the timeline recordsrounds-extended.- The loop stops when a finding fixed in an earlier round comes back, when the same findings come back two rounds in a row, when an implementation round makes no new commit (a conflict round is judged by whether its rebase finished: resolving to the base's side may leave no commit to make), past
max_roundswhen a finding the same check reported last time comes back, or at three timesmax_rounds(plus any rounds you gave). With the leads, the task’s lead looks at the stop first and may carry the task on; otherwise it comes to you. max_runs_per_task(default 40) caps the stage agent runs of a task, retries included. Each added round buys five more.- The card of a stuck task (The work is stuck, its row Stuck) names the findings under Technical details. Tell the stage agent what to do differently and Send and try again, or give Extra tries: each is one more round.
Time limits
stage_timeout_minutes | Default | Limits |
|---|---|---|
implementer | 60 | The implementer’s run |
ui_implementer | 90 | The UI implementer’s run |
test_runner | 120 | The E2E runner’s run |
default | 20 | Every headless stage agent (planner, test scenarios, final check, reviewer) |
idle | 10 | A terminal stage agent whose screen does not change this long is stopped |
- Only the stage agent’s own working time counts. Time Lonca was off (a restart, a night with the lid closed) does not, and neither does time spent waiting for a job Lonca runs for it.
- An agent visibly at work on a command that prints nothing (its hook says working) is not idle after
idleminutes; only once its screen and its transcript have both stood still for its step’s whole limit. - Under consultant or autopilot, a terminal stage agent still working at its ceiling, and not looping, gets another window instead of being stopped. The decision log says
kept goingorstopped at its limit. Under assistant the ceiling stands. - A stopped stage agent’s terminal stays open, and the question goes to the task’s lead, or to you.
When it asks you
When a rule cannot decide, the task stops with a question under Waiting on you on its Flow tab, and its row moves to Needs you with an orange stage ring. With the leads configured, the task’s lead, then its Workspace Lead, settle what they can first, and how much reaches you follows How much the leads decide in Settings → Orchestration (see The leads and Autonomy and decisions). Without them every question comes to you, as it will on the Free plan once plans start (see Plans).
| The card says | What happened |
|---|---|
| A decision is needed | A stage agent needs a judgement; the stage agent runs again with your decision. |
| The agent asks in its terminal | A terminal stage agent asks a permission or a question. The row's stage ring shows ›_ in orange, and Open its session on the card opens the Sessions panel on that agent. |
| A step keeps failing | Try the step again from a fresh start, or say what to do differently. |
| A step ran out of time | The same, for a step stopped at its time limit. |
| Something outside the code | An environment problem: fix what the message names outside Lonca, then Try again. |
| The work is stuck | A loop came round again (above). Where nothing failed, the card says Needs more tries or The work may be done instead. |
| The PR was closed | The pull request was closed on GitHub. |
| E2E checks are open | Verified code with E2E boxes still open (see Acceptance criteria). |
| The branch exists on the remote | Setup found the task’s branch already on the remote; taking it overwrites the local copy, unpushed commits included. |
| A dependency will never be merged | A stacked task’s dependency was archived, deleted or closed unmerged: keep its commits in this PR, or take them out (see Dependencies below). |
A task lead can settle the first four. A stopped loop goes to the lead first too: it carries the task on or hands the stop to you, and the same stop again after a lead carried it on, since you last answered a loop stop, comes straight to you. Something outside the code (a rejected push, gh not signed in, a port someone holds), a closed PR, open E2E boxes, a branch on the remote and a dependency that will never be merged are never decided by a model: they always come to you.
Answer on the card. A question can also be copied as Markdown for someone outside Lonca to answer (Copy the question as Markdown). Lonca talks to its agents in English and to you in your language.
When Lonca hands you a question itself, the task's lead puts a few plain sentences on what is wrong and what you can do at the top of the card; the rest folds under Technical details (see The question card).
The Flow tab
A task opens on Flow, one column from top to bottom:
- The stage rail
- Setup, Plan, Implement, Test, Review, Gate, Publish and PR in one row: done stages checked, the current one marked, and a stage that waits on you in the attention colour (orange). A stage waits on you when it asks a question, when the task is stuck, and when you or a lead paused the task there; Pause all and load control colour nothing. Clicking a stage unfolds it: its runs with their outcome and a link to each result, and Open its session for a stage agent. The Gate stage adds Skip while it runs; the PR stage links the PR, with a button that copies its link. Setup unfolds its steps, with Try again on a failed one (see Worktrees and setup).
- The status line
- The stage, the round and the time in the stage, the queue position while the task waits for a slot, and the status: Queued, Running, Question, Task Lead is deciding or Workspace Lead is deciding, Stuck, Paused or Done. Then Pause…. A task you paused resumes from its paused card, one held by Pause all from Resume all; only load control’s pause has Resume here. Hover the line for the whole pipeline's time.
- Waiting on you
- Everything that needs you, in a fixed order: a question, the paused card, a countdown, a move proposal, a decision proposal, a Jira proposal, a note, then the task’s notifications, newest first. It takes no room when nothing waits. A notification or note you have seen for a few seconds goes away when you leave it (good news after eight seconds on screen), or with its OK; a question, a stuck task, a PR comment and a Jira proposal stay until you act.
- Pull request
- Once there is one: its panel and its review comments (see Pull requests, CI and comments).
- Folded sections
- Brief (see The hand-off brief; gone once the task is done), Tests (
12 runs · 1 failed, see Tests, the gate and jobs), Decisions (every decision of the task, by the core, by you or by a model, with its reason) and Setup, each with its summary on the fold. - Progress
- The newest line of the orchestration log,
pipeline/progress.mdin the task's context folder, and Open in Documents for the whole of it.
Save a report…, in the header's ⋯ menu, writes lonca-report.zip where you choose: Lonca’s database, log and config, the task’s files and the conversations of its agents and its leads, for troubleshooting. Your Jira token is not in it; look it over before you send it on.
Orchestration in the title bar
Orchestration is a chip in the title bar, not a row of the task list: Orchestration · 2 running · 1 asks. Its counts are the tasks with a stage at work and the tasks waiting on you (a question, a stuck task, a person's pause, a Jira proposal); under Pause all it adds paused. Hover it for its card: the counts with the queue, the machine's load (load average, CPU, memory, agents, tests) while load control is on, and new decisions. Click it to open the Orchestration view. The counts are every workspace's.
Beside it, the conversation button opens the current workspace's lead (⌘K with no task selected) where the plan has the leads, and Pause all (Resume all while it is on) stops and restarts everything. The bell after it lists every task's notifications (see Notifications).
A command the Workspace Lead suggests in its conversation has Copy and Run beside it. In the Orchestration view, Run runs it in the Terminal of the task the view was opened on, and brings that task back on screen (see Sessions and agents).
Pausing
- Pause…
- The task stops where it is, and asks What do you need to clarify? (optional). The paused card shows it back and asks What did you decide?; Resume adds that to the brief and carries on. For a Jira task, Pause offers to move the issue to its hold status and to post a comment, and Resume to move it back; each only when you tick it, and both start unticked. See Pausing a task.
- Take over
- In a stage agent’s terminal: pauses the pipeline and gives you the terminal; Hand back resumes it (see Sessions and agents).
- Skip the gate
- In the header’s ⋯ menu, or Skip in the unfolded Gate stage, while the task is at the gate: stops it and goes on to the PR without its commands or its E2E run. The PR says the gate was skipped.
- Pause all
- In the title bar: every task stops where it is, and nothing starts until Resume all. It holds across restarts.
- Archive
- Stops orchestration for the task and lets it go. The commits, branch and PR stay as they are; unarchived, the task can be handed off again (below).
There is no Take back since 11.0.0, and no prompt buttons: Pause, with its reason, stops a task for a while, and archiving lets the task go. An install that had orchestration switched off before 11.0.0 starts with Pause all on, once, and says so.
Handing a task off again
A task Lonca let go of (one you archived and unarchived, or one taken back before 11.0.0) can be handed off again, and the hand-off card offers to continue:
- the branch has not moved since → Continue from the step it stood at, without planning again;
- you committed on the branch meanwhile → it continues at implementation with the plan it has, and the implementer is told which commits are yours;
- uncommitted changes in the worktree, or let go of before there was a plan → no continue: it starts over. The files Lonca itself leaves in the worktree do not count as changes.
Start over always runs every step from the plan. Either way the stage agent terminals left from before are closed, so the new runs start fresh conversations; the orchestration log carries what they need.
What handing off approves
Handing a task off approves two things, and only for that task:
- Lonca’s commits in the task’s worktree. The implementer does not stop to ask; a repository rule asking for approval before a commit is already met.
- The push of the task’s branch, including the rebase onto its base and the push with a lease Lonca makes after it.
Any other force push, a push to another branch or a commit anywhere else still comes to you. So do anomalies at every autonomy level: sudo, a force push, secrets, deleting outside the worktree.
Dependencies and stacked tasks
- Without stacking, a task with dependencies stops before implementation until every dependency’s PR is merged, checked with
gh. - Where a dependency’s PR is looked for: in every repository of the task’s workspace. A key a task in Lonca owns is followed by that task’s worktree branch, and a branch by its name. A key no task in Lonca owns (work done outside it) is found by the PRs that name it as a whole word in their title or branch, such as
feature/CRGMS-22189-export;CRGMS-221890does not nameCRGMS-22189. Its work may span repositories, so one of those PRs still open keeps the wait even when another merged, and a closed PR alone never ends it. - Jira decides only when no PR names the key. With Jira connected, a key no task owns and no PR names, in any repository of the workspace, counts as merged once its issue is in a done status; the timeline says Jira decided. An open PR keeps the wait whatever Jira says.
- While no PR is found, the wait says where it looked: “Waiting for CRGMS-22189 to be merged · no PR found for CRGMS-22189 in app, lib”.
- Ending a wait yourself: on the Flow tab of a waiting task, each dependency has Count as merged and Stop waiting. Either ends the wait for that one only; the timeline records which you chose. Stop waiting on a dependency the task is stacked on asks about its commits, as below.
- A PR in a repository outside the workspace is not found: end that wait yourself. A key that appears only in a branch name, not in the title, is found only among each repository’s 100 latest PRs.
- Stacked (Start on top of it, offered with exactly one dependency; it needs a task with no worktree yet and the dependency’s branch pushed): the worktree starts from the dependency’s branch as it is on the remote; review, prompts and the gate see only the task’s own commits; before publishing, it moves only its own commits onto the base and publishes.
- A dependency that will never be merged ends the wait: every task of it archived or deleted with no PR open, or a PR closed unmerged on a branch no live task owns. An open PR keeps the wait, whatever happened to its task. A task not stacked on it drops it and goes on on the base as it is, without a question; the timeline says why, and the stage agents are told the plan cannot count on it. A stacked task asks you (A dependency will never be merged): Keep its commits in this PR, or Take its commits out, which sends the work back to the implementer to rework it on the base.
- A dependency the planner names is recorded and waited for before implementation, without a question, unless it would make tasks wait for each other: then it is skipped, and the timeline says why.
- A dependency is set with a fresh hand-off: continuing keeps the plan as it was.
- Tasks never wait for each other. A hand-off whose dependency would close a circle is refused with the reason, for example “SHOP-12 already waits for SHOP-14. SHOP-14 cannot wait for SHOP-12.” A circle that forms anyway (say, from older tasks) is noticed: the row says which tasks wait for each other, and the question Tasks wait for each other goes to the Workspace Lead; it comes to you when the leads may not take it (no workspace, leads off, autonomy that only assists, their budget spent) or the Workspace Lead does not answer in time. Each answer drops one wait (“SHOP-14 stops waiting for SHOP-12”); the task that stops waiting moves on.
Restarts and retries
- A restart picks up where it stopped. Notes, held decisions and retry counts are kept, and time Lonca was off does not count against a stage. A restart gives every running step a fresh time window. Quitting stops the jobs that were running: the stage agent that asked for one is told it will not report back, and a step Lonca ran itself starts again.
- A task record that cannot be read in full does not send the task back to the plan. Lonca keeps what it can read: the step, the round, the last pushed commit and the PR. The task waits for you with a question that says what was kept and what was lost (the round's findings, notes and progress). Answer to go on from that step; its next push still goes with a lease.
- Failures that may pass by themselves are tried again under consultant or autopilot: a push that did not reach the remote, a setup, publish or gate that could not finish, an app slow to answer. The first try is after 2 minutes, then each wait twice the last, up to 30 minutes, at most 5 times for the same failure. Then it waits for you. A failure that reads as the network or GitHub blinking gets one quick try after 20 seconds, under every autonomy level; past that, under assistant, the question is yours. A publish failure only you can fix (a sign-in, access, a remote not on GitHub, a rejected push) is not tried again: it comes to you at once.
- The same thing over and over is told once. When the same terminal prompt or failure comes a third time in a task, the task shows a notice and you get a notification; nothing waits on you.
- A paused task is not tried again until you resume it; a task handed off again gets its tries afresh.
Jira moves
Lonca moves the issue to the statuses you name, by name. Unset, the issue is not moved. A workspace can name its own targets, and null turns a global one off there. You can also move an issue yourself from the status chip in the task's header (see Moving the issue yourself).
orchestration:
jira:
on_start: In Progress # when a hand-off starts
on_pr: In Review # when the PR opens
on_merge: Done # when the PR is merged
on_pause: On Hold # offered on Pause, moved only when you tick itA move to on_pause, and any comment in Jira, happen only when you approve them, each time, with the exact words you approved. A lead that pauses or resumes a task because you asked may propose the move and a comment; the proposal waits on Flow with Approve and Dismiss, and you edit the comment before anything is posted. Several at once can go with Approve all. See Pausing a task.
Configuring it
The Configurator writes the block from your repositories. The keys you are most likely to change:
orchestration:
concurrency: 2 # tasks running a stage agent at the same time (1-8)
gate_concurrency: 1 # pre-PR gates at once, across all tasks (1-4)
resource_wait_minutes: 30 # how long a step waits for a busy port before it asks
block_on: minor # minor | blocking
max_rounds: 3
max_runs_per_task: 40
stage_timeout_minutes: { implementer: 60, ui_implementer: 90, test_runner: 120, default: 20, idle: 10 }
stage_agents:
planner: { model: opus }
implementer: { agent: claude-stage, model: sonnet }
test_scenario: { model: opus }
test_runner: { agent: claude-stage, model: sonnet }
final_check: { model: opus }
reviewer: { model: opus }- How many tasks run a stage agent at once is what
concurrencyand load control allow; with the key left out, 2, or 5 with load control on. Until plans are enforced everyone runs as Pro; once they are, Free runs one task and Standard three (see Plans). A task over the limit waits its turn in the queue. - The agent, model and effort of each stage agent are set in Settings → Orchestration (see Stage agents).
- The leads are the
workspace_lead:key of this block, andtask_lead:gives the task leads a model, effort or prompt of their own (see The leads). Before 12.0.0 the block wasorchestrator:and the keyadvisor:; the old names still load until 13.0. - Every key with its default is in the config.yaml reference.