Skip to content

feat: Linear chat ingress (linearbot)#541

Draft
0xdiid wants to merge 4 commits into
paradigmxyz:mainfrom
0xSplits:feat/linear-chat-ingress
Draft

feat: Linear chat ingress (linearbot)#541
0xdiid wants to merge 4 commits into
paradigmxyz:mainfrom
0xSplits:feat/linear-chat-ingress

Conversation

@0xdiid

@0xdiid 0xdiid commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Adds a Linear agent ingress for centaur, mirroring the Slack bot's session model but speaking Linear's native agents platform: delegate an issue to the bot or mention it and it drives the session with native thought/action/response activities, finishing with exactly one response.

Delegation is treated as ownership: a bare delegation with no written prompt gets a synthesized work instruction, the issue moves to In Progress when work kicks off, and the agent settles the final status itself (or signals it with a marker line the bot applies). Plain comments on the issue flow into the session as context, and a small adapter patch keeps one session per thread, accepts sessions with no trigger comment, and stops automation-created sessions from being mistaken for the bot's own messages.

Comes with unit suites plus an emulate-style harness driving the real patched adapter end to end.

0xdiid and others added 4 commits June 11, 2026 23:43
New services/linearbot — a deliberate clone of slackbotv2 (session logic,
webhook 503-redelivery, render obligations + recovery) wired to Linear's
agents platform via @chat-adapter/linear in agent-sessions mode:

- Context-first: the initial turn prepends Linear's promptContext blob
  (or a subject-derived fallback) before the session comment thread.
- Native activity rendering, append-only: ephemeral working thought as the
  10s acknowledgement, reasoning as thought activities (min-gap merged,
  budget-capped), commands as action activities, and exactly one terminal
  response (or error) activity per run.
- Execute runs inside the background render (discordbot model) so the
  webhook acks fast; crash-mid-handoff threads unwedge via the
  activeExecution TTL.
- patches/@chat-adapter__linear@4.30.0.patch keeps one stable thread key
  per agent session (upstream split every prompted follow-up into a fresh
  thread, spawning a new centaur session per reply).
- Deploy plumbing: Dockerfile, chart template + values + ingress path +
  networkpolicies (disabled by default), publish-images matrix entry, CI
  job, optional LINEAR_* secrets in the bootstrap script.
- Tests: unit suites plus an emulate-style harness (fake Linear GraphQL
  API + mock api-rs + signed webhooks) driving the real patched adapter.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Scenario pass over the Linear ingress UX:

- Empty delegation prompts (bare delegation, description mention) synthesize
  an explicit work instruction instead of executing ""/"continue" — with the
  ownership contract: keep the issue's workflow status honest via the sandbox
  linear tool, Linear-Status marker as backstop, recurring-task continuity
  hint, no self-delegation.
- Delegated issues (only — mentions never move status) go Todo→In Progress
  when work kicks off; the agent's terminal `Linear-Status: …` marker is
  stripped from the posted answer and applied best-effort.
- Adapter patch v2: created events without a root comment no longer drop
  (synthesized empty trigger comment), and creator-less sessions (triage
  automation, other agents) attribute to `linear-automation` instead of the
  bot itself — upstream's self-attribution made the chat SDK skip every
  automation-created session as a self-message.
- Plain issue comments forward into the issue's agent-session threads as
  append-only context (session-thread replies and bot comments skipped);
  Comments webhook subscription now required.
- Defense-in-depth isMe guard in the mention/subscribed handlers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
# Conflicts:
#	.github/workflows/ci.yml
#	contrib/chart/templates/networkpolicy.yaml
#	pnpm-lock.yaml
#	pnpm-workspace.yaml
…botv2 paradigmxyz#522)

The startup recovery sweep raced live renders: commitExecutionStarted
indexes the render obligation before the live render starts, and a sweep
pass landing mid-render claimed it and posted the same answer twice. Live
renders now take the per-thread recovery lease before the obligation is
written, refresh it every 60s (agent turns outlive the 2min TTL), and
release it when the render settles; the sweep lease-skips active threads.
Crash-safe: TTL expiry hands the obligation to recovery. Recovery claim
timeouts now also count toward the abandonment budget so permanently-hung
obligations drain instead of keeping the sweep spinning.

Regression test: a second instance's startup sweep scans while the live
render is held in-flight; without the fix two renderers consume the
execution.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant