feat: Linear chat ingress (linearbot)#541
Draft
0xdiid wants to merge 4 commits into
Draft
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.