Skip to content

feat(eve): linear - exclude other agents' threads from the dispatched turn - #1452

Open
lucasdoell wants to merge 6 commits into
vercel:mainfrom
lucasdoell:linear-exclude-other-threads
Open

feat(eve): linear - exclude other agents' threads from the dispatched turn#1452
lucasdoell wants to merge 6 commits into
vercel:mainfrom
lucasdoell:linear-exclude-other-threads

Conversation

@lucasdoell

Copy link
Copy Markdown

Description

Closes #1226.

On multi-agent Linear issues, Linear's AgentSessionEvent.promptContext includes every agent's conversation threads (<other-thread> blocks), and linearChannel passed it verbatim as the turn message while unconditionally spreading previousComments into context — leaking other sessions' instructions and state into the model-visible turn.

This PR adds, per the design in research/linear-exclude-other-threads.md (included in this branch):

  • linearChannel({ excludeOtherThreads: true }) — strips <other-thread> blocks from the default turn message. Fail-closed: on malformed or drifted markup (including a comment body embedding a literal </other-thread>), the message falls back to the session summary / issue title instead of leaking partial thread content, with a logged warning. An O(n) tag-count guard short-circuits adversarial inputs before the regex runs.
  • onAgentSession can now return message (replaces the computed turn message; wins over the flag; empty/whitespace overrides are ignored) and previousComments (replaces the webhook's previous comments; [] drops them). The flag deliberately does not touch previousComments — those are the primary thread's own prior comments.
  • New public exports stripLinearOtherThreads and LinearMessageOptions (options parameter on messageFromLinearAgentSessionEvent).
  • Docs: new "Excluding other agents' threads" section in docs/channels/linear.mdx documenting the exposure and the composed-defaultOnAgentSession recipe.

How did you test your changes?

  • pnpm --filter eve exec vitest run --config vitest.unit.config.ts src/public/channels/linear/ — 48 tests passing, including 21 new: fail-closed stripping (attribute-bearing fixtures modeled on Linear's documented format, unpaired-tag and embedded-literal attack cases), fallback chain, and full webhook→dispatch tests for the flag, override precedence, empty-override normalization, previousComments semantics, and image attachment on overridden messages
  • pnpm test (full unit + integration suite), pnpm typecheck, pnpm lint, pnpm fmt, pnpm docs:check, pnpm guard:invariants

PR Checklist

  • I linked an issue with prior discussion confirming this change is wanted
  • I ran the relevant checks from CONTRIBUTING.md
  • I added tests and documentation where relevant
  • I added a changeset if this touches the published eve package
  • DCO sign-off passes for every commit (git commit --signoff)

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@lucasdoell is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

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.

linearChannel: no way to exclude other comment threads (promptContext / previousComments) from the dispatched turn

1 participant