Skip to content

feat(platform): hand a chat's work to a project agent in one step - #4023

Merged
yannickmonney merged 7 commits into
mainfrom
feat/chat-task-handover
Oct 1, 2026
Merged

yannickmonney merged 7 commits into
mainfrom
feat/chat-task-handover

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Why

This is PR B of three for the customer finding: a Member couldn't get a small job (three files and a prompt) done, because the chat pointed at an agent that never ran. PR A (#4017, merged) ended the dead ends after a task reaches an agent. This PR makes the hand-over from the chat finish. Reproduced live as a Member:

  • The entry point was buried in the conversation's ⋯ menu.
  • The project step didn't say which projects have an agent, so the Member landed in one without.
  • The task was created unstarted, and the chat never learned what became of it.
  • The assistant said "create a task and assign it to an agent" whatever the person's projects and role, in English words the German interface doesn't show.
  • Found while testing: every app chat turn ran with the locale en, because the send never carried the interface language.

What changes

A hand-over in one step

  • Create task sits in the chat header: a ghost button, icon-only when the header is narrow. Below md, the ⋯ menu keeps Create task from chat.
  • The project step lists With an agent (with the agent count) above No agent yet, where each row says who can add one; an Editor reads "You can add one in the task". The only project with agents is pre-picked, and a person who can open only one project skips the step.
  • The task dialog pre-assigns a project's only agent. From a chat, its primary verb is Create and start agent, with Create only beside it. On the board, Create and start agent joins Create task when an agent is assigned, and is the only verb at In progress. Starting means creating at In progress in one transaction, so a refused start creates nothing and the toast says why.

The chat follows the task

  • app.tasks.source_thread_id (migration 0144: a nullable column with a partial index) names the chat a task came from. It is set only when the creator can read that chat: their own, or one shared into a project they can open. Otherwise the create fails with TASK_SOURCE_THREAD_NOT_FOUND.
  • GET /api/app/tasks/by-thread/:threadId lists up to 10 tasks made from a chat, newest first, limited to those the reader can open. Each carries its run state (retry pending, waiting for capacity, failure code) and its output count.
  • The tray above the message box shows a live row per task: working, waiting for a sandbox slot, trying again, couldn't finish, ready for review · N files, waiting to be started, or the task's column. Open goes to the board. Rows update through the task hints (PR A made every run write hint its task) and are announced through aria-live="polite".

The assistant knows the way

  • A per-person task-handover block after the cache breakpoint names:

    • the person's projects with an agent (up to 5);
    • whether they could add one;
    • whether task automation is off;
    • the exact control labels, read from the platform catalogs in the person's interface language.

    The DELIVERABLES rule now defers to it, and the persona stays under its 1,800-character guard. Sub-agent and API-key (REST) turns carry no note, and a failed read degrades to none. A person who can open no project gets a note saying who sets one up.

  • A server-side catalog reader (backend/core/i18n/catalog.ts) is shared with the notification mirror.

The interface language on every turn

  • The app's send and regenerate carry the UI locale, as the arena and parked sends already did. The "Respond in the user's language (…)" directive used to read "(en)" on every app turn. It stays a default: REST's locale still pins the reply language.
  • Every chat door validates the locale with localeTagSchema (BCP 47 shape, at most 20 characters), since the value is written into the system prompt.

Decisions (flagging for review)

  • Create and start agent is the primary verb only from a chat, where handed-over work is meant to begin. The board keeps Create task primary.
  • Only a single agent is pre-assigned. With several, the person picks; PR C adds the organization's standard agent.
  • The desktop ⋯ menu drops "Create task from chat" because the header button replaces it. The mobile menu keeps it.
  • The tray shows three rows plus "and N more", and a chat lists at most 10 tasks.
  • source_thread_id is not a foreign key: trashing a chat leaves its tasks as they are.
  • API-key turns get no hand-over note: there's no header to point at, and the key's owner may not be the person reading the reply.

