Skip to content

linearbot keeps working an issue after it is un-delegated #1559

Description

@0xAlcibiades

Taking an issue back from linearbot has no effect. The bot finishes the turn
regardless, holding a sandbox for work nobody wants any more.

Why nothing happens

parseIssueAssignmentWebhook returns null unless the issue is currently
assigned or delegated to the bot:

const assignedToBot = stringValue(data.assigneeId) === botUserId;
const delegatedToBot = stringValue(data.delegateId) === botUserId;
if (!assignedToBot && !delegatedToBot) return null;

An un-delegation webhook is precisely the payload where both are false, so the
event that means "stop" is the one the parser drops. Nothing else in linearbot
watches Issue updates, so it is discarded outright.

What that costs

Two shapes, depending on how far along the turn is.

Not started yet. A handoff turn does not begin the instant the webhook
lands — it waits its place among concurrent handoffs, then spends seconds
fetching issue context and spawning a sandbox. Un-delegate inside that window
and the turn still starts afterwards: the bot posts on an issue it no longer
holds, and moves it to In Progress.

Already running. The execution runs to completion. Its sandbox counts
against --session-sandbox-running-limit the whole time, so on a busy fleet an
abandoned turn is refusing admission to a real one, and the answer lands on an
issue whose owner changed while it was being written.

Suggested behaviour

Un-assigned and un-delegated is a release. Drop a turn that has not started
(nothing posted, no sandbox, so never starting is the whole cleanup) and
interrupt one that has via POST /api/session/{thread_key}/interrupt, which
already exists and ends the execution so the sandbox falls to the normal idle
reclaim.

Two cases that should NOT count as a release: losing one field while still
holding the other (a delegate that is still the assignee is still meant to be
working), and the bot releasing the issue itself, which is how an agent
normally signs off at the end of a turn.

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