Skip to content

Auto-attach agent deliverables to the originating Linear issue#1214

Open
alicejt wants to merge 2 commits into
cyrusagents:mainfrom
alicejt:feature/auto-attach-deliverables
Open

Auto-attach agent deliverables to the originating Linear issue#1214
alicejt wants to merge 2 commits into
cyrusagents:mainfrom
alicejt:feature/auto-attach-deliverables

Conversation

@alicejt
Copy link
Copy Markdown

@alicejt alicejt commented May 14, 2026

What this does

When an issue-bound agent session completes, the deliverable files the agent created or modified in its worktree are uploaded to Linear and attached to the originating issue — so the work is one click away on the issue instead of buried in a git branch or PR.

How it works

  • deliverables.ts — pure, unit-tested helpers: DELIVERABLE_EXTENSIONS (documents + images: .md, .pdf, .docx, .csv, .xlsx, .png, …), parseGitPorcelain, filterDeliverables (extension allowlist + excludes node_modules/dist/build/coverage, lockfiles, dotfiles, CHANGELOG.md), contentTypeForFile.
  • GitService.detectDeliverables(worktreePath) — runs git status --porcelain, filters, resolves to existing absolute paths. Best-effort: a git failure returns [] rather than throwing.
  • IIssueTrackerService.createAttachment + AttachmentCreateRequest/AttachmentCreateResponse — implemented in LinearIssueTrackerService (Linear attachmentCreate mutation), stubbed in CLIIssueTrackerService. (requestFileUpload already existed.)
  • AgentSessionManager gains an optional onSessionDeliverables hook, fired after addResultEntry on successful completion, wrapped so a failure never blocks the session.
  • EdgeWorker.handleSessionDeliverables — detect → requestFileUpload → PUT bytes → createAttachment, per file.

Safety / scope

  • Worktree-only. Worktree-free sessions (Slack, and the Project Update chat sessions) no-op immediately.
  • Best-effort. Every failure is logged and swallowed — a session always completes normally.
  • Files > 10 MB are skipped (Linear's per-file limit); the batch is capped at 10 files.
  • Issue-bound sessions only; requires the session to resolve to a Linear issue + tracker.

Testing

  • 15 unit tests for the detection/filter helpers (porcelain parsing, extension allowlist, noise exclusion, MIME mapping).
  • pnpm build + pnpm typecheck clean across the monorepo; full edge-worker suite shows no new failures (the pre-existing runner-selection / screenshot-upload-hooks failures on main are unrelated).

🤖 Generated with Claude Code

alicejt and others added 2 commits May 14, 2026 13:54
When an issue-bound agent session completes, deliverable files the agent
created or modified in its worktree are uploaded to Linear and attached
to the issue — so the work is one click away on the issue instead of
buried in a git branch or PR.

- deliverables.ts: pure detection helpers — DELIVERABLE_EXTENSIONS,
  parseGitPorcelain, filterDeliverables (extension allowlist + noise
  exclusion: node_modules/dist/build/coverage, lockfiles, dotfiles,
  CHANGELOG), contentTypeForFile.
- GitService.detectDeliverables(worktreePath): runs `git status
  --porcelain`, filters, resolves to existing absolute paths. Best-effort
  — git failure returns [] rather than throwing.
- IIssueTrackerService.createAttachment + AttachmentCreateRequest/Response
  types; implemented in LinearIssueTrackerService (Linear attachmentCreate
  mutation), stubbed in CLIIssueTrackerService.
- AgentSessionManager gains an optional onSessionDeliverables hook, fired
  after addResultEntry on successful completion, wrapped so a failure
  never blocks the session.
- EdgeWorker.handleSessionDeliverables: detect → requestFileUpload → PUT
  bytes → createAttachment, per file. Worktree-free sessions (Slack,
  Project Update chats) no-op; files >10MB skipped; batch capped at 10.
- Unit tests for the detection/filter helpers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <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