Skip to content

Replace temporary workers with in-turn subagents #435

Description

@linear-code

Problem

On main, a bot that hands part of a turn to a temporary worker starts a child thread for it (AkeruWorkerRuntime, contracts in packages/contracts/src/akeruWorkers.ts), and the app shows the worker through its own cards and dialogs. One request ends up spread across several chats.

Goal

Temporary workers are replaced by fresh, bounded Mastra subagents that run inside the parent turn and return their answers as tool activity in that turn.

  • No child thread or chat is created for a subagent.
  • Interrupting the parent stops its subagents. Parent approvals and usage cover every child call.
  • The worker runtime, worker cards, and worker dialogs are removed.
  • A migration hides old worker chats and drops worker_json.
  • Delegation behavior stays as it is, so the separate bot messaging change can build on it.
  • The parent's work log shows a row for each subagent.

Acceptance criteria

  • Backend, contracts, and migration land on cos/subagents (93837c874)
  • Client work log rows, worker UI removal, docs, and a minor changeset land on cos/subagents (90e9d42ad)
  • Server sweep passes: 399 files, 2,530 tests, 6 already skipped
  • Final provider sweep after approval cleanup passes: 204 files, 1,627 tests, 6 already skipped
  • Client sweep passes: 303 files, 2,948 tests, plus the extra contract and UI checks
  • Server, web, contracts, and client-runtime typechecks and touched-file lint pass
  • The coordinator verifies the real UI at desktop and mobile widths: a subagent shows as work-log rows in the parent turn, and no worker chat, card, or dialog appears
  • An independent review of the implementation passes, and its verified findings are fixed

How to verify

Run the server, provider, and client sweeps above on the branch. Then, in an isolated dev environment, start a bot turn that uses a subagent and check the parent chat at desktop and mobile widths: the subagent's work appears as rows in the parent work log, interrupting the parent stops it, and no new chat appears in the roster. Upgrade a copy of a database that has old worker chats and confirm they are hidden.

Out of scope

  • Bot-to-bot messaging. That is a separate change that builds on the delegation behavior kept here.
  • Mobile and voice files. This change does not edit them.

Context

Branch: cos/subagents. Commits 93837c874 (backend, contracts, migration) and 90e9d42ad (client work log, worker UI removal, docs, changeset). No PR has been opened. The commits predate the Linear tracking instruction.

Migration number: the commits added the migration as 083_RetireWorkers. Merge 7b53c3e37 on cos/subagents combined this work with the always-on bot chats branch and renumbered it: AlwaysOnBots is 083, RetireWorkers is 084, and 085 is reserved for bot talk.

Known failure: the mobile typecheck reports 33 navigation errors. The same 33 errors appear on the base branch, and this change does not edit mobile files.

Not checked yet: the coordinator's integrated desktop and mobile-width UI pass and the independent review. The implementation task did not allow starting servers.

Created with Claude Opus 5.5 in Claude Code.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions