Repository navigation
feat(platform): fan out @mentions in task descriptions - #3519
Merged
Merged
Conversation
The create dialog and the description editor promise "X will respond" under the field, but createTask ended in a TODO and updateTask never resolved the text, so a teammate named in a brief got no bell and a named agent never started. - createTask and updateTask resolve the description with the mention directory (resolveSurfaceMentions): on create in full, on an edit only for the mentions it adds. The directory reads the replaced text too (previousBody), so rewording prose around an existing @handle fires nothing again. A token pre-check keeps the directory build off descriptions that name nobody. - Named humans follow the task and get the mention bell, which points at the task (notifyTaskMentions shares the comment's mention loop). - A named project agent goes through the comment lane's dispatcher, moved into the task core so both surfaces share it: steered while it runs, otherwise assigned and kicked with a 'mention' run carrying the description, under the task automation switch the chips preview (pack_disabled). A card created In progress keeps its assignee's run. - A fresh prompt no longer repeats feedback that is the description itself; a resumed conversation still gets the edit as its feedback. - A serialization conflict inside a directory read reaches the serializable retry loop instead of surfacing as a 503. - Docs (EN/DE/FR), manual box TASK-F34, integration lane checkTaskDescriptionMentions.
A description kick stored the description as it read at kick time in
the run's feedback. The host reads the brief fresh when the turn starts,
after reaping, sweeping, staging and any capacity park, and only dropped
the feedback block when both strings matched exactly. An edit made while
the run waited names nobody new, so nothing fired again, and the prompt
showed the edited Description beside the replaced text as reviewer
feedback that outranks it.
- Migration 0123 adds `mention_source` ('comment' | 'description') to
`project_agent_runs`. A description kick stores no copy of the text;
a check constraint holds that rule, and two more tie the column to
mention runs.
- `buildKickPrompts` builds both opening prompts from the brief read at
start. A fresh conversation reads the description as its brief. A
resumed one gets it as "The task description was edited to mention
you", not as reviewer feedback.
- The source rides the steer job too: a running agent is told the
description was edited, the restart prompts say so, and a steer that
misses kicks a description run that reads the text at its start.
- The integration lane proves a run kicked before an edit opens on the
edit, that the schema refuses a stored copy, and that a create or an
edit whose directory cannot be listed answers
MENTION_DIRECTORY_UNAVAILABLE and writes nothing. Its fixtures
(project, agent, tasks, runs, bells, jobs, users) are removed in one
outer `finally`.
A card created at In review opened the review gate (the reviewer's bell rang), and then its description's agent mention reassigned the card, kicked the agent, moved it to In progress and withdrew that review in the same write. The fan-out now runs before the review gate, and the gate opens only for a card still at In review: no agent named, or its start refused. A named agent is put to work whatever column the card was created in, as a comment naming it on a closed card already does; the In progress kick still runs first, so a card born working for its agent keeps that run. Tests pin both In review outcomes and a card born In progress for a person whose description names an agent (one mention run). TASK-F34 gains the In review step.
Every description save that kept an existing `@token` (or text such as `@tale/ui`) rebuilt the org-wide mention directory under SERIALIZABLE, even when the edit added nothing: more predicate reads and more 40001 retries for no fan-out. Resolution maps each token on its own, so a text whose tokens the replaced text already had resolves to nobody new. The edit path now skips the build in that case, which is the answer the build would give. A new handle for someone already named still resolves, and still fires nothing.
- Usage attribution (EN/DE/FR): a description save that names an agent starts a billed run under whoever saved it, like a comment does. - Tasks (EN/DE/FR): a run a description mention starts moves the card to In progress whichever column it was created in, and the agent reads the description as it is when its run starts. - Error register: MENTION_DIRECTORY_UNAVAILABLE (503) on the comment, create and description-edit doors, with how the lanes provoke it. - Automation register: the TASK-F34 row names the stored source, the no-copy rule and the new tests. - Migration ledger: the collab row records TALE-46 and drops the two PENDING phrases for description mentions; still open are the reserved `task.mentioned` event, an owning automation named in a description, and descriptions written by machine intake or an agent's `task_create` tool, which fan out nothing.
yannickmonney
added a commit
that referenced
this pull request
Sep 27, 2026
TASK-F34 now names the description mentions box that #3519 landed, and open #3535 claims TASK-F35, so the box for a connector running for the run's starter becomes TASK-F36, and TASK-B10 points at it. The suite's cost and the readme's tasks row and total are re-derived from the merged suite. The registers follow the run-bound caller: the automation row names the run_ended refusal, the auto-retry pin and the relayed connector refusals, the error-codes row adds run_ended, and B10 and its pin name Cancel run before a new start. BL-2 records the remaining exposure: two runs of one agent share its session and user, so a live run's token can be read by its sibling.
yannickmonney
added a commit
that referenced
this pull request
Sep 27, 2026
#3519 landed 0123_project_agent_runs_mention_source.sql on main first, so the trigger failure streak takes the next free number.
This was referenced Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
The create dialog and the description editor show
MentionTriggerChipsunder the description("{agent} will respond"). But
createTaskended inTODO(collab): description mention fan-outand
updateTasknever resolved the description. So a teammate named in a brief got no bell, anda named agent never started. Description mentions now do what comment mentions do.
backend/domains/collab/mention-directory.ts):resolveSurfaceMentionstakesan optional
previousBodyand returnsadded. Both texts are read against one directorybuild, so an edit fans out only who it newly names. Rewording prose around an existing
@handle, or naming the same person by another of their handles, fires nothing again.backend/domains/tasks/service.ts):createTask(in place of the TODO) andupdateTask(when the description changed) callfanOutDescriptionMentions.name nobody, as 0.4 did, and off edits that add no
@tokenthe replaced text lacked.Resolution maps each token on its own, so such an edit names nobody new.
run its agent assignee was given (one engine per task), and before the review gate: a card
created In review whose description puts an agent to work moves to In progress without
first opening (and at once withdrawing) a review. A card still at In review gets its gate.
backend/domains/collab/service.ts):notifyTaskMentionssubscribes eachnamed human (
reason: 'mention') and writes thementionrow withresourceType: 'task'.notifyTaskComment's mention half, and uses the same keys(
inbox.mentionByBodyreads "{actor} mentioned you on "{title}"").dispatchMentionedProjectAgent): moved verbatim fromcomments.tsinto thetask core, so both surfaces share it.
service.tsimportingcomments.tswould have added animport cycle;
comments.tsnow imports it fromservice.ts.mentionrunwhile the task is idle. A description kick stores no copy of the text: migration 0123
adds
project_agent_runs.mention_source(comment|description), and the run reads thedescription as it stands when it starts. A copy taken at kick time sat beside an edit made
while the run waited, as reviewer feedback that outranks it.
mentionTriggerPreviewreports aspack_disabled(mentionAutomationEnabled, the oldcommentAutomationEnabledmoved torun-start.ts: a broken policy reads as off).a model.
backend/core/tasks/agent_run_host.ts,buildKickPrompts): both opening promptscome from the brief read at start. A fresh conversation reads the description as its brief. A
resumed one does not re-read the brief, so it gets the current description as "The task
description was edited to mention you", not as reviewer feedback. The source rides the steer
job too (
task.agent_steer.mentionSource): the stdin line and the restart prompts say thedescription was edited, and a steer that misses kicks a description run that reads the text at
its start.
unwrapped, so
transactSerializableretries it. Wrapped asMENTION_DIRECTORY_UNAVAILABLE, itsurfaced as a 503. The create and edit doors are SERIALIZABLE and now read the directory, as the
comment door already did.
platform/projects/tasks.mdgets one paragraph on mentions in thedescription (any column moves to In progress; the agent reads the description at run start);
admin/governance/usage-attribution.mdnames a description mention as a way to start a billedrun. Manual layer: box
TASK-F34plus itsreference/automation.mdrow, and areference/error-codes.mdrow forMENTION_DIRECTORY_UNAVAILABLEon the comment, create andedit doors. Ledger: the
MIGRATION.mdcollab row records TALE-46.Schema: migration
0123_project_agent_runs_mention_source.sql, one nullable column plus threechecks (the two values; only on
mentionruns; a description run stores no feedback). Rolling-deploysafe: the previous image neither writes nor reads it. No new strings, no contract change. A
description save that names someone now fails with 503
MENTION_DIRECTORY_UNAVAILABLEif thedirectory cannot be listed, as a comment already does. The TODO is gone.
How I verified it
Unit:
bunx vitest run --project serveroverbackend/domains/tasks,backend/domains/collab,backend/core/tasks,backend/domains/provisioning,backend/jobs,lib/sharedand everyother test that imports a changed module: 128 files, 1346 tests pass. New:
service.description-mentions.test.ts, 8 cases:pack_disabledfromthe same policy;
mention-directory.test.ts:addedwith and withoutpreviousBody, another handle for thesame person, a reworded text, a 40001 passing through.
collab/service.test.ts: the task-bound mention row, no actor, no agent, no watchers; a commentrow still points at its comment.
run-start.test.ts: a broken policy reads as off.agent_run_host.task_prompt.test.ts: the description is said once, and a comment's feedbackstill leads.
Real Postgres 16 (+ pgvector + pg_search, no Docker), filtered run
ITEST_LANES=checkTaskDescriptionMentions,checkCollabMentions,checkRunProvenance,checkTaskRunStartFence,checkTasksCollabIntegrity,new lane
checkTaskDescriptionMentions(4 checks) throughcreateTask/updateTaskundertransactSerializable:9121a4ab7): 52/52 pass. That includes the comment lanes themoved dispatcher serves (steer, idle kick, queued quiet, agent author, live automation blocks,
the disabled/unavailable policy) and upstream's reviewer re-target lane.
origin/main: all 4 new checks fail (bells=0,runs=none,task=backlog/null). The 14 new unit cases fail the same way.backend:integrationis not a CI job, so this local run is the real-Postgres proof.Gates:
tscover the changed files and their import graph is clean. The workspace-widetscdoes not fit the sandbox's 4 GB and is left to CI.bunx oxlint --type-awareon every changed file,oxfmt --check,bun run lint:manual,check-guide.tsonsuites/tasks.md, and the pinned opengrep on the changed files (0 findings)are all clean.
bunx knip --workspace services/platform: only the pre-existingoidcOrganizationClaims.services/docs,bunx vitest run): 34 files, 166 tests pass, with no i18nreport-mode findings.
Review round 1 (
ba9581540..8bd89239e, fixes for the independent review):bunx vitest run --project server(814 files, 10245 tests) passes. New orchanged:
agent_run_host.task_prompt.test.ts(a run kicked with the German text opens on theFrench edit, fresh and resumed; a resumed description kick is phrased as an edit; steer
texts),
agent_run_host.steer_fallback.test.ts(the fallback kick keeps the source),service.description-mentions.test.ts(no copy on the kick; both In review outcomes; a cardborn In progress for a person whose description names an agent gets one
mentionrun; anedit adding no
@tokenbuilds no directory; a new handle for someone named fires nothing).tsc --noEmitis clean on this machine;oxlint --type-awareon everychanged file,
oxfmt --check,knip,lint:manual,check-guide.tsonsuites/tasks.mdand the docs suite (166 tests) are clean.
checkTaskDescriptionMentions(7 checks): a run kicked beforean edit opens on the edit, fresh and resumed; the schema refuses a description run that
stores a copy; a create or an edit whose directory cannot be listed answers
MENTION_DIRECTORY_UNAVAILABLE/503 and writes no card, no edit, no bell. The lane now removesits project, agent, tasks, runs, jobs, bells, members and users in one outer
finally(verified: no rows left).
backend:integrationrun: 814/821 checks across 162/162 lanes. The 7 failures(teams' last-member door; six organization-lifecycle teardown checks) fail the same way on
origin/main835236313in the same environment (809/818, the same 7 plus 2 more), so theyare not this change's.
Left open (not in this change)
chips preview agents only, and a workflow reads the description when it runs.
task.mentionedevent (0.4 emitted it) stays inRESERVED_EVENT_TYPES. Raising it is acontract change: the event list, the OpenAPI trigger enum and the API reference.
upsertTaskByExternalRef) and source-issue sync writedescriptions without a fan-out. An external
@handleis not a Tale member.agentCreateTaskTrusted(thetask_createworkspace tool) writes adescription without a fan-out, so a person an agent names there gets no bell, while the same
agent naming them in a comment does. Belling humans only (never an agent dispatch, to avoid
loops) is the likely shape; it is a product call on agent-sent bells, left for its own change.
@tokenin a description that matches nobody is not reported back. The commentcomposer's "Mention not recognized" toast has no description twin yet.
Task: TALE-46 (triage T45, P2).