Skip to content

feat(platform): let a project's dispatch work other projects' boards - #5001

Merged
yannickmonney merged 20 commits into
mainfrom
feat/dispatch-across-projects
Oct 15, 2026
Merged

yannickmonney merged 20 commits into
mainfrom
feat/dispatch-across-projects

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What

A project's dispatch can now serve the boards of other projects of the same organization. The use case: owner projects (one per product or client) receive intake on their own boards, and one central Development project's pool ("Coder", up to 256 workers) and its Reviewer work all of those boards.

  • Schema (@tale/shared/schemas/project-dispatch): optional sources: [{projectId, statuses?, labels?{include, exclude}}] (at most 20, each project once, never the dispatch's own) and reviewers: [agentId] (at most 10, agents of the project granted task_review). A dispatch without either reads, hashes and behaves as before; the managed-configuration hash test holds this.
  • Authority: adding or changing a source needs the right to edit that project, besides administering the dispatch's project. This holds in the app, the settings tools (MCP/REST), managed configuration and POST …/dispatch/by-project/{id}/configuration/check, so a refused cross-project dispatch stops the whole declaration before anything is written. A source kept exactly as stored is not checked again, and a save that only switches the dispatch off is never refused for what it names (TASK-R70). Every pass, start and tool call judges each source again on the right of whoever last saved the dispatch. A source that is missing, archived or no longer editable is skipped (source_missing / source_archived / source_no_authority in the pass, skipped in the readback), and no other person's right is used in its place. A save by another writer re-anchors the dispatch to that person's right, even if the document is unchanged; the editor, the settings tools and the CLI offer that save when it would serve a skipped board again (TASK-R72).
  • One reach check (backend/domains/tasks/dispatch-reach.ts). The agent's home project's dispatch must list the task's project and still reach it, and the agent must be in that dispatch's pool, its standing roles or its reviewers. Everything that lets an agent near a task uses this check: assignment (assertAssigneeValid), lockAgentForStart (so run-start and delegated-start), kickAgentRun (every start), the task-tool scope (task_find/get/comment/update_status/update_metadata/review/delegate_review; no creates and no task_start_agent on a served board), and review eligibility and routing. Independence rules are unchanged: a reviewer never reviews its own work.
  • Who a run answers to — the trust model (TASK-R79, TASK-R82):
    • A run the dispatch started (a pass or a standing role) on a served board acts for whoever last saved the dispatch, on whose right to edit that board the dispatch serves it. It keeps the agent's full equipment and its own project's task, document and knowledge scope, and reaches every board the dispatch serves. So whoever can put a ready task on a served board writes the brief of such a run; the docs tell admins to serve only boards whose people they would let brief their agents.
    • A run a person or an API key started on a served board (Start agent, a comment that wakes the agent, a move to In progress, a retry, or a start one of their runs hands on) gets the agent's secrets, brokered credentials and standing workspace only while that person may edit both projects and the dispatch still reaches the board. Anyone else's run is confined to its task in a workspace of its own. Either way it reads only what that person may read: if they cannot read the agent's own project, task_find, task_get, document_find and rag_search/rag_fetch leave that project out (ownProjectExcluded, runProjectScope in run-authority.ts). Its task tools reach the other served boards only as far as that person may edit them. A run a schedule began reads the agent's project only while the schedule may act there.
    • A switched-off dispatch serves nothing (TASK-R81): no board offers its agents, nothing starts them on another board, their runs there act for nobody (task tools and knowledge alike), and it routes no review.
  • Runs: a run on a source task belongs to that task (its project, board, history and audience) and records its agent's home project (migration 0216_agent_run_home_project.sql, nullable agent_project_id). Occupancy, perAgentConcurrency and maxConcurrentRuns count an agent's runs on every board. A run that ends asks for a pass of both projects' dispatches. The turn gets both projects' instructions with an explicit precedence: the board's project decides its board's conventions, and the agent's own project decides how the agent works. Both digests are recorded.
  • Candidates: own statuses and labels plus each source's; one global order (column by its board's preference, priority, rank, age) across all boards; the pass reads at most CANDIDATES_PER_PASS (500) across all of them. Gates govern by label name across every served board.
  • Readback/UI: the Dispatch page lists Boards it serves (name, served or skipped and why, columns, labels) and Reviewers, and names the board of a run on another board. A served project's Dispatch tab says "Served by 's dispatch" with a link, even when that project has no dispatch of its own. GET /api/app/tasks/dispatch/by-project/{id}/serving-agents lets a served board name those agents and offer them as assignees and reviewers ("From 's dispatch"); mentions still reach only the project's own agents. Another project, and the runs on its board, are named only to a reader who may read it. A reader who may not read a served board also does not see the labels that select its work, and a gate shows only labels of projects they read (a gate left with none is not shown). This holds in the Dispatch readback, GET /api/v1/projects/{id}/dispatch, the managed-configuration readback and the settings tools. Whoever may administer the dispatch reads it whole, because a save writes it back under its hash (TASK-R80).
  • Contract 3.48.0 (additive; main is at 3.47.0): sources, reviewers, servedBy and each listed run's projectId on GET /api/v1/projects/{id}/dispatch, with name: null for a project the caller may not read. public/openapi.json, both contract fingerprints and the MCP skill snapshot are regenerated.
  • Spec TASK-R70–TASK-R76, TASK-R79–TASK-R82 in domains/tasks/spec.md (main holds R61–R69 and R77/R78); PROJ-R12/PROJ-R16 updated for agent deletion. Docs in EN/DE/FR: dispatch, project agents, task automation (reviews), API reference, settings tools. Messages in EN/DE/FR (+ de-CH where it overrides). Manual boxes PROJ-F71–PROJ-F73, PROJ-B25–PROJ-B29, and an automation row for the review fixes.

Also fixed on this branch: an assignment can outlive the dispatch's reach. Until now only the dispatch's own pass and delegated starts judged reach, so Start agent, a move to In progress, a late comment's run or an automatic retry could still start the agent on a board its tools could no longer touch. kickAgentRun now refuses such an agent before writing anything (AGENT_NOT_ALLOWED_IN_PROJECT). Start agent answers agent_out_of_reach before the card moves (worded in EN/DE/FR). The status move still happens but starts no run. The late comment answers with a refusal. The retry is retired and its watchers are told.

Review fixes

An independent review found one blocker, three major and three minor issues. All are fixed, each with tests:

  1. Blocker: a person's run was judged only against the served board. Someone who edits only Billing got the Coder's standing workspace, secrets and credentials, and task tools across every served board. run-authority.ts now judges a run of another project's agent by both projects and by current reach (runStarterMayActWithAgent), and limits a person-started run's tool scope to the boards its starter may edit (runReachedProjects). Every door goes through it: Start agent, comment wake, move to In progress, automatic retry and delegated start all kick through kickAgentRun → sessionIdForAgentRun; the launch (agent-turn-shim) and every tool call (shim.ts) use isTaskRunConfined; the worker claim re-chooses the family. A project's own API key now edits only its own project in this judgement (edit-right.ts). Unit tests (run-authority.test.ts, agent-runs.test.ts, shim.dispatch-reach.test.ts, edit-right.test.ts) fail with the fix removed (10 failures checked); the Postgres lane covers Bea (Billing only), Dan (Development only) and an editor of both.
  2. Readback leaked task titles and project names across audiences. Runs on a board the reader may not read are counted, not listed; sources, servedBy and serving agents' projects answer name: null; the UI reads "A project you cannot open" / "From another project's dispatch" (TASK-R80).
  3. Deleting a dispatch agent left it assigned on served boards. Deleting an agent or its project now clears its assignments on every board of the organization, writes each task's assignee.changed in that task's own project and hints every affected board (PROJ-R12, PROJ-R16).
  4. The app's save was refused once a served board was archived or beyond the admin's right, switching off included. Kept sources are not re-checked and a switch-off-only save is never refused; only added or changed sources need the right (TASK-R70). Unit, settings-tools and Postgres-lane tests archive a source and then switch the dispatch off.
  5. The "save again to serve it again" remedy was unreachable. The configuration readback answers servesAgain when the caller's save would serve a board skipped for no_authority; the editor then shows a notice and enables Save unchanged, the settings tools plan the same document as a change, and tale config apply treats it as drift and saves it (TASK-R72).
  6. A served board without its own agents stopped offering the standard agent. The picker judges "no agents" from the project's own agents and counts the serving agents' query as loading.
  7. Connector task listings named a served board's agent assignee as null. The join is by agent id and organization.

Review fixes, round 2

An independent re-review of 97d4020a44 left two blockers and one minor finding. All three are fixed, each with tests:

  1. Blocker: CI red (Unit, platform 2/2). The fake SQL in backend/jobs/task-list.agent-retry.test.ts did not answer readAgentHome, so the retry path read the agent as another project's and asked project_dispatch, which the fake did not answer. The fake now answers with the agent's own project (ef4fcba69a). The whole platform server project now passes: 1471 files and 22853 tests (2 files and 19 tests skipped). No other fake fails this way.
  2. Blocker: a confined run still read the serving project. The trust model above is now implemented and documented: (a) a dispatch-started run keeps the agent's project scope and acts for the dispatch's last writer; (b) a person's run on a served board reads only the projects that person may read (memberReadableProjects in edit-right.ts, runProjectScope in run-authority.ts, ownProjectExcluded in shim.ts → resolveTargetProject/loadTaskInScope in workspace_domain_tools.ts, and resolveKnowledgeToolAccess now judges the task run its token names: an ended or revoked run reads no knowledge, and a run whose starter may not read the agent's project gets only the organization's shared knowledge); (c) enabled gates reach, so a switched-off dispatch serves nothing (984a2343a5). Tests fail without each part: Bea, who cannot read Development (run-authority.test.ts, shim.dispatch-reach.test.ts, workspace_tools_bridge.test.ts, and the Postgres lane's Bea/Dan/owner/dispatch scopes); the switched-off dispatch (dispatch-reach.test.ts, reviews.dispatch.test.ts, and the lane switching off and on); and the dispatch-started run. Spec TASK-R81 and TASK-R82, docs (EN/DE/FR) and manual boxes PROJ-B28 and PROJ-B29 are added.
  3. Minor: the readback leaked a hidden board's label names. readDispatchAsReader (in dispatch-readback.ts) withholds a hidden source's labels, and the gate labels that name only labels of hidden boards. It applies to the status readback and to the configuration readback (dispatch-config.ts). The Dispatch page shows "—" for those labels, not "Every ready task". Tests: dispatch-readback.test.ts and project-dispatch-tab.test.tsx.

Why

Before this change a dispatch was single-project. Its candidates, pool and roles had to belong to the project, an agent belonged to exactly one project, starts and task tools required agent and task in the same project, and review routing was same-project. So the fleet's central pool could not work the intake boards.

Deviations from the brief

  • The app's dispatch editor shows sources and reviewers and keeps them on save, but does not edit them; managed configuration and the settings tools do. The spec lists this under Not yet.
  • Review batches stay on the manager's own project, and an agent starts no other agent on a served board. Both are listed under the spec's Not yet.
  • Undecided: whether a served board's administrators may refuse being served (today: remove the writer's right or archive the project).

How tested

Round 1 on 97d4020a44; round 2 on the final tree (77c0f8e6a0, on origin/main 5ddb7e1457; main has not moved, contract stays 3.48.0):

  • oxfmt check on every changed file; type-aware oxlint on the changed files of @tale/platform, @tale/shared and @tale/cli; tsc --noEmit for all three: green. knip --workspace services/platform reports only three unused exports in files this branch does not touch.
  • Round 2: the whole platform server vitest project, 1471 files and 22853 tests, green (2 files and 19 tests skipped). Platform UI project for all of app/features: 701 files and 7782 tests. One test in automations/.../version-compare-page.test.tsx timed out at 5 s under load (load average about 36). This branch does not touch that file, and it passes when rerun alone (11/11). tsc --noEmit for platform (8 GiB heap), shared and cli: green. Type-aware oxlint on the 80 changed platform files and on the changed shared files: green. The CLI's own oxlint on its changed files: green. oxfmt on every changed file: green. @tale/shared: 55 files and 1038 tests, green. @tale/cli config tests: 324, green. lint:manual, lint:links and the domain-spec guard: green. knip --workspace services/platform reports only the same three unused exports in files this branch does not touch.
  • Round 1: platform server tests for backend/domains/{tasks,projects,sandbox,connectors}, backend/rest, tests/guards (domain specs included), lib/mcp, scripts/openapi and lib/i18n: 259 files and 5001 tests, green.
  • Platform UI tests for app/features/{projects,tasks} and the dispatch adapter: 115 files, 1157 tests, green. @tale/shared: 55 files, 1038 tests, green. @tale/cli config tests: 324 tests, green.
  • lint:manual and lint:links green. check-guide on the projects suite reports only tasks.detail.comments, which is already on main; the tasks suite is clean.
  • Not run locally: backend:integration, which needs a Postgres from the tale-db image (no tale-db on this host). Round 2 adds two checks to the lane: the read scopes of Bea, Dan, the owner and the dispatch, and switching off and on again. Neither has run on Postgres yet; the reviewer's local 14/14 run predates them. The lane checkDispatchAcrossProjects covers authority at save, one order across boards, run ownership and home project, occupancy across boards, both instructions, assign/lock across projects, review routing, served-by and serving agents, skipping on a lost right and on archive, the Start agent refusal after reach is lost, person-started runs by editors of one or both projects, readback names for a reader outside a source's team, re-serving on an unchanged save, switching off with an archived source, and agent deletion across boards. It runs in the merge queue's Backend integration check.

Upgrade facts

  • Migration 0216 adds a nullable column; the previous image writes NULL and readers coalesce it to the run's project.
  • While a deployment rolls, the previous image reads a dispatch saved with sources or reviewers as one saved by a newer version (its schema is strict). It shows it as such and makes no pass for it until the new image serves. Dispatches without the new fields are unaffected.
  • Declaring sources/reviewers through managed configuration needs a CLI at this version. The declaring key needs the right to edit every source it adds or changes; the CLI's pre-apply check names the refused path.
  • A save of a dispatch with sources by someone other than its last writer counts as a change (it re-anchors the authority), so a plan by another key shows that dispatch as changed. A plan by a key whose save would serve a board skipped for no_authority shows the unchanged dispatch as an update and saves it.
  • A run that a person or key starts on a board another project's dispatch serves is confined (own task, own workspace, no agent secrets) unless the starter edits both projects. A project's own API key now counts as an editor of its own project only when this is judged.
  • GET /api/v1/projects/{id}/dispatch may answer name: null for a source or serving dispatch, and count runs it does not list, for a caller who cannot read that project. For a caller who also may not administer the dispatch, that source's labels is null, the source is absent from config.sources[].labels, gate labels only on hidden boards are dropped, a gate left with none is omitted, and hash is the hash of what the caller reads. Contract shape unchanged.
  • A person's run on a served board whose starter cannot read the agent's own project no longer finds or reads that project's tasks, documents or project knowledge. A project agent's knowledge tools now answer run_ended/schedule_revoked for a task run that ended or may no longer act, as its task tools already did.
  • A switched-off dispatch serves no board. Its agents stop being offered there, starts there are refused with agent_out_of_reach, and its reviewers stop receiving routed reviews.

Not done

  • Editing sources and reviewers in the app's dispatch editor (see above).
  • backend:integration not run locally (see How tested), including the two lane checks added in round 2.
  • A project-scoped admin API key of the dispatch's project, which may administer the dispatch without reading a source, still reads that source's labels: withholding them would break its hash-checked save.
  • No .github/release-notes file (the release session prepares them); the facts above are for it.

Base automatically changed from feat/dispatch-fleet-scale to main October 15, 2026 13:29
A dispatch names other projects' boards as sources (TASK-R70 to R76):
its pool takes their ready work in one order with its own, its agents,
standing roles' agents and reviewers are assigned to, started on and
work those boards' tasks while the dispatch reaches them, its reviewers
review its pool's work there, a run there follows both projects'
instructions and records the agent's own project, and a board says
which dispatches serve it. Each source is judged at every use on the
right of whoever last saved the dispatch, and skipped with why when it
is gone, archived or that right is lost. Published in the dispatch
readback, the settings tools and managed configuration.
A run of another project's agent on a board that project's dispatch
serves was judged on the board's project alone, so someone who edits
only the served board got the agent's standing workspace, its secrets
and brokered credentials, and task tools across every board the
dispatch serves. Such a run now gets the agent's full equipment only
while its starter may act in both projects and the agent still reaches
the board; anyone else's run is confined to its task in a workspace of
its own. A run's task tools reach only the served boards its starter may
act in, besides its own task's; a run the dispatch started keeps the
dispatch's whole reach. Stated as TASK-R79.
…its readers

Everyone who reads a project reads its dispatch, and the readback listed
its agents' runs on every board it serves with their task titles and
numbers, the served projects' names, and the serving projects' names in
the other direction. A run on a board the reader may not read is now
counted and not listed, and a source, a serving dispatch or a serving
agent's project the reader may not read answers name null; the Dispatch
page reads "A project you cannot open" and links nothing. Stated as
TASK-R80.
The assignee picker read "this project has no agents" from every agent
it lists, and those now include the agents other projects' dispatches
put on the board. A served board without agents of its own therefore
stopped offering the organization's standard agent and the Create agent
row. The picker now judges that from the project's own agents, counts
the agents as loading until the serving agents are read too, and names
a serving project the viewer may not read as "another project's
dispatch".
…rved

