Skip to content

feat(platform): let members create tasks and work their own - #3810

Merged
yannickmonney merged 18 commits into
mainfrom
feat/members-create-tasks
Sep 29, 2026
Merged

yannickmonney merged 18 commits into
mainfrom
feat/members-create-tasks

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

Summary

Customer feedback: teams want to hand document work to project agents, and Members could not, because every task write needed the Editor role. This PR implements the decision that Members may create tasks and work their own.

One rule decides it, in services/platform/backend/core/tasks/access.ts, a pure module the server enforces at every task door and the app imports as its client-side mirror:

  • Create: every member who can read the project, while it is active (team-restricted projects still need the team; archived projects stay read-only for everyone).
  • Work a task: an editor of the project (Editor role or higher) on every task, and any other reader on a task that is their own, meaning they created it (created_by = them, created_by_type = user) or they are its person assignee. On their own tasks a Member edits the fields and attachments, assigns (to themselves, another project member, an agent or an automation), starts, steers and stops the agent (including by @mention), moves the status and decides the review (moving to Done), sets or stops repeating, adds subtasks, marks the task as blocked, and archives or restores it.
  • Everything else stays with editors: other people's tasks are read-and-comment only (an @mention there stays a plain mention), and the label catalog, project settings, agents and files are unchanged.

Doors that now use the rule (assertTaskCreatable, assertTaskWorkable, the non-throwing mayWorkTask):

  • App routes and services (backend/domains/tasks/service.ts, routes.ts): create (a subtask also needs its parent to be workable), edit, status, board move, assign, archive, restore, delete (then still owner/admin), dependencies (judged on the blocked task), manual agent start, live-run cancel, workflow start and cancel, and the external-issue intake (create gate, work gate on the task a repeat reconciles, labels minted for editors only). The label catalog verbs use assertTaskLabelsEditable (editors only).
  • comments.ts: comment edit and delete; the owning-automation @mention trigger. service.ts: the agent @mention dispatcher (comment and description) and the composer's mention preview, which answers a new not_permitted reason.
  • repeat.ts: stop repeating.
  • REST v1 (backend/rest/v1-tasks.ts): intake (create for every reader of an active project; a repeat takes the work gate; labels minted for editors only, otherwise 400 TASK_LABEL_UNKNOWN), the archive toggle, the start, and the review relay (for the key holder and for the actor). Contract 3.6.0 with a contract-notes entry, OpenAPI descriptions updated, fingerprint and public/openapi.json regenerated.
  • Checked and left at Editor+ on purpose: connectors/task-store.ts (the issue-sync natives create and update many tasks by external reference, including other people's, so it is project-level sync) and automations/dispatch-store.ts (it gates automation runs in a project, not a task door).

Spend: agent runs a Member starts are booked under that Member through the existing project_agent_runs.started_by rule (verified, unchanged); budgets and the task_automation switch still apply.

UI (services/platform/app): useTaskAccess feeds the shared canWorkTask with the read's canEdit/canCreate flags (new on board and task reads) and the signed-in person. Create task shows for every reader of an active project; cards and rows get a per-task decision for drag and inline pickers; the task dialog and the task page are editable (Start agent, steer, stop, assignee, reviewer, status, Archive) only when the viewer may work the task. Comment edit/delete, dependencies and the mention chips follow the same rule; the label catalog, bound input files and project-file-writing subject templates stay editor-only.

Docs (EN/DE/FR): a new "Who can create and change tasks" section in the tasks guide, plus the role table, the Member overview (with a hand-off-to-an-agent walkthrough), project agents, task automation, skills, chat basics, the member quick start, the script guide and the REST reference. Manual boxes TASK-F48, TASK-F49, TASK-B25, TASK-B26 (tasks suite cost 90) and a row in the automation register.

Deviations from the brief, and why

  • Delete stays with owners and admins. The brief lists "delete a task they created" as something an Editor can do, but Editors cannot delete tasks today: deleteTask is owner/admin only because it retires the whole subtree with other people's comments, subtasks and files. Letting Members delete would give them more than Editors. Members (like Editors) archive and restore instead; the docs say so.
  • Subtasks and dependencies are judged on the task they change. Adding a subtask requires working the parent (an open subtask blocks the parent's close), and a dependency requires working the blocked task (the edge is its record). Without this, a Member could block other people's tasks.
  • The label catalog stays with editors, including through the intakes. The REST and app intakes used to mint missing labels for anyone; for a non-editor they now accept only existing labels (REST answers 400 TASK_LABEL_UNKNOWN, which moved from the app-only list into the REST registry).
  • The external-issue intake (POST /api/app/tasks/from-external-issue) was read-gated only. It created tasks in archived projects, reconciled any task its reference named (across projects under the organization-wide dedupe) and minted labels for every member. It now uses the create gate and the work gate like every other door.
  • Review requests route as before. Reviewers must be able to edit the project, so a Member who created the task is not sent the review request (it goes to the designated reviewer or the project creator). The Member follows the task as its creator, is belled when the agent moves it to In review, and can accept the result themselves. The docs say this.
  • Comment edit/delete now follows the work gate in the UI too. The server always required write access to edit or delete a comment; the UI used to offer Edit/Delete to a Member anyway. Now a Member edits and deletes their own comments on tasks they may work, and the doomed buttons are gone elsewhere.
  • Outputs: there is no human door that adds or removes deliverables; they come from the agent runs a Member can now start.

Findings outside this change (not fixed here)

  • docs/*/tutorials/member/use-projects.md says the Member role can create a project; the server requires Editor or higher (assertCanCreateProjects).
  • An agent equipped with workspace task tools (task_update_status, task_create, …) acts with that equipment whoever starts it, so a Member who starts such an agent directs tools an Editor granted. That is the existing "equipment is the grant" model; worth a product look.
  • The automation settings icon on automation-owned tasks is shown to readers, whose save the server refuses (pre-existing).

Checklist

  • bun run check passes (format, lint, typecheck, all tests). Not green on this machine, for reasons outside this PR: I ran it on the branch; the format check, every workspace's lint (0 warnings) and typecheck passed, and turbo stopped at @tale/sandbox-runtime-daemon#test, whose file-ops > stageFiles gives up on a stalled URL within its deadline and runnerd HTTP service > a partial exec request body already protects the runtime from release and reclaim fail the same way when that suite runs alone, although this PR touches nothing in that workspace. Two platform UI files (providers-settings, enterprise-sso-form) timed out under the parallel load and pass when rerun. The platform server and UI projects, which the gate cut short, were run whole on their own (see the test plan).
  • bun run lint:sast passes (Opengrep) — run on every changed TypeScript file (0 findings); the pre-commit hook ran it on each commit.
  • Translations updated in the affected messages/{en,de,fr}.yml catalogs — one new key, tasks.mentionPreview.notPermitted, in en, de and fr; no de-CH override needed (no ß).
  • Docs updated in docs/{en,de,fr}/ for any user-visible change.
  • README.md / README.de.md / README.fr.md updated — N/A: the READMEs do not describe roles or task permissions.

Test plan

What was run (all green):

  • Server tests that fail on main and pass here: backend/domains/tasks/service.member-work.test.ts (a Member creates a task, including straight at In progress for an agent with the run booked to them; is refused in an archived project and in a team project they cannot see; adds subtasks only under their own tasks; edits, moves to Done with the review approved in their name, starts the agent, assigns it, puts it to work with an @mention, archives; is refused on someone else's task and their mention stays plain; cannot delete; the mention preview answers not_permitted; editors unchanged), backend/domains/tasks/routes.intake-access.test.ts (the app intake's create gate, reconcile gate and label minting), backend/rest/v1-tasks.test.ts and v1-tasks.review.test.ts (member intake 201, repeat on someone else's task 403, own start and archive 200, review relay for a member on their own task, ACTOR_FORBIDDEN otherwise). backend/domains/tasks/service.test.ts now pins the new rule instead of "a read-only member can read but never write"; backend/core/tasks/access.test.ts pins the pure rule. Checked against main by checking out main's versions of the touched sources and running the new suites: 23 new server cases (13 service, 3 intake, 7 REST) and 6 new UI cases fail there.
  • Whole platform server project (bunx vitest --run --project server backend lib scripts): 880 files, 11,780 tests.
  • Whole platform UI project (bun run --filter @tale/platform test:ui): 515 files, 4,415 tests, including the new tasks-workspace.test.tsx (Create task and per-card decisions for a Member, an editor and an archived project) and task-modal.access.test.tsx (own task editable, someone else's read-only, label catalog controls editor-only). Browser tests for the touched components (tasks-list, task-modal, page-skeletons): 46 tests.
  • bunx tsc --noEmit -p . (platform), type-aware oxlint on every touched file, bunx knip --no-progress, oxfmt --check, the OpenAPI and error-code guards, the platform i18n suite, the docs suite (services/docs: 200 tests), bun run lint:manual, and check-guide.ts on the tasks and projects suites.

Not verified:

  • Nothing was observed in a running app: no stack was available (Docker down), so the UI was not driven in a browser and the manual boxes TASK-F48, TASK-F49, TASK-B25 and TASK-B26 were not run.
  • The real-Postgres proofs were not run: backend/integration-check.ts (labels updated) and backend/rest/project-scope-check.ts (now expects a member's intake to succeed and a start on someone else's task to stay refused) need bun run --filter @tale/platform backend:integration.
  • No real agent run: spend attribution is verified in code and unit tests (startedBy is the member), not on a ledger row.
  • The German and French docs were written natively but not reviewed by an independent native reader.
  • The REST contract is bumped to 3.6.0 over main's 3.5.0; if another PR bumps first, renumber at merge.

Reviewer spot checks: sign in as a Member, create a task on an org-wide project's board, assign a project agent, Start agent, then move the task to Done; open a task an Editor created and confirm it is read-only while commenting still works; try POST /api/v1/projects/{id}/tasks with a Member's key.

Customers asked to hand document work to project agents, and a Member
could not even create the task: every task write sat behind the Editor
role (assertTaskWritable over EDITOR_ROLES).

One rule now decides it, in backend/core/tasks/access.ts, a pure module
the app imports as well: every member who can read an active project
creates tasks in it; editors work every task; any other reader works the
tasks they created (created_by, created_by_type 'user') or are the person
assignee of. The service enforces it through assertTaskCreatable and
assertTaskWorkable at every task door: create (a subtask also needs its
parent to be workable), edit, status and the review decision, board
move, assign, archive and restore, the manual agent start, the live-run
cancel, the workflow start and cancel, repeat stop, dependencies (judged
on the blocked task, whose record the edge is), and comment edit and
delete. The @mention dispatchers use the non-throwing mayWorkTask, so a
member's mention on their own task puts the agent to work while one on
someone else's task stays a plain mention, and the composer preview says
so with a new not_permitted reason.

Everything around the tasks stays with editors: the label catalog
(assertTaskLabelsEditable), project settings, agents and files. Deleting
stays with owners and admins: a delete retires the whole subtree with
other people's comments and files, and editors cannot delete either, so
the task's own member archives it instead.

The external-issue intake was read-gated only: it created tasks in an
archived project, reconciled any task its reference named (across
projects under the organization-wide dedupe), and minted labels for
every member. It now checks the create gate first, the work gate for the
task a repeat reconciles, and mints labels for editors only.

Board and task reads answer canCreate beside canEdit, so the app decides
each task with the same function. Agent runs a member starts are booked
to that member, as the run-starter rule already did.
The /api/v1 task doors followed the same Editor-only rule the app did:
a Member's key answered 403 on the intake, the archive toggle, the
workflow start and the review relay.

They now apply the task rule too. The intake creates a task for every
key holder who can read an active project; a repeat reconciles the task
its reference names, so it takes that task's work gate. The archive
toggle, the start and the review relay (for the key holder and for the
member it acts for) take the work gate: an editor of the project, or the
member who created the task or is its person assignee; anyone else still
gets 403 RBAC_FORBIDDEN, ACTOR_FORBIDDEN for the actor. The intake of a
key holder who is not the project's editor creates no label: a name the
catalog lacks answers 400 TASK_LABEL_UNKNOWN, which moves from the
app-only list into the REST registry.

The contract moves to 3.6.0 with its notes, the OpenAPI descriptions
say who may do what, and the real-Postgres scope proof now expects a
member's intake to succeed while a start on someone else's task stays
refused. The repo contract's delete-over-REST ledger entry names the new
gate.
The board, the list, the task dialog and the task page decided every
control on the project's canEdit, so a Member saw no Create task and
could not change even a task they created.

One client mirror now decides it: useTaskAccess feeds the server's own
canWorkTask (backend/core/tasks/access.ts) the board or task read's
canEdit and canCreate flags and the signed-in person. The Tasks page
offers Create task to every reader of an active project; cards and list
rows take a canWorkTask decision for drag and the inline pickers; the
dialog and the page make a task editable, with Start agent, steer, stop,
the assignee and reviewer pickers, status and Archive, when the viewer
may work it, and read-only otherwise. Comment edit and delete follow the
same gate the server holds them to, dependencies offer only the tasks
the viewer may mark as blocked, and the mention chips say when an agent
won't respond because the task is someone else's (new
tasks.mentionPreview.notPermitted in en, de and fr).

The label catalog and project files stay with editors: the label picker
seeds defaults and offers Create only to them, Manage labels is theirs,
the bound folder's input files stay read-only for others, and subject
templates whose create writes project files (a folder input or required
settings) are offered to editors only.
Members may now create tasks in any project they can open and work the
tasks they created or are assigned to, including putting project agents
on them; the guides still said every task change needed the Editor role.

The tasks guide gains a "Who can create and change tasks" section (what
a Member can do on their own tasks, what stays with editors, why a
member archives rather than deletes, and that handing on a task assigned
to you hands on the right to change it). The role table, the Member
overview (with a short hand-off-to-an-agent walkthrough), the project
agent and task automation guides, the skills and chat pages, the member
quick start, the script guide and the REST reference (contract 3.6.0,
TASK_LABEL_UNKNOWN) say the same thing, in English, German and French.
A member creates a task in a project they can read (TASK-F48), puts a
project agent on it and closes it, with the run's spend counted on
their own usage (TASK-F49), cannot change someone else's task, where the
mention chip says the agent won't respond (TASK-B25), and cannot create
in a team project they cannot see (TASK-B26). The tasks suite's cost
moves to 90 boxes; the automation register names the unit, route and
component suites that own the rule; PROJ-B9 no longer calls the Member
role read-only.
The unit, route and component suites own the rule's server and app
halves; the running app, a real agent run and the bell stay with the
member boxes, so the register row reads partially automated and says so.
The parametrized case read "edits a task they is assigned to".
A project agent's tools, secrets and GitHub token answered to its session
binding alone, so a run a member started could change other people's
tasks, mint labels, sync issues, write project documents and read the
agent's secrets, and it shared the agent's workspace with the runs editors
start.

What a run may do now follows the person who started it
(domains/tasks/run-authority.ts). A run whose starter may not edit the
project is confined:

- The tool door reads the live run from the exec every task turn's token
  now names. The task tools act only on the run's own task and the
  subtasks under it, create subtasks only there and with existing labels,
  refuse external-ref syncs and document_create, and answer a
  member_run blocker that says what an editor would have to do.
- The turn host resolves no agent secrets and no brokered GitHub token for
  it, at launch and at a steer restart, and tells the agent which
  credentials were held back and why.
- It works in a workspace of its own per agent and member, chosen at kick,
  so nothing it leaves behind reaches a later editor's run and it never
  shares a container (or its processes' environment) with one. A run in a
  member's workspace stays confined whoever steers it later; everything
  else is judged against the starter's rights at the moment of asking.
- A steer that restarts a turn books the run to the person who steered it.

The session lookup finds a project agent's row by session id, and the
one-live-session cap counts per workspace; the release guard stays the
agent's, so a live turn holds every workspace the agent owns.
TASK_LABEL_UNKNOWN reaches the members who may create tasks but not grow
the project's label catalog, and the message told them to type the name
in the picker to create the label, which they cannot. It now asks for a
label the project already has and says who adds new ones, in English,
German and French.
Review findings on the member task rule, fixed at the server doors:

- Automations: a member could start almost any deployed automation on
  their task (app and REST start, a review's request for changes, both
  intakes), and it runs as itself — the organization's credentials, no
  approvals, in any project when unbound. A member now names only an
  automation built for tasks (its deployed version declares a task
  contract) or the one that owns the task; the same rule holds when a
  member assigns a task to an automation, which would otherwise make it
  the owner. The task natives a member's run reaches (task.upsert,
  upsert_issues, list_external_issues) apply the starter's own task
  rights instead of refusing everyone but editors halfway through a run.
- The live run's starter may stop and steer it, even once the task is no
  longer theirs (an @mention hands an assigned task to the agent).
- Stop repeating reaches only the task named and the later copies the
  caller may work; the copies before it keep what they say.
- Work rights run down the subtask tree, so subtasks an agent or an editor
  adds under a member's task never keep it from closing.
- A comment's author edits and deletes it with the read access posting it
  took; an admin still moderates anyone's.
- The app's workflow start judges the task in the transaction that starts
  the run and refuses an archived task, as REST does.
- Picking a subject someone else created opens that task instead of
  answering 403.
- The review gate's comment separates who is sent a review (editors) from
  who may decide it (whoever may work the task, under the review policy).

The REST contract stays at 3.6.0; its notes and the OpenAPI descriptions
name the automation rule.
The app mirrors the server's task rule, so its controls follow the review
fixes:

- Work rights run down the subtask tree: the board looks a subtask's
  parents up among its loaded cards, and the task sheet gets the owners
  up the tree with the task read (`ancestors`).
- The run card offers Stop to the person who started the live run, even
  on a task no longer theirs; the card read now names the run's starter.
- A comment's author edits and deletes it wherever they can comment; an
  admin's delete of someone else's still needs the task's work gate.
- The Blocks group follows the task it marks: on someone else's task a
  member may record that it blocks one of their own.
Knip flagged four helpers exported for no caller outside their module: the automation-for-tasks checks, the starter's edit check and the subtask-tree read. Only their callers' seams stay exported.
The org-data find tools (contact, product, website and knowledge-entry finds) ask the same session door as the task tools but did not pass the run the turn's token names. A run in a member's workspace then read as a run that had ended and lost the reads it keeps: the door answers for a live run only, so every tool that asks it names the run.
…he task

A steer that reaches a run which settled meanwhile becomes a fresh mention run. The live run's starter may steer it on a task that is no longer theirs, but a new run is a change to the task, so the fallback now kicks only for an author who may work it; the comment stays in the discussion otherwise.
Members' runs keep to their task, run without the agent's secrets or GitHub token in a workspace of their own, and can be stopped and steered by the member who started them; the task, automation and agent pages say so in English, German and French.
The member tutorial walked a Member through creating a project, uploading its files and saving its instructions, all of which need the Editor role. It now says so and sends a Member to the chat step.
…asks

# Conflicts:
#	docs/de/platform/chat/basics.md
#	docs/en/platform/chat/basics.md
#	docs/fr/platform/chat/basics.md
#	services/platform/backend/core/node_only/sandbox/workspace_tools_bridge.ts
#	services/platform/backend/core/tasks/agent_run_host.ts
#	services/platform/backend/domains/sandbox/dispatch-routes.ts
#	services/platform/backend/domains/sandbox/sessions.ts
#	services/platform/tests/manual/reference/automation.md
#	services/platform/tests/manual/suites/tasks.md
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