0016 - One Agent Chat Page, Answered by a Runner the Person Chooses¶
Status¶
Accepted 2026-10-15 by the owner in Taskbase decision task #979: option A, with two changes:
- Runner picker. The chat page has a panel where the person chooses which runner answers. It lists the runners the person owns that are online and can take session turns (with a free session slot shown, and a held subscription shown as unavailable). Admins may choose any in-scope runner. The choice is stored on the session and every turn of that session is claimed only by that runner; changing it applies from the next turn. If the chosen runner is offline, the turn waits with a clear message and the person can switch. Default: the person's own runner that was used last, else their first available own runner.
- Model picker. The person chooses the model for the session: a tier (small/medium/large) or a specific model id, limited to the models the chosen runner's adapters offer (from its reported adapters and model overrides). Default: the persona's
default_model. The choice is stored on the session, passed with each turn, and shown in the chat and the usage records.
Everything else is as option A. Sections 2, 3, 6 and 7 below are amended to match, and the new section 2a describes the model picker (task #982). The implementation is planned from this decision in Taskbase task #980.
Shipped through the tasks listed under As built (Taskbase #983–#986, #989, #990, #993 and #997, skatzi-agents #987, agent-runner #988) and documented in platform task #992. Where the merged code differs from the text below, As built says so and is right.
Proposed 2026-10-15 (Taskbase task #978, epic #58, request #977). Builds on ADR-0013 (interactive agent sessions) and ADR-0015 (resolving Needs attention items by chat), and amends both in the points listed under Amendments. Uses runner owners (Taskbase task #675) and the control room (milestone #11) unchanged.
Date¶
2026-10-15
Context¶
Request #977 asks for one chat page in Taskbase that is not scoped to a project. From that page a person can:
- understand work across projects (tasks, epics, milestones and the roadmap) and the code pipelines (CI and build status);
- create tasks and epics;
- resolve Needs attention items: answer decisions, requeue tasks and post comments.
The two chats that exist today, Build with an agent (ADR-0013) and Resolve with an agent (ADR-0015), are to be unified into this page. Each keeps its own layout beside the chat: the request draft, or the item and its action plan. Both entry points open the unified page. Any user can open the page. A user who owns no agent runner sees that they own none and cannot trigger agent actions. A user who owns a runner can have the chat act only through their own runner.
What exists today (Taskbase code read on 2026-10-15, v1.176.0)¶
- Sessions (
api/internal/session/). Every session has a non-nullorganization_idandproject_id(migration 59).subject_typeisproject_requestortask(migration 64).PersonaFormapstasktoattention-helperand anything else torequest-builder. The limits are 3 open request sessions and 5 open task sessions per person and organization, 40 or 20 turns per session, and 10 messages a minute and 200 a day, shared across all of a person's sessions. - Turn claim (
runner/session_turns.go,tryClaimTurn). A runner claims a pending turn when all of these hold: - it takes turns and has a free session slot;
- it
Servesthe session's organization; - the persona's model resolves on one of its unheld adapters;
- the owner still reaches the organization (
OwnerAccess).
The runner's owners are not considered. Any in-scope runner answers anyone's turn.
- Availability (writeAvailability). It counts online runners that are in scope and able to run the persona's model, and their free slots. Its reasons are "no runner that takes sessions is online", "no online runner can run the persona's model" and "every agent is busy". The caller's runners play no part.
- Runner owners (task #675, migration 52). runner_owners(runner_id, username) holds Keycloak usernames. Runner.HasOwner(username) checks one, and RunnerView.can_manage is the control room's flag. Runners from before #675 have no owners until an administrator adds them. Sessions store the owner's owner_subject and owner_username, so the claim can compare usernames directly.
- Turn scope (authz/turnscope.go, guard.go). A request that carries X-Taskbase-Turn from the turn's runner user becomes a principal with Turn{TurnID, SessionID, OrganizationID}, with admin rights and groups removed. The guard allows it GET routes open to agents plus its own session's GET and PUT …/draft. CanAccess and AllowedOrganizations return exactly the one organization. GET /api/attention and the run lists are humansOnly, so they are closed to turns.
- Agent-runner (docs/chat-turns.md). A turn is stateless: a fresh process with no clone, no shell, no file or web tools and no Gitea MCP server. The runner's secrets are removed from its environment, and it has a 3-minute cap. Its prompt is built from the claim's frame (session, organization, project, date, subject context, draft schema), the draft and the transcript.
- Pipelines. get_task_pull_request (task #869) gives run- and turn-scoped agents a task's PR and the combined CI state at its head, per check, without logs. Nothing reads a branch's or a deploy workflow's state.
Gitea, verified on 2026-10-15 (Gitea 1.25.5, with a runner's bot token)¶
GET /repos/{o}/{r}/commits/{ref}/statusworks. The merge commit05058eaofSkatzi/taskbasecarries the fourdeploy-dev.yamljobs as statuses, fromrelease-and-deploy-dev / release (push)through… / promote-prod (push), each with a link to its run. The head ofmain(a10f257,chore: promote prod … [skip ci]) carries none, so "the status ofmain" is the newest commit on the branch that has statuses, not the head.GET /repos/{o}/{r}/actions/runsanswered403 user should be the owner of the repofor this token.GET /repos/{o}/{r}/actions/tasksworks but ignoredlimit: it returned all 2,103 jobs (about 100 KB).
Decision¶
One chat page, /chat, hosts every session a person has. A new person-owned subject, general, has no organization or project and is answered by a new assistant persona. The two existing subjects keep their models, frames and confirm paths, and only move into the page. The person chooses the runner and the model for each session, and every turn of the session is claimed only by that runner: one the person owns, or, for an admin, any in-scope runner. A general turn reads every organization its owner reaches and the chosen runner serves, and nothing more. The chat changes nothing by itself: writes are actions in a plan the person confirms, run as the person through the same services as the routes (ADR-0015's model, with create_task and create_epic added). A new read route, get_project_pipeline, reports a repository's branch pipeline from Gitea's commit statuses.
sequenceDiagram
participant P as Person
participant T as Taskbase API
participant R as Chosen runner
participant A as assistant turn
P->>T: open /chat, availability?
T-->>P: your runner "laptop": online, 1 free slot, models small/medium/large
P->>T: choose runner "laptop", model medium
P->>T: message in general session
T->>T: turn pending (session runner = laptop, model = medium)
R->>T: claim turn (only the session's runner may)
T-->>R: persona, model, frame: the person's organizations, attention summary, plan schema
R->>A: spawn, no repository, no secrets
A->>T: reads (turn scope = owner's organizations ∩ chosen runner's scope)
A->>T: save plan: create_task, comment_and_requeue
A-->>R: reply
R->>T: finish turn
P->>T: review plan, confirm
T->>T: run each action as the person
Each question from task #978 follows, with its options and a recommendation.
1. Session model¶
| Option | For | Against |
|---|---|---|
A. One page hosting three subjects: a new general, plus project_request and task unchanged (recommended) |
Request and task sessions keep their frames, schemas, limits, confirm paths and the one-session-per-task rule, all shipped and tested. Only the page is new. A general session covers the cross-project questions and writes |
Three subject types to keep in mind. A general chat that turns into "build a request" files it as an action rather than switching to the request layout |
B. One session type, general, that can switch into a request draft or an action plan ("modes") |
One conversation from question to request | Re-models two shipped subjects. The one-session-per-task index, the subject_resolved trigger, usage on the subject task and the confirm paths all hang on subject_type. A switch mid-session changes the persona, frame and schema under a running transcript |
| C. One page that hosts only the two existing subjects | No new subject | Fails the request: nothing is "not scoped to a project", and nothing creates tasks or epics or reads across projects |
Recommended: A.
generalsubject.subject_type = 'general', withsubject_id,organization_idandproject_idall NULL. Migration: the two columns become nullable, withCHECK ((subject_type = 'general') = (organization_id IS NULL AND project_id IS NULL)). The owner is the person, as today.- Its draft is an action plan. It uses ADR-0015's plan (
summary,checklist,actions) with a wider vocabulary (section 4). Once the plan has actions, the plan card appears in the side pane. - A request from a
generalchat is the actioncreate_project_request(project, title, body). It goes throughCreateRequest, the same path as the request box. The request layout stays with Build with an agent, which still opens aproject_requestsession; that is the "existing request-draft layout" the request keeps. - Personas. Taskbase keeps choosing the persona per subject:
PersonaFor("general") = "assistant", a newkind: sessionpersona inskatzi-agentswithdefault_model: medium. A cross-project question needs more reasoning than drafting a request; the owner can change the model as for any persona.request-builderandattention-helperstay. Rejected: one persona for all subjects. Each turn's system prompt would carry all three roles, and a cheapsmallrequest turn would pay for amediummodel. - Routes.
POST /api/sessionswith{"subject_type": "general"}opens one, andGET /api/sessions/minelists it beside the others withorganization_id: null. The session routes by id (GET,/updates,/messages,/draft,/confirm,/abandon,/restart) are unchanged.GET /api/sessions/availability?subject_type=generalneeds nosubject_id(section 2). The project and task routes that open sessions stay; the UI calls them and then navigates to/chat/{id}(section 6). - Limits. At most 3 open
generalsessions per person (not per organization; they have none), counted apart from the request and task limits. At most 40 turns per session. The message limits are shared, as today. Plans hold at most 10 actions (5 for task sessions, unchanged), because "create these four tasks" is a normal use. - Retention and expiry. As for request sessions: 24 h idle, then expired; deleted 30 days after closing. A confirmed
generalsession is deleted 30 days after closing like a task session, because its transcript is attached nowhere. /chatsbecomes the page's session list (section 6), and the route redirects to/chat.
2. Own-runner rule¶
Rule (decided in #979): the person chooses the runner that answers a session, and every turn of that session is claimed only by that runner. A person may choose only a runner whose runner_owners include their owner_username. Admins may choose any in-scope runner. This applies to every subject, not just general, so that "Build with an agent" and "Resolve with an agent" follow it too. Ownership stays as task #675 models it; the session stores the choice (sessions.runner_id, nullable, ON DELETE SET NULL).
Which runner answers.
| Option | For | Against |
|---|---|---|
| A runner chosen per session by the person (decided, #979) | Explicit: the person sees and steers which machine and subscription answers, and an admin can use a runner they do not own | When the chosen runner is offline the turn waits until the person switches |
| Any owned runner may claim; the first with a free slot wins (the proposal) | No picker; an offline runner is skipped silently | Replaced by #979. The person cannot choose the machine or subscription, and admins would have no runner unless they own one |
Where it is enforced.
| Option | For | Against |
|---|---|---|
| Taskbase, in the claim (recommended) | One check in tryClaimTurn (rn.ID == c.SessionRunnerID, plus the eligibility below), and the same check in writeAvailability. Runners cannot get it wrong, and old runner versions follow it at once |
— |
| The runner refuses turns it was not chosen for | — | Every runner version must implement it; a stale or modified runner breaks the rule |
Recommended: in Taskbase's claim. The details:
- Eligible runners. A runner is eligible for a session when it takes session turns and either the session's owner owns it, or the owner is an admin and the runner is in scope. In scope means: for a request or task session the runner
Servesthe session's organization; for ageneralsession it serves at least one organization (its read scope is narrowed to what it serves, section 3). - The claim. A runner claims a pending turn only when it is the session's chosen runner and it is still eligible, has a free session slot, and resolves the session's model (section 2a) on one of its unheld adapters. The claim reads the session's choice at claim time, so a pending turn follows a switch; a turn already claimed finishes on the runner that claimed it.
- Choosing and switching.
PATCH /api/sessions/{id}withrunner_id(and/ormodel, section 2a), by the session's owner only, while the session is open. Taskbase checks that the runner is eligible for this person and session and answers400with the reason otherwise. The change applies from the next turn to be claimed. - Default. When a session opens, Taskbase sets
runner_idto the person's own runner that was used last (the runner of their newest claimed turn, if still eligible), else their first available own runner (online, takes sessions, a free session slot, not held; by name). If there is none,runner_idstays NULL and the panel asks the person to choose. An admin who owns no runner gets no default and chooses from the in-scope runners. - Offline, full or held. The message is accepted and the turn waits pending, with the waiting clock and a message that names the runner ("Your runner laptop is offline. Wait, or choose another runner"). It expires after 10 minutes as today. The person can switch at any time and the waiting turn moves with the choice.
- No runner at all.
POST …/messagesand opening a task session's opening turn answer409withcode: "no_own_runner"when the owner is not an admin and owns no runner that takes sessions. They answer409withcode: "no_runner_chosen"when the session has no runner chosen. Turns that no one can ever claim do not pile up. - Admins may choose any in-scope runner, not only their own. An admin's chat can therefore run on another person's machine and subscription. That is the owner's decision; it stays visible because the session, the chat and the turn's usage record all name the runner.
- Runners without owners (from before #675) take no turns of non-admins after this change, because no one but an admin can choose them. They keep claiming tasks. The rollout needs an administrator to add owners first (see Rollout).
- A runner that stops being eligible (an owner removed, its scope narrowed) is not offered any more, and a session that chose it claims no turns until the person switches. Availability reports
chosen_runner_ineligible. - Usage stays on the chosen runner's subscription, and the turn's usage record names the runner, as today.
Availability and the picker. GET /api/sessions/availability decides both the "no runner" state and the picker's content. It is asked with subject_type=general (no subject id), as today, or with session_id for an open session. It keeps its fields and adds:
| Field | Meaning |
|---|---|
own_runners |
how many runners the caller owns that take sessions (online or not) |
reason_code |
available, no_own_runner (not an admin and owns no runner that takes sessions), no_runner_chosen, runner_offline, runner_busy, runner_held, runner_cannot_run_model, chosen_runner_ineligible |
chosen_runner_id |
the session's runner, when asked with session_id |
runners[] |
the eligible runners for this caller and subject that are online, plus the chosen runner whatever its state: {id, name, owned, online, free_session_slots, held, models[]}. held is true when every adapter of the runner is under a subscription hold; such a runner is listed but cannot be chosen. models[] is what the runner offers (section 2a) |
For a non-admin, runners[] holds only runners they own; for an admin, every in-scope runner, with owned telling their own apart.
The UI states for these codes:
no_own_runner: the page opens and the person can read their past sessions. The composer is replaced by "You don't own an agent runner, so the chat can't act for you", with a link to the Runners page and the setup guide. Agent actions are disabled. The classic request form and Needs attention's one-tap buttons stay where they are.no_runner_chosen,chosen_runner_ineligible: the composer is disabled and the runner panel asks the person to choose.- Offline, held or cannot run the model: the composer works, and the message waits with the reason and a Switch runner link to the panel.
- Busy: the composer works and the message waits, as today.
Agent-runner (project 12). The claim needs no change: the filter is Taskbase's. Changes needed:
- Build the prompt frame from a claim whose
projectandorganizationare null and which carriesorganizations[]and the attention summary (section 3). Today the frame assumes a project. - Run the turn on the model the claim names (section 2a) rather than only the persona's default.
- Document the rule in
docs/chat-turns.md("a runner answers only the sessions that chose it"), and show instatusand the desktop app that a runner with no owners answers only admins' chats. - No change to the 3-minute cap for now; see Deferred.
2a. Model picker¶
Rule (decided in #979): the person chooses the model for the session, a tier (small, medium, large) or a specific model id, limited to what the chosen runner offers. The default is the persona's default_model.
- Stored on the session.
sessions.model TEXT NULL; NULL means the persona'sdefault_model. It is set withPATCH /api/sessions/{id}(model, ornullto go back to the default), by the owner, and applies from the next turn to be claimed. - What the runner offers. The models of the chosen runner's reported
adapters(which already reflect itsmodel_overrides, set in Taskbase): each model id, and each tier one of them serves. Availability lists them per runner asmodels[]: {id, tiers[], adapter, held}. Saving a model the chosen runner does not offer answers400. A switch to a runner that does not offer the session's model keeps the choice and reportsrunner_cannot_run_model, so the panel asks the person to pick one it offers. - In the claim. Taskbase resolves the session's model (or the persona's default) on the runner's unheld adapters as it resolves the persona's model today, and sends it in the claim's
modelfield. The runner runs the turn on that model. - Recorded. The turn's usage record keeps the session's choice as the requested model and the model that ran as model, so usage trends and the chat show both. The chat shows the model under each agent reply and in the panel.
- Limits. The choice does not change the turn, message or session limits. Cost lands on the chosen runner's subscription, as with any turn.
3. Read scope¶
| Option | For | Against |
|---|---|---|
Widen TurnScope to a set of organizations, fixed at claim time: the owner's reach ∩ the chosen runner's scope (recommended) |
The same guard, the same agent-readable GET routes, the same CanAccess and AllowedOrganizations code with a list instead of one id. Fail-closed by construction: an empty or missing set reaches nothing |
A turn may run up to 3 minutes on a reach computed at its claim |
| Run the turn as the person (token exchange) | Exactly the person's view | Rejected in ADR-0013 §7 for the same reasons: the person's token on a machine, and Keycloak token exchange |
| One turn per organization, the agent picks one | No guard change | "What is blocked across my projects?" spans organizations; the agent would need several sessions |
Recommended: a set of organizations fixed at claim.
- At claim. Taskbase computes the owner's reachable organizations: their grants and groups through the cached Keycloak lookup; for an admin owner, every organization. It intersects them with the
Servesof the session's chosen runner, the only one that can claim the turn (section 2). Switching runners can therefore change what the next turn reads. It stores the result on the turn (session_turns.scope_org_ids BIGINT[]). For request and task sessions the set is the session's one organization, as today. An owner who reaches nothing gets a turn that can read nothing, and the persona says so. - On each request.
TurnScoperloadsscope_org_idswith the turn, soTurnScope{OrganizationIDs []int64}replacesOrganizationID.CanAccessbecomesslices.Contains(p.Turn.OrganizationIDs, orgID), andAllowedOrganizationsreturns the set. A NULL or unreadable set refuses the request (500 or 403), never "all". - Not wider than the owner. The turn principal still drops
AdminandGroups. Admin routes andhumansOnlyroutes stay closed. Turns still reach only GET routes open to agents, plus their own session'sGETandPUT …/draft. A grant revoked mid-turn takes effect at the next claim, at most one turn (3 minutes) later; the confirm checks again as the person (section 4). - What the turn needs beyond today's routes. The frame of a
generalturn carries: - the owner's organizations and projects (id, name, repository);
- a summary of the owner's open Needs attention items: at most 20, each with the task, reason and age.
GET /api/attentionishumansOnlyand stays closed, so the frame passes what the person sees there; - the plan schema with the vocabulary.
For anything else the agent uses the existing tools: list_organization_tasks, list_epics, list_milestones, list_epic_tasks, list_milestone_tasks, get_task, get_task_pull_request, and the new pipeline tool (section 5).
- Tests pin the fail-closed cases: an empty set, a NULL set, an organization outside the set, a grant revoked between claim and confirm, a runner scoped narrower than the owner, a switch to a runner with a different scope between turns, and an admin owner on a runner they do not own whose turn is still not admin.
4. Writes¶
| Option | For | Against |
|---|---|---|
| Plan and confirm, as ADR-0015 (recommended) | Keeps the boundary of ADR-0013 §7 and ADR-0015 §8: a turn writes only its own draft. A prompt injection from a task description, PR title or CI name can at most propose an action the person reads. Every write is attributed and audited as the person | A confirm tap even for one task |
| Direct writes by the turn, as the person | Fastest | Rejected, as in ADR-0015. A general turn reads text from every organization the person reaches, so one injected sentence could create, requeue or close tasks anywhere the person can act. Writes would carry the runner's identity |
| Direct writes for "safe" actions (create a task), plan for the rest | Fewer taps | No action is harmless across organizations: a created task that is assigned to an agent queues work and opens a Gitea issue |
Recommended: plan and confirm. The vocabulary of a general plan is ADR-0015's seven actions (on any task in the turn's organizations that the action's rules allow), plus:
| Action | Parameters | What Taskbase does, as the person |
|---|---|---|
create_task |
project_id, title, description, optional assignee + assignee_type, epic_id, milestone_id, priority, model |
The create path of POST /api/projects/{id}/tasks, moved into task.Service as #871 did for requeue and reassign. A project with a repository opens its Gitea issue, so the plan card says "creates an issue in owner/repo" |
create_epic |
organization_id, title, description, optional milestone_id |
The create path of POST /api/organizations/{id}/epics, moved out of epic.Handler into a small service (there is none today) |
create_project_request |
project_id, title, body |
CreateRequest, as the request box. The transcript is not attached (unlike a request session's confirm), because it may span projects |
The rules:
- When the plan is saved,
PlanCheckervalidates each action: - its project, epic, milestone or task lies in the turn's organizations;
- a persona assignee is
kind: task, as the API requires; - an epic or milestone belongs to the task's organization;
- titles are at most 200 characters and bodies at most 4,000;
- at most 10 actions.
The secret scan (LooksLikeSecret) covers every title, description and body. An invalid plan answers 400 with the action and the reason, as today.
- Later actions may refer to tasks the plan creates by their position ("task_ref": 1) instead of an id: for example, create a task and then add it as a depends_on. This is checked at save time and resolved at confirm time.
- On confirm, RunPlan runs the actions in order with the owner's principal, through task.Service, the new epic service, the request route's CreateRequest path and attentionaction.Service, the same code as the routes. The guard's organization check applies per action. It stops at the first refusal and stores each result (done, refused, failed, not_run) with links to what it created.
- Attribution. Created tasks and epics record the person as creator. Comments carry "— person via Taskbase" and "Drafted with assistant."
- Limits. The plan's actions count against nothing new. The routes' own rules (Gitea issue creation, the agent claim) apply as when the person clicks.
5. Pipelines¶
Today's get_task_pull_request answers "is this task's PR green?". It does not answer "is main of Taskbase deployed?", "did promote-prod run?" or "what is failing on the default branch?", and request #977's acceptance asks for pipeline status per project.
| Option | For | Against |
|---|---|---|
A repository-level read route from commit statuses: GET /api/projects/{id}/pipeline?ref=, MCP get_project_pipeline (recommended) |
It uses the call already used for PRs, which works with Taskbase's token (verified above). It covers deploy workflows, because their jobs post statuses on the commit they ran for. It is small and neutral, with no logs. Turns and runs reach it through the general GET rule | It must walk back from the head: [skip ci] commits carry no statuses (verified: main's head has none) |
Gitea Actions API (/actions/runs, /actions/tasks) |
Workflow-level view: run names, events, durations | /actions/runs refused a non-owner token. /actions/tasks ignored limit and returned 2,103 jobs (about 100 KB) per call. It ties Taskbase to an API that changes between Gitea releases |
get_task_pull_request only |
Nothing to build | Does not meet #977's "pipeline status for a project" |
| Give turns the runner's local Gitea MCP server | Already exists for runs | Against ADR-0013 §7 (turns have no Gitea token), and the runner drops it from turns on purpose |
Recommended: get_project_pipeline. For the project's repository (only under the organization's gitea_org, as #869), on ref (default: the repository's default branch), Taskbase answers:
- The commits: the branch head (sha, title, time), and the newest commit among the last 10 that has statuses, with its combined state and each check's
context,state,descriptionandtarget_url. - Deploy and promotion: grouped by workflow prefix (for example
release-and-deploy-dev / promote-prod), so "was it promoted?" is one field. older: truewhen the head itself has no statuses, so the agent says "the latest checked commit is …".- No logs, as #869. The answer is cached for 60 seconds. It reads with Taskbase's Gitea token, never the turn's.
6. UI¶
Route. /chat shows the session list and a New chat button, which opens a general session. /chat/{sessionId} shows one session of any subject. Both are outside any organization, inside AppLayout.
How to reach it. The user menu's My open chats becomes Agent chat, with the open-session count badge. Rejected: a header link. Task #972 just emptied the header into the user menu, and the badge already lives there.
Layout. Three columns on a desktop:
| Column | Content |
|---|---|
| Left | The person's sessions (today's OpenChats list: open sessions in every organization, with Resume and Abandon), New chat, and a filter by subject. Collapsible |
| Centre | The runner and model panel above the chat (below), then the chat (sessionChat.jsx: long-poll, waiting clock, transcript with the model under each reply, composer, availability state from section 2) |
| Right, by subject | project_request: today's draft editor, conflict handling and Confirm request, from RequestSession.jsx. task: the item as on /attention/{event} (context header, PR and CI, the one-tap actions) above the plan card with Confirm, from AttentionSession.jsx. general: the plan card once the plan has actions, else a short "what I can do" panel |
Runner and model panel. A compact bar at the top of the chat column of /chat/{id}, for every subject, shows the chosen runner and model ("laptop · medium"). Opening it shows:
- Runner: the eligible runners from availability (section 2) that are online: name, free session slots, and (yours) for an admin's own runners. A held runner is listed as unavailable with the reason ("subscription on hold until 14:30") and cannot be chosen. The chosen runner is always shown, marked offline when it is. Choosing one sends
PATCH /api/sessions/{id}and applies from the next turn; a waiting turn moves with it. - Model: Default (persona's tier), the tiers, then the specific model ids the chosen runner offers, grouped by adapter. Only what the chosen runner offers can be chosen.
- While a turn waits on an offline or held runner, the waiting message links to the panel (Switch runner).
The panel is read-only once the session is closed. A new general session opens with the defaults, and the person can change them before the first message.
Mobile (below 768 px).
- The list is a drawer behind a menu button.
- The runner and model bar stays at the top of the Chat tab and opens as a bottom sheet.
project_requestkeeps its Chat | Draft tabs.taskgets Chat | Item & plan.generalgets Chat | Plan, and the Plan tab appears with a count once the plan has actions.- Confirm stays fixed at the bottom of its tab.
Deep links.
- Build with an agent (project request box) opens or creates the project's request session as today, then navigates to
/chat/{id}. Resume in the request box does the same. - Resolve with an agent (item page and
/attentionlist) opens or resumes the task session (POST /api/tasks/{id}/sessions), then navigates to/chat/{id}. The page's back link returns to the item. - Old URLs redirect:
/organizations/{o}/projects/{p}/requests/sessions/{id}→/chat/{id};/attention/{event}?session={id}→/chat/{id};/chats→/chat. Mattermost notices and bookmarks keep working. - No runner: both buttons stay visible. They open the page, which shows the
no_own_runnerstate, so the person learns why rather than seeing a silently disabled button. The one-tap actions and the classic form remain beside them.
Trade-off. ADR-0015 put the task chat in a sheet so the item stays in view. Here the item moves into the right column of /chat/{id}, with its buttons, so it is still in view. A phone loses the "item above, sheet below" arrangement in favour of tabs.
7. Migration and rollout¶
Existing sessions.
- Open request and task sessions keep their subject, transcript, draft and limits. They appear in
/chat, and their old URLs redirect. - Existing open sessions get the default runner (section 2) when the rule ships, and
modelNULL (the persona's default). Turns pending at that moment wait for that runner. If the owner has none, they expire after 10 minutes as usual. The person sees "You don't own an agent runner" on their next message. - Nothing is converted to
general.
Down migrations. These must keep working (prod runs a merge within about 35 minutes):
- The
generalmigration's down migration deletesgeneralsessions, their messages and turns, then restoresNOT NULLand the subject check. scope_org_idsis dropped.sessions.runner_idandsessions.modelare dropped.
Implementation order.
| # | Repository | Task | Depends on |
|---|---|---|---|
| 0 | — (person) | An administrator adds owners to every runner that should keep answering chats (control room → Runners → Owners). Runners without owners stop answering non-admins' chats at step 1. Less critical for admins, who may choose any in-scope runner | — |
| 1 | taskbase |
Session runner and model: migration (sessions.runner_id, sessions.model), defaults, PATCH /api/sessions/{id}, the claim filter (chosen runner only, eligibility, session model sent in the claim), availability (own_runners, reason_code, chosen_runner_id, runners[] with slots, holds and models), 409 no_own_runner / no_runner_chosen on messages and opening turns, the session's model as the turn's requested model in usage; the UI shows the reasons and a runner and model picker on today's pages |
0 |
| 2 | taskbase |
general subject: migration, POST /api/sessions, limits, PersonaFor, frame (organizations, projects, attention summary), scope_org_ids and the multi-organization TurnScope with its fail-closed tests |
1 |
| 3 | skatzi-agents |
personas/assistant.md (kind: session, default_model: medium) |
— |
| 4 | agent-runner |
Frame without project or organization, organizations[] in the prompt; run the turn on the claim's model; docs and status for runners without owners |
1, 2 |
| 5 | taskbase |
Plan vocabulary: create_task, create_epic, create_project_request, task_ref; PlanChecker and RunPlan for general; MCP save_action_plan for general |
2 |
| 6 | taskbase |
GET /api/projects/{id}/pipeline and MCP get_project_pipeline |
— |
| 7 | taskbase (UI) |
/chat page hosting the three subjects, with the runner and model panel; deep links and redirects; the user menu's Agent chat |
1, 2, 5 |
| 8 | platform |
Docs: Taskbase sessions, authorization, MCP tools; agent-runner chat turns; fill in this ADR's As built; amend ADR-0013/0015 status lines | 7 |
Steps 1 and 6 can ship on their own and are useful without the page.
Architecture diagram (Skatzi platform, id 1). No component is added or removed. Expected updates, made by the implementing tasks:
agent-runner--taskbase-api: the label becomes "register, heartbeat, claims tasks and the session turns it was chosen for, reports runs".taskbase-api--gitea: the label becomes "issue and PR sync, reads PRs, CI and branch pipeline statuses" (step 6).
As built¶
Recorded 2026-10-15 (platform task #992) from the merged code of epic #58. Where this list and the text above differ, this list is right.
| Task | Repository | What shipped |
|---|---|---|
| #980 | — | The project manager's plan: the tasks below |
| #981 | — (person) | Owners added to the runners that keep answering chats |
| #982 | platform PR #292 | This ADR accepted, with the runner and model pickers |
| #983 | Taskbase PR #373 | Session runner and model: migration 67, defaults, PATCH /api/sessions/{id}, the claim filter, availability for the pickers, 409 no_own_runner / no_runner_chosen |
| #984 | Taskbase PR #379 (merged with #993) | The general subject: migration 68, POST /api/sessions, limits, scope_org_ids and the multi-organization turn scope, the general frame |
| #985 | Taskbase PR #381 | The general plan: create_task, create_epic, create_project_request, task_ref / depends_on_ref, task.Service.Create / FileRequest, epic.Service; save_action_plan for general chats |
| #986 | Taskbase PR #372 | GET /api/projects/{id}/pipeline and MCP get_project_pipeline |
| #987 | skatzi-agents PR #19 | The assistant persona (kind: session, default_model: medium) |
| #988 | agent-runner PR #207 | Turns without a project, with organizations[] and the attention summary; turns run on the claim's model; owners shown in status and the desktop app |
| #989 | Taskbase PR #374 | /chat and /chat/{id} for request and task sessions, the runner and model panel, deep links, redirects, Agent chat in the user menu |
| #990 | Taskbase PR #382 | General chats on /chat: New chat, the plan pane with the create actions |
| #991 | — | Architecture diagram labels for chosen-runner turns and branch pipeline reads |
| #993, #997 | Taskbase PRs #379, #380 | General chats' usage per person and runner (GET /api/usage/general-chats), and where the UI shows it (not in the plan above) |
| #992, #995, #996, #998 | platform PRs #295, #296, #298 and this one | Documentation |
Differences from the text above, and details it left open:
- Availability's fields. The pickers' list is
choices[], notrunners[]:{id, name, own, online, free_session_slots, held_subscriptions, models, can_run_model, current}.modelsis a flat list of the tiers and model ids the runner offers (held subscriptions included), not{id, tiers, adapter, held};held_subscriptionsnames the held, usage-limited or capped subscriptions;currentmarks the session's runner (or the one a new session would get), so there is nochosen_runner_id.runnersstays a count.session_id=answers for one session. - The reason codes are
available,no_own_runner,no_runner_chosen,own_runners_offline,own_runners_cannot_serve,own_runners_busyandno_persona.own_runners_cannot_servecovers both "held" and "cannot run the model" (and a person whose runners serve none of the session's organization); there are norunner_held,runner_cannot_run_modelorchosen_runner_ineligiblecodes. no_runner_chosenis only an administrator's. A session without a runner answers409 no_own_runnerto everyone else, because their default is always one of their own runners when one could answer.- A runner that stops being choosable is replaced, not reported. Each message, like opening a session and
PATCH, resolves the choice: a runner the person may no longer choose becomes their default. The claim also leaves a non-admin's pending turn pending when they no longer own the runner. - Default runner. The person's own runner of their most recent session while they may still choose it, else their first own runner that is online, else their first own runner (online or not). Free slots and holds play no part in the default; an administrator who owns none gets none.
PATCH /api/sessions/{id}takesrunner_idand/ormodel: a missing field is kept,"model": nullreturns to the persona's default, andrunner_idcannot be cleared. The opening routes (POST /api/sessions,/projects/{id}/sessions,/tasks/{id}/sessions) take the same two fields. Switching runner keeps the model even when the new runner does not offer it; availability reportsown_runners_cannot_serveuntil the person picks one it offers.- An empty read scope fails the turn. Section 3 says an owner who reaches nothing gets a turn that reads nothing. As built, the claim fails a general turn whose chosen runner serves none of the owner's organizations ("the chat's runner serves none of the organizations you can reach; choose another runner"), and one whose owner no longer exists in Keycloak; without the owner lookup it claims no general turn. A general turn's persona is the first organization of its scope that has it.
- Migrations are 67 and 68. 68 adds, besides the CHECK in section 1,
sessions_scope_pair_check(organization and project both NULL or neither) andsessions_general_subject_check(a general session has nosubject_id), and setsscope_org_idsof turns running at migration time to their session's organization. - The attention summary carries
open(the total), anotethat it is untrusted information, and at most 20 items, newest first, each with the task, project, organization, kind, reason,raised_atand age. - The plan.
depends_on_refstands fordepends_onastask_refstands fortask_id. A ref names only an earliercreate_task, and the action is checked against the task it would create (so requeuing a new task is refused).create_task'spriorityis 0–3. Scope is the turn's organizations when the agent saves and the person's reach when they save or confirm. Confirming a general plan with no actions answers409. A create's result carriescreated(kind, id, title, organization, project, Taskbase link, Gitea issue). A created task or epic gets Created by person from a general chat; drafted with assistant. under its description. - The pipeline.
runisnullwhen none of the last 10 commits has statuses; the head carries its URL;workflows[].jobsmaps job names to states. A project without a repository, or outsidegitea_org, answers400without calling Gitea, an unknown ref404, a Gitea failure502;refis at most 200 characters. - New chat chooses first.
/chatwithout a chat shows the runner and model pickers and opens the general session with the choice (POST /api/sessions), rather than opening it with the defaults. Resolve with an agent without a runner leads to/chat?no_runner=<code>&task=<id>&back=<item>, where an administrator who owns no runner picks one in scope. - agent-runner reads its owners at registration and every 10 minutes and warns when it has none (
agent-runner status:runner owners none: …; an Owners row in the desktop app; a log warning). A tier in the claim, or only arequested_model, becomes the first model of the turn's adapter serving that tier; a Codex turn's usage is reported under the claim's model.
Taskbase's documentation of the shipped behaviour: Agent Sessions (the chat page, choosing the runner and the model, general chats), Authentication — Turn-scoped access, MCP Server, Gitea Integration — Reading a project's pipeline, Runners — Runner owners and Session turns, Database Schema and Usage.
Alternatives considered¶
| Alternative | Verdict |
|---|---|
| Re-model all sessions as one switchable type (section 1, B) | Rejected: it rewrites two shipped subjects for a layout change |
| Keep any runner answering, with a per-person opt-out | Rejected: the request says only their own runner |
| Any owned runner answers, first free wins (the proposal) | Replaced in #979 by a runner chosen per session (section 2) |
| A separate "chat runner" pool | Rejected: ownership already exists (#675), and the request says not to model it again |
| Direct writes by the agent | Rejected (section 4) |
| Gitea Actions API for pipelines | Rejected for now (section 5) |
Consequences¶
- People without a runner lose agent chat. Before, any in-scope runner answered them; now they see why and use the classic form and buttons. This is the request's intent, but it is a visible change for anyone who used Build with an agent without owning a runner.
- Runner owners pay for their own chats on their own subscriptions, on the runner and model they choose. A runner's machine processes only its owners' conversations, and admins' conversations when an admin chooses it.
- A chosen runner that goes offline stalls its session until the person switches; no other runner steps in.
- A
generalturn reads more (every organization the owner reaches). The bound is still the owner's own view, enforced in the guard, and writes still need the person's confirm. - One page replaces three chat surfaces (
RequestSession, the attention sheet,/chats). Their components move into it rather than being rewritten.
Amendments¶
This ADR amends:
- ADR-0013:
- §4: each session has a chosen runner (one the owner owns, or any in-scope runner for an admin) and a chosen model, and only that runner claims its turns.
- §7: a
generalturn reads the set of organizations fixed at claim (owner's reach ∩ the chosen runner's scope), not one organization. - §1: the request chat lives in
/chat/{id}. - ADR-0015:
- §1: the sheet on
/attention/{event}becomes the task view of/chat/{id}. - §7: availability lists the runners the person may choose and reports on the session's chosen runner.
What we deferred (and what would trigger adding it)¶
- Longer turns. A cross-project question may need many tool calls. The 3-minute cap stays until
timeoutturns ofgeneralsessions exceed a few per cent. - CI logs, as in ADR-0015. Revisit if people keep asking "why did it fail?" and the check link is not enough.
- A Gitea Actions view (workflow runs, durations), if Gitea's API is fixed for non-owner tokens and commit statuses prove too coarse.
- Running turns as the person (token exchange), if Taskbase ever gets finer permissions than per organization (as in ADR-0013).
Links¶
- Request #977, epic #58, task #978 (this proposal), decision task #979, planning task #980, amendment task #982
- ADR-0013 — Interactive Agent Sessions
- ADR-0015 — Resolving Needs Attention Items by Agent Chat
- ADR-0006 — Agent Runner and Taskbase as Agent Controller
- Taskbase — Agent Sessions
- Taskbase — Gitea Integration
- Runner owners: Taskbase task #675; control room: milestone #11