Skip to content

fix(linear): approval notices and approve/deny replies on Linear issues - #1014

Closed
isadeks wants to merge 3 commits into
mainfrom
fix/1001-linear-approval-notices-and-replies
Closed

isadeks wants to merge 3 commits into
mainfrom
fix/1001-linear-approval-notices-and-replies

Conversation

@isadeks

@isadeks isadeks commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Closes #1001.

Until now, a Linear user had no way to see that their task was paused for approval, and no way to answer from Linear. On main, approval_requested fans out to Slack and email only.

What changes for Linear users

  • Notice: when an approval gate opens on a Linear-triggered task, ABCA posts one notice on the issue. It names the requested action, the reason and the deadline, and says how to answer.
  • Outcome: when the gate is approved, denied, timed out or stranded, ABCA posts one outcome comment. Cancellation is covered by the existing terminal comment, which also closes the reply thread.
  • Answering in Linear: the issue's linked task owner replies approve or deny [reason] to the notice.
    • The decision is recorded through the same code as the API/CLI (recordApprovalForUser / recordDenialForUser), so consent, owner checks and the audit event are identical. The decision source is recorded as Linear.
    • ABCA acknowledges in the same thread.
    • Ambiguous text such as approve because, denied or denyall is rejected.

Safety

  • The webhook signature path is unchanged.
  • A reply is acted on only:
    • in a thread ABCA created, and only after the comment has been re-read from Linear;
    • when it comes from neither a bot actor nor the app;
    • when its issue, parent and body all match.
  • The replier must map to the platform user who owns the task. The task is re-checked with a consistent read (owner, channel_source=linear, workspace, issue).
  • Non-owners get a same-thread refusal. Stale or duplicate replies get "already closed", and a retry after a successful write isn't recorded twice.
  • Notice comment IDs are derived from a hash, so a retry can't post a second notice.
  • API and CLI callers of approve/deny are unchanged.

Wiring

  • Approval events route to the Linear dispatcher; Slack's own filter still drops them.
  • The webhook processor tries the approval-reply handler before the @bgagent path.
  • The approvals table is wired to LinearIntegration (processor read/write) and FanOutConsumer (GetItem/UpdateItem). No new CloudFormation resources, only env vars and IAM statements.
  • Jest gets a moduleNameMapper for .js-suffixed imports under nodenext.
  • Linear setup guide: a new "Approval gates" section.

Tests

  • CDK: 5,958 passed.
  • Covered: reply parsing, the thread mapping, notice rendering and idempotency, fan-out routing, processor routing, both constructs, and the decision source on approve/deny.
  • Census, drift, eslint and the docs build are green.

Known limits

…es (#1001)

Post an approval-request notice on the task's Linear issue when a Cedar
gate opens, and one outcome comment when it resolves (approved, denied,
timed out, stranded). Notices go through the existing fan-out Linear
dispatcher and workspace token resolver, are rendered from the saved
approval row, and are idempotent per request via delivery markers and
deterministic comment IDs.

The linked task owner can reply `approve` or `deny [reason]` to the
notice. The processor re-reads the comment from Linear (bot actors, the
app's own identity, and issue/parent/body mismatches are ignored),
checks the replier maps to the task owner, and records the decision
through the same approve/deny code path as the API, tagged with a
Linear decision_source. Non-owner, stale and duplicate replies get a
same-thread explanation. API and CLI behaviour is unchanged; webhook
signature verification is untouched. No new CloudFormation resources.
@isadeks
isadeks requested review from a team and backgroundagents as code owners November 5, 2026 15:51
- approval-notifications: render the notice text in two helpers, so
  loadApprovalNotification is under the complexity ceiling of 40 (was 46)
- fanout: move the Linear approval notice and the ended-task thread close out of
  dispatchToLinear (was 42)
- pin cdk's jest moduleNameMapper in contracts/coverage-thresholds.json. The
  decision handlers are imported lazily with a .js extension (they validate their
  environment at load, and nodenext needs the extension on a dynamic import), so
  jest maps "./x.js" to "./x". The mapper resolves file names only: it changes no
  floor, no measured file and no test command. It needs a maintainer's agreement.

The moved code is unchanged.
@isadeks

isadeks commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #1067, which carries this change (its commits are kept as they were, followed by one commit that adapts the combined set to current main). Closing to keep one place for review.

@isadeks isadeks closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(linear): no notice that an approval is pending, and no approve/deny from Linear

1 participant