Skip to content

[bug] taskboard_delete ignores the exclusive-hold gate: any session can trash a card another session is working on #85

Closed

Description

@timacek

What happens

The exclusive-hold check exists only in taskboard_move:

src/host/tools.ts:765-770:

// Exclusive hold: while a task is in_progress under a session ...
if (task.status === 'in_progress' && task.claimedBy !== undefined && task.claimedBy !== actor.sessionId) {
  throw new ToolError(ERR.forbidden, `task is held by session ${task.claimedBy}; never take over another session's claim`)
}

taskboard_delete (src/host/tools.ts:907-927) calls caller(...), checks only for a running
execution record, and then trashes the task and clears the claim:

caller(exec as ToolRunContext)
...
if (task.executions.some(e => e.outcome === 'running')) { throw ... }
next = structuredClone(task)
next.trashedAt = deps.now()
delete next.claimedBy
delete next.claimedAt

So any session — including one in a different project, which taskboard_move rejects with
forbidden/workspace_mismatch — can soft-delete a card that another session claimed through
todo → in_progress (the normal claim-first agent flow, with no execution record). Afterwards the
holder's taskboard_get/taskboard_move fail with not_found, and the card disappears into the
trash. The GUI has no un-trash action (only "purge" for the deleted column), so recovering it means
restoring the ledger/JSON.

The neighboring mutators taskboard_update, taskboard_comment_add and taskboard_checklist also
lack the hold/project gate, but only delete is destructive and irreversible from the board.

Verification

Reproduced with the real registerTaskboardTools + TaskStore and an outsider session
(cwd: /proj/b), task claimed by session A in /proj/a:

  • taskboard_move → forbidden (correct);
  • taskboard_delete({id, ifVersion}) → {"trashed":true};
  • stored record after the delete: { trashedAt: 7000, status: 'in_progress', claimedBy: undefined }.

Environment

Suggested fix

Copy the move holder guard into delete (and decide explicitly whether update/comment_add/
checklist should stay open or be gated too — right now the rule is implicit). For delete, also
consider requiring the same claim scope as claiming: the caller's project (or a linked root when
allowClaimFromLinkedRoots is on) must own the task. A small regression test mirroring the
existing move-boundary tests would pin it.

Dedupe

#40 is a stale holder blocking reruns, #29 is bulk-delete UI, #62 is linked-root claiming. Nothing
covers deleting another session's held card.

Activity

  1. cloader commented on Nov 1, 2026

    @cloader
    Owner

    Thanks for the detailed reproduction. This was fixed in #86 using the same exclusive-hold rule as taskboard_move, and is included in v0.9.8.

    • When a task is in_progress and claimed by another session, taskboard_delete returns forbidden. This applies to other sessions in both the same project and a different project; the task and its claim remain intact.
    • The holder may still soft-delete a task with no running execution, provided the version check passes.
    • If an execution record is still running, deletion remains blocked for every session, including the holder, until that execution is cancelled or settles.
    • This fix focuses on exclusive-hold protection. Deletion permissions for unclaimed tasks, other editing tools, and GUI user controls retain their existing behavior.

    move and delete share the same guard, which runs inside the ledger write lock against the latest task record, so a stale cached holder cannot bypass the check.

    Validation: typecheck and full build passed. After syncing with the updated dev branch, all 662 tests in 50 files passed, and GitHub CI passed on Node 22.x and 26.x, including the final main commit. Regression coverage includes same-project and cross-project sessions, holder deletion, version conflicts, running execution protection, and a holder changed on disk behind a stale store. An initial parallel test run hit a scheduler lifecycle timeout; that file passed independently, and the full suite passed with reduced concurrency.

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