Proof

  • Typecheck, type-aware oxlint, knip, oxfmt, lint:links, lint:manual, check-guide (chat, tasks), docs vitest and the @tale/ui i18n tests all pass. The full platform server (966 files, 13,317 tests) and UI (559 files) suites are green.
  • Real Postgres: the new lane checkTaskSourceThread passes its 3 checks: the migration's column and index, who may name which chat, and the per-reader listing.
  • Live on an isolated stack, as the Member from the finding (German UI):
    • Aufgabe erstellen in the header opens the project step, grouped "Mit Agent: Getting started (1 Agent), Website relaunch (2 Agenten)" and "Noch ohne Agent: Customer onboarding portal (Ein Redakteur oder Admin kann einen hinzufügen)".
    • Choosing Getting started pre-assigns Analyst, and the footer reads Nur erstellen / Erstellen und Agent starten. The task was created with the chat as its source and a run started by the Member.
    • With two agents nothing is pre-assigned. After picking one, the tray showed "Der Agent arbeitet · Website relaunch", then "Bereit zur Prüfung" 4 s later, with no reload (recorded with a MutationObserver).
    • The model request carried the note (… choose "Aufgabe erstellen" … Pick a project with an agent: Getting started, Website relaunch … Choose "Erstellen und Agent starten" …) and "Respond in the user's language (de-DE)".
  • Three bugs found live, each fixed with a regression test:
    • The chat's projects read dropped the agent count, so every project showed "no agent".
    • The tray's read was missing from the chat seam's own table, so the tray never rendered. Its unit test had mocked the seam.
    • The send carried no locale, so the note's labels were English.
  • The docs screenshots were recaptured with the pipeline: chat-create-task now shows an assigned agent and Create and start agent, and chat-task-tray is new.

Docs and manual

Not in this PR

  • PR C: an organization standard agent, so a project without agents still has one.
  • Seen but pre-existing: in German, the task dialog's property column truncates "Nicht zugewiesen" to "Nicht zugewies…".

The app's chat send never carried a locale, so every app turn ran as
English: the reply-language directive read "(en)" for a member whose
interface is German, and anything a turn words from the catalogs could
only be English. The send and the regenerate now carry the UI's
language, as the arena and parked sends already did. It stays a
default: the language the user writes in still wins, and only the REST
door's locale pins the reply language.

A locale is written into the system prompt, so every chat door now
holds it to one BCP 47 tag shape (the REST door's pattern, shared):
free text never reaches the instructions.
A Member who asked the chat for a file was sent to a project with no
agent, or to a task that sat unstarted, and nothing in the chat said
what became of the work. The hand-over now finishes:

- Create task sits in the chat header; the conversation menu keeps it
  on narrow screens.
- The project step lists the projects with agents first, with their
  count, says who could add one where there is none, and picks the only
  project that has agents.
- The task dialog assigns a project's only agent. From a chat its main
  verb is Create and start agent, with Create only beside it; on the
  board, Create and start agent joins Create task whenever an agent is
  assigned.
- A task names the chat it was handed over from (source_thread_id,
  migration 0144) when its creator can read that chat, and the chat
  shows a live row per task above its message box: the agent working,
  waiting for a sandbox slot, retrying, stopped, or ready for review
  with its files.
The assistant could only say "create a task and assign it to an agent",
which sent a Member to a project without one and a tab they cannot
change. Each app turn now carries a hand-over note after the cache
breakpoint: which of the person's projects have an agent, whether they
could add one, whether agents can start at all, and the controls as
their interface names them, read from the app's own catalogs in the
language the send carries. The deliverables rule gives what fits in a
reply, then those steps, and never invents menus, projects or roles.

Sub-agent turns and turns sent with an API key carry no note, and a
failed read replies without one.
Chat basics, Tasks, Task automation and the Member projects tutorial
describe the new hand-over in en, de and fr: Create task in the chat
header, the project step's agent groups, Create and start agent, and
the task's live row above the message box.

The capture manifest opens the hand-over from the header and assigns
an agent before the shot, and a new shot shows the task's row with the
message box; both images are recaptured.
CHAT-F52 now follows the header's Create task and the one-step start.
CHAT-F53 to CHAT-F55, CHAT-B20 and CHAT-A8 cover the task's live row
and its states, the reply's hand-over steps, a hand-over with no agent
anywhere, and the keyboard and screen reader; TASK-F59 covers Create
and start agent on the board. The automation reference names the specs
that own the rest, and the readme counts are current, including the
conversations suite's two boxes from #3987.
The surface's send now carries the interface language (the fix before this one); the test that pins the send's exact fields names it too.
@yannickmonney
yannickmonney force-pushed the feat/chat-task-handover branch from 8e3e616 to 50a2fc1 Compare October 1, 2026 04:00
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