Skip to Content
Recodocs

Task page

Read and edit a single ReCoX or Linear task through one consolidated task-page API.

7 min read

The task page API exposes one pair of routes (read and write) plus focused mutations for comments, labels, sub-issues, and relations. A caller works with either a ReCoX-native task (native_task:<id>) or a synced Linear task (linear:<id>); the domain layer assembles the same page shape and routes edits to the system that owns the task.

What this API area is for

A task may be native to RecoX or synced from another system. Its identity tells the API which record the caller means, while the route defines the permitted operation.

Console users open one task as a full page: fields, activity, labels, sub-issues, and relationships. The handlers in this module are thin wrappers around the task-page domain: GET only reads the page; PATCH applies every supplied change key and then returns a rebuilt page; each other route applies its one mutation and returns a rebuilt page. Reads do not require console write trust; every mutating handler calls require_console_write_trust on the incoming request before it runs.

Native ReCoX tasks are read and changed in the local database. Linear tasks are read from the archive plus a live Linear fetch when possible. Linear title, description, status, priority, due date, and assignee edits go through task_collab_runtime or task_update_runtime; expected is forwarded for title, description, status, and assignee only; project_key is rejected here; estimate and cycle are not applied to Linear tasks.

Routes

All paths are rooted at /api/tasks/page. The task_key path segment identifies the task (native_task:… or linear:…).

MethodPathPermissionHandlerWhat it does
GET/{task_key}work.readget_task_pageReturns the full task page for the given key.
PATCH/{task_key}work.writechange_task_pageApplies field changes from the body and returns the updated page.
POST/{task_key}/commentswork.writeadd_task_commentAdds a comment on the task.
PATCH/{task_key}/comments/{comment_id}work.writeedit_task_commentUpdates a native-task comment body.
DELETE/{task_key}/comments/{comment_id}work.writedelete_task_commentSoft-deletes a native-task comment.
POST/{task_key}/sub-issueswork.writeadd_task_sub_issueCreates a new sub-issue under the task.
PUT/{task_key}/labelswork.writechange_task_labelAdds or removes one label.
POST/{task_key}/relationswork.writeadd_task_relationAdds a relation between two ReCoX native tasks.
DELETE/{task_key}/relationswork.writeremove_task_relationRemoves the stored row matching source, target, and relation_type, and also the inverse row with source and target swapped.
POST/{task_key}/sub-issues/link-existingwork.writelink_existing_sub_issueLinks an existing native task as a sub-issue.
PUT/{task_key}/sub-issues/{child_key}/replacework.writereplace_sub_issueReplaces one linked sub-issue with another task.
DELETE/{task_key}/sub-issues/{child_key}work.writeunlink_sub_issueRemoves the parent–child sub-issue link.
POST/{task_key}/sub-issues/{child_key}/promote-to-blockerwork.writepromote_sub_issue_to_blockerUnlinks the sub-issue and records a blocked_by relation from parent to child.

Request models

Each body model forbids extra keys (extra='forbid').

CommentPayload

FieldTypeConstraints
bodystrmin_length=1, max_length=20000

Used by add_task_comment and edit_task_comment.

SubIssuePayload

FieldTypeConstraints
titlestrmin_length=1, max_length=500

Used by add_task_sub_issue.

LabelPayload

FieldTypeConstraints
addstr | Nonedefault=None, max_length=40
removestr | Nonedefault=None, max_length=40

Used by change_task_label. The domain layer requires exactly one of add or remove to be set with a non-empty name.

RelationPayload

FieldTypeConstraints
target_task_keystrmin_length=1
relation_typestrmin_length=1

Used by add_task_relation. Valid relation types in the domain are blocked_by, blocks, relates_to, and duplicate_of; both tasks must be native ReCoX tasks.

RemoveRelationPayload

FieldTypeConstraints
target_task_keystrmin_length=1
relation_typestrmin_length=1

Used by remove_task_relation.

LinkExistingSubIssuePayload

FieldTypeConstraints
child_task_keystrmin_length=1

Used by link_existing_sub_issue.

ReplaceSubIssuePayload

FieldTypeConstraints
new_child_task_keystrmin_length=1

Used by replace_sub_issue. The path supplies child_key for the sub-issue being replaced.

ChangePayload

FieldTypeConstraints
changesdictrequired
expecteddictdefault {}

Used by change_task_page. Allowed change keys in the domain are title, description, status, priority, assignee_email, due_date, project_key, estimate, and cycle. For native tasks, expected.version must be an integer when applying changes.

Response model

Successful handlers return a dict produced by task_page.page (after mutations, the same shape refreshed). Common top-level fields include:

FieldTypeMeaning
task_keystrCanonical key (native_task:… or linear:…).
sourcestr"native" or "linear".
key_labelstrShort display id.
urlstr | NoneExternal URL when applicable (Linear).
titlestrTask title.
descriptionstrTask description.
statusstrCurrent status.
prioritystr | NonePriority when set.
assigneeobject | None{ "name", "email" } when assigned.
estimatenumber | NonePlanning estimate when set.
cycleobject | None{ "name", "number" } when set.
due_datestr | NoneDue date.
projectobject | NoneProject key and name.
teamstr | NoneTeam name (Linear).
labelslistLabel objects with id, name, and optional color.
parentobject | NoneParent task summary when present.
sub_issueslistSub-issues include task_key (null for a Linear child not yet in the archive), key_label, title, status, assignee_name, and due_date.
relationslistRelated native tasks (native pages only).
activitylistTimeline of events and comments.
versionint | NoneOptimistic version for native tasks.
researchanyResearch attachment when present on native tasks.
editabledictBooleans per field indicating what the current caller may edit on the page.
noteslistHuman-readable caveats (for example stale Linear sync or tasks ReCoX keeps itself).

Activity items use kind "event" or "comment" with fields such as id, at, actor, icon, text, or comment body and edited.

Behaviour and errors

Task key. After the key is stripped, it is accepted only when it starts with native_task: or linear: and has a non-empty id after that prefix; otherwise the domain raises LookupError with message Unknown task.

Writable checks. Before edits, _writable requires work.write on the caller’s authorization snapshot. For native keys, if the task type’s handler is lab or experiment, lab.write is also required. Failure surfaces as PermissionError with messages such as You do not have permission to edit this task or You do not have permission to comment on this task.

HTTP mapping. Handler helpers map caught ValueError, LookupError, and PermissionError, plus native_tasks.TaskConflict, through _error:

  • LookupError → 404
  • PermissionError → 403
  • TaskConflict → 409 (detail code conflict)
  • Other caught errors → 400 (detail code invalid)

Detail bodies use error_body with the exception string as the message.

Domain validation. Unknown or empty changes, a missing integer expected.version, invalid native priority, self-relations, bad relation types, blocker cycles, comment text, and label rules raise TaskPageError and map to 400; editing or deleting a Linear comment raises TaskConflict and maps to 409.

Trashed native tasks. Reads and several mutations raise LookupError when the native task is in Trash.

Comment edits. On native tasks, only the comment author or an admin (snap.role == principal.ADMIN) may edit or delete; others get CommentForbidden (PermissionError).

Console route gate. Separately from handler logic, signed-in users pass through gate, which checks ROUTE_PERMISSIONS for the endpoint key. A missing permission entry or a denied policy decision yields HTTP 403 with a denied error payload.

Pydantic. Invalid request bodies fail FastAPI validation before handlers run.

How the permission model applies

route_roles.py lists a ceiling permission per console endpoint. For this module, get_task_page requires work.read; every other handler listed above requires work.write. The table is enforced at startup (require_complete) and per request (gate): a signed-in user whose role does not hold the route permission is refused before the handler runs.

That ceiling does not replace narrower checks inside this module. _writable can deny edits even when work.write passed the gate—for example when a native lab or experiment task also requires lab.write. Mutators can still refuse Linear TaskConflicts and relation rules; a Linear task ReCoX keeps is only marked non-editable on read, and these write functions do not check that flag. Documented route permissions are therefore necessary but not sufficient for every mutation to succeed.

How is this page?

Last updated on