Deleting a project agent cleared its assignments on its own project's
board only, so a task its dispatch had handed it on a served board kept
pointing at an agent that no longer exists: the board showed the raw id
and a retry started an agent that cannot exist. The delete now clears
the agent from every board of the organization, records each task's
assignee.changed line in that task's own project, and hints every board
that lost it. Deleting a project does the same for its agents, and stops
their live runs on the boards its dispatch served (PROJ-R12, PROJ-R16).
The connector task listing joined the assignee agent on the task's own
project, so a served board's task assigned to an agent of the serving
project listed its assignee without a name. It now joins the agent by
its id in the organization, as the board's actor catalog does.
…Postgres

The dispatch-across-projects lane now judges people who edit only one of
the two projects: Bea, who edits Billing alone, starts the Coder on a
Billing task and gets a confined run in a workspace of her own, Dan, who
edits Development alone, would too, and the owner's run takes the
standing workspace (TASK-R79). Dan, outside Billing's team, reads
Development's dispatch with the Coder's Billing runs counted, not
listed, and Billing unnamed; Bea is not told whose dispatch serves her
board (TASK-R80). Deleting the Coder at the end clears it from the
Billing cards it held, with Billing's own history lines (PROJ-R12).
…dits

memberEditableProjects read only the caller's teams, so a project's own API key with the Editor role counted as an editor of every project its role reached. A run it started on a served board could then pass as started by an editor of both projects. The edit right now honours the key's project scope, as the acting audience already does elsewhere.
A dispatch serves another board on the right of whoever saved it last. Once that person lost the right, an unchanged declaration converged, so apply never saved it again and the board stayed skipped. The readback's servesAgain now counts as drift, and the apply saves the same document on the caller's right (TASK-R72).
…edit both

kickAgentRun is the door every person-started run passes through without a chosen workspace: Start agent, a comment, a move to In progress, their run's retry and a delegated start. Bea, who edits only Billing, and Dan, who edits only Development, get member workspaces; Ada, who edits both, gets the standing one (TASK-R79).
…s is lost

The app's editor sends the stored sources back with every save, and the save refused any source that was archived, deleted or beyond the writer's right. Once a served board was archived, or a project admin lacked edit rights on one, every save was refused, switching the dispatch off included. A source kept exactly as stored is no longer checked again, since every use judges it on the last saver's right, and a save that only switches the dispatch off is never refused (TASK-R70).

The documented remedy for a board skipped for want of authority, saving the dispatch again even unchanged, could not be reached: the editor enabled Save only when dirty, and the settings tools read an unchanged document as converged. The configuration readback now says servesAgain when the caller's save would serve such a board again; the editor then offers Save unchanged with a notice, and the settings tools treat the same document as a change (TASK-R72).
Main shipped 3.47.0, so this change takes 3.48.0: the history paragraph now states which source changes a save checks, the switch-off and serve-again rules and how a person's run reaches served boards. The OpenAPI document, both contract fingerprints, the MCP skill snapshot and the API reference's 'since contract' sentence follow, and the reference names the null project names a reader outside a project receives.
The dispatch readback built four rows by spreading inside map callbacks, which the type-aware lint refuses (oxc/no-map-spread). One helper now keeps a row's project name for a reader who may read that project and nulls it for anyone else. The lane's switch-off check and a test helper's typing follow the same lint and the typecheck.
The domain-specs guard holds a rule's heading to 80 characters; the card's body keeps the rest.
…odule

runStarterActingProjects and runStarterMayActWithAgent are used only inside run-authority.ts; knip refuses them as unused exports.
@yannickmonney
yannickmonney force-pushed the feat/dispatch-across-projects branch from 025a022 to 97d4020 Compare October 15, 2026 15:02
A run a person started, woke, moved, retried or handed on, on a board another project's dispatch serves, now finds and reads tasks, documents and knowledge only of the projects that person may read: the agent's own project drops out of task_find, task_get, document_find and rag_search/rag_fetch when they may not read it. A run the dispatch started keeps the agent's project and every board it serves, acting for whoever last saved the dispatch (TASK-R82).
A reader who may not read a board a dispatch serves no longer reads the labels that select its work, in the Dispatch page's readback, the REST readback, managed configuration and the settings tools; a gate shows only labels of projects they read, and a gate left with none is not shown. Whoever may administer the dispatch reads it whole, since a save writes it back (TASK-R80).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant