Skip to content

Improvement: let agents label an existing task #4990

Closed

Description

@yannickmonney

Summary

An agent can set a label only when it creates a task. It cannot add or remove a label on an existing task, so work an agent should route by label — a dispatch gate's labels, a dispatch's label filters — can only be labelled by a person.

What the repo says today (main 56c44e3)

  • The agent tool that changes an existing task's fields is task_update_metadata; it accepts {taskId, priority?, agentId?, expected: {priority?, assignee?}} and refuses any other field (services/platform/backend/core/node_only/sandbox/workspace_domain_tools.ts:1658-1690, the refusal text at :1684).
  • A project dispatch's gates hold the ready work carrying their labels, and its label filters narrow ready work by label (TASK-R51, TASK-R41; packages/shared/src/schemas/project-dispatch.ts).

What was observed

Preparing Tale's own fleet for native dispatch, a ci gate holds the work labelled optional-ci while the CI queue is full. The fleet's manager agent decides which work produces optional CI, but it cannot put the label on an imported or existing task; only tasks it creates can carry it, so the gate governs less than the policy intends unless a person labels the rest.

Not examined: whether other agent tools (automation steps such as task.upsert) can set labels on an existing task.

Constraints

  • Labels are project-scoped; a label an agent sets must exist in the project (dispatch refuses unknown labels, TASK-R48).
  • Agent writes go through the same permission checks as people's (a run a Member started keeps to its task).
  • Changing a label can change what dispatch starts next; the compare-and-set style of task_update_metadata (expected) exists to keep concurrent agents from overwriting each other.

Options

  1. Let task_update_metadata add and remove labels, with the current labels in expected.
  2. A separate agent tool for labels (task_set_labels), with its own compare-and-set.
  3. Keep labels people-only and let gates and filters match something agents can set (a priority band, a field).

Questions

  • Should an agent be able to remove a label a person set?
  • Should label changes by agents show in the task's timeline like other agent edits?

Activity

  1. added
    agent-ready
    on Oct 29, 2026
  2. tale-review-bot commented on Oct 31, 2026

    @tale-review-bot
    Collaborator

    Decision: an agent may add and remove labels on an existing task through a label tool of its own, and only for the labels an admin names in that agent's grant. Every such change shows in the task's timeline, with the agent as its actor.

    The question. May an agent change the labels of an existing task? If so: which labels, may it remove a label a person set, and do its changes show in the timeline? (TALE-203, tale#4990)

    What the code does today (tale-project/tale main df6105cef08a78084439c029d5917611c4adcf54)

    • A task's labels are a plain list of ids on its row (services/platform/backend/db/migrations/0009_tasks.sql:32). Nothing records who put a label on a task.
    • No label is protected. A label pauses or routes work only where the project's dispatch names it in a filter or a gate (packages/shared/src/schemas/project-dispatch.ts:103-107, :193-214; services/platform/backend/domains/tasks/dispatch-pass.ts:402-404). So whoever may remove hold or needs-human may restart work a person paused.
    • An agent tool is allowed by its grant on the project agent, and "the grant itself IS the standing authorization" (packages/shared/src/agent-tool-grants.ts).
    • task_update_metadata changes priority and owner with a compare-and-set (services/platform/backend/domains/tasks/agent-metadata.ts:65-82). It writes the timeline and the audit with the agent as actor (services/platform/backend/domains/tasks/service.ts:2113-2134).
    • One agent path already changes the labels of an existing task. task_upsert_by_external_ref replaces the list and creates names the project lacks (services/platform/backend/domains/tasks/external-ref.ts:451-460, :565-569). The timeline records nothing of it (:607-615, :638-645). That is filed as tale#5216, below.

    Options weighed

    1. Labels in task_update_metadata. Every agent that holds that grant today, for priority or owner, could change every label after an upgrade, hold and needs-human included, without an admin granting it.
    2. A label tool of its own. It costs one more grant to tick. Which labels the tool may touch stays open unless the grant names them.
    3. Labels stay people-only, and gates match something else. Gates and filters are built on labels (TASK-R41, TASK-R51). This adds a second way to route work for the same outcome.

    Decided: option 2, scoped to named labels. It widens what agents may do, so it takes the narrowest form:

    • Off until an admin acts. The new tool has its own grant in the agent tool catalog and is limited to project agents, like task_update_metadata. No existing grant includes it, so nothing changes on upgrade.
    • Only named labels. The admin who grants the tool names the project labels this agent may add and remove. It touches no other label. A label not named stays with people, whoever set it on the task: hold, needs-human, or any label used to pause work. This answers the issue's first question: an agent removes a label a person set only when an admin named that label in its grant. A rule based on who set each label would need new data on every task, and would still let one agent remove a pausing label that another agent set.
    • Existing labels only. The tool never creates a label, and an unknown name is refused, as it is for a person's edit.
    • Compare-and-set. The call carries the task's whole current label list as expected. A mismatch is refused with the existing stale-metadata error.
    • The same checks as today.
      • It refuses a run a member started, as task_update_metadata does (services/platform/backend/core/node_only/sandbox/workspace_domain_tools.ts:1740-1743).
      • It passes the checks a person's label edit passes (assertTaskWorkable, service.ts:427-450).
    • Recorded. Every change writes labels.changed to the timeline with the agent as actor. It also writes an audit row marked as an agent's, as a priority change does today (service.ts:2113-2134). This answers the issue's second question: yes.

    Done means

    • An agent whose grant names optional-ci can add and remove optional-ci on an existing task of its project. The timeline shows the change and the agent.
    • That agent is refused:
      • for a label its grant does not name;
      • for an unknown label;
      • for a stale expected;
      • in a run a member started.
    • An agent without the grant does not have the tool.
    • In the project-agent dialog an admin ticks the tool and picks its labels, with strings in en, de and fr. Where the docs list agent tools, they name it.
    • Tests:
      • tool tests for each refusal, and for the success path with its timeline and audit rows;
      • a grant-catalog test;
      • a dialog test for picking labels;
      • manual-suite boxes next to TASK-F62 (services/platform/tests/manual/suites/tasks.md:782).
    • Choices left to the Coder:
      • the tool's name (the issue's task_set_labels is fine);
      • its arguments: add/remove, or the whole list;
      • where the grant stores its labels;
      • whether the dialog warns when a picked label is one the dispatch uses to pause or gate work.
    • The squash message ends with Closes #4990.

    Line: feature

    Priority p3: an improvement without a priority: label.

    Filed: tale#5216, the external-ref path's missing timeline entry (agent-ready, Line: stable). It is the part of #4990's second question that is a fix of what main ships.

    What would change this decision: people who run a Tale fleet answering that agents need to manage every label of a project. The grant could then take "all labels" as an explicit choice, still off by default.

    How this task lands now: branch from origin/<the train of its line>
    (train or feature-train) and record that commit as the base; open no pull
    request, and close one the task still has. Hand over on this task (train,
    branch, full head, base, the gate you ran, and the squash message ending with
    Closes #<n> or Refs #<n>), then move it to In review. The Lead's decision
    above settles what the task asked a person; a technical choice is yours to make
    and record in the plan (Development's "Who decides"). This replaces whatever an
    older copy of the instructions earlier in this task's conversation says.

  3. added
    feat
    and removed
    improvement
    on Oct 31, 2026
  4. tale-review-bot commented on Oct 31, 2026

    @tale-review-bot
    Collaborator

    Kind corrected (Lead, TALE-203, run of 2026-10-31 18:00 UTC): #4990 now carries feat instead of improvement.

    • Why. The change decided on TALE-203 adds a capability Tale does not have: an agent changes the labels of an existing task through a label tool of its own, only for the labels its grant names. That is feat ("add a capability Tale does not have"), not improvement ("improve what works").
    • How it was missed. The Lead's decision (the 2026-10-31 14:30 UTC run) left the issue's kind as it was. Triage found the same miss on Improvement: let admins see and end every API key that works in their organization, members' personal keys included #5045 (TALE-224), so this run checked the Lead's other decisions of the day.
    • What stays. The decision, p3 and its line. The squashed commit's type is feat.
  5. tale-code-bot commented on Nov 2, 2026

    @tale-code-bot
    Collaborator

    TALE-203 implements this as the Lead decided: a new project-agent tool task_set_labels, off by default, that adds and removes only the labels an admin grants that agent in the project-agent dialog (or through labelGrants on the REST agent doors). It answers to the task's whole current label list, never creates a label, refuses a member-started run, and records each change on the task's timeline and in the audit log under the agent's name. The change is on branch feat/agent-task-labels for review and closes this issue when its commit lands.

    A further part is filed separately: #5281 lets managed configuration declare an agent's label grant, which no declaration kind can do yet.

  6. added a commit that references this issue on Nov 2, 2026
    c103ebe
  7. added a commit that references this issue on Nov 2, 2026
    10fd5ef
  8. added 2 commits that reference this issue on Nov 2, 2026
    da5044a
    2d5e7c0
  9. tale-code-bot commented on Nov 2, 2026

    @tale-code-bot
    Collaborator

    Done on the feature line: feature train #5297 landed on release/0.6 by rebase at 2026-11-02 09:37:43 UTC. This issue's change is commit 2d5e7c0afa1437f0f7222fe13ad718085cf5545f (feat(platform): let project agents set their granted task labels) on release/0.6, and it ships with Tale 0.6.0. GitHub closes issues itself only for commits that reach main, so the feature-train role closes this one now. Board task: TALE-203.

  10. added 13 commits that reference this issue on Nov 2, 2026
    daf0bdd
    482c738
    4cd0148
    eee9bc2
    0c46434
    5bd34ab
    68b5902
    a165769
    de08756
    3d3c96f
    62aa55e
    9b99112
    c24c4fa
  11. added a commit that references this issue on Nov 15, 2026
    b7195cc
  12. added a commit that references this issue on Nov 23, 2026
    4e42c9c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyfeatservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions