Repository navigation
[3556 by Claude Opus 5.5] Official plugin: Linear (start work from a ticket, keep the ticket in sync) - #3587
Conversation
…ttings form load its choices from the service. Every suite I ran passes, but nothing has been tried against a real Linear workspace; the README has a manual checklist for that.
Tests run:
- Plugins package: 75 tests, plus `plugins:check` ("6 plugins checked").
- Core plugin suites: 162 tests, including the new Linear one through ProPR's real webhook receiver.
- API plugin routes and OpenAPI checks: 34 tests (they need `PROPR_DEMO_MODE=true`, like the other root-run suites); `gen:openapi:check` passes.
- Shared manifest tests: 21. Plugins page UI tests: 68.
- Typechecks for every package, zero-warning lint on the changed files, and the docs build. The docs build first failed on placeholder links in the new page; I fixed those.
I also broke the code twice on purpose (turned off the duplicate check, and the escaping of HTML in ticket text); the tests failed both times. I did not run the full repository suite or the existing Plugins Playwright specs.
Settings data source
- Manifest: a text setting or a repository map can now name an `optionsFrom` handler. Combining it with an `enum` or a `format` is refused.
- Handler: it receives `{ kind: 'setting_options', setting }` and returns either the choices or a `notConnected` message.
- API: `GET /api/instance/plugins/v1/:pluginId/settings/:settingKey/options`, administrators only. It runs the handler through `ctx.http` even before the plugin is enabled; `ctx.propr` still needs the plugin enabled.
- Form: these fields become drop-down lists. When the choices can't be loaded, the field says why ("Set the Linear API key under Connections…") and has a Reload choices button.
- API key format: a token connection can now say `"authorization": "plain"`. Linear's docs say personal API keys go in `Authorization` without the word `Bearer`.
Linear plugin (`packages/plugins/linear/`)
- Start: adding the label (`propr` by default) to a ticket in a mapped team or project creates one GitHub issue with the ticket key and title, the description, a link back to the ticket and only the `AI` label.
- Duplicates: the ticket-to-issue link is kept by ticket id. ProPR refuses a repeated `Linear-Delivery` id before the plugin runs. Retries, re-adding the label later and simultaneous deliveries create nothing more.
- Ticket text: it becomes the issue's title and body and nothing else. The description is quoted, with HTML, hidden `<!-- … -->` markers and @-mentions made harmless. It is not logged or sent anywhere else.
- Sync-back: seven comment kinds, each switchable: issue created, task started, pull request opened, review reached its goal, merged, closed, and task failed. The ticket can also move to a chosen workflow state when the pull request opens and when it merges.
- Missing state: a state name the ticket's team doesn't have shows a warning in Activity, and the comment and later events go ahead.
- Agent context: Linear's read-only MCP server (`https://mcp.linear.app/mcp/readonly`, signed in with the same API key) and a `linear-ticket` skill.
- Shared helper: issue creation, duplicate handling and the sync-back switches are in `packages/plugins/_shared/tracker.ts` and `trackerLinks.ts`, for the Jira plugin to reuse.
Things to know:
- Label-change payload: Linear's webhook docs don't show how a label change appears in the payload's record of previous values (`updatedFrom`). The plugin reads the ticket's current labels and `updatedFrom.labelIds`; only the fixtures confirm this so far.
- MCP tool names: these come from a third-party registry listing. Linear's own docs list none, but the read-only address only offers read tools whatever the list says.
- Matching pull requests: a pull request is tied to its ticket by the issue number its branch name starts with (`41/…`), which is how ProPR names branches.
- Memory limit: the plugin keeps over a thousand tickets. When full it forgets the oldest, and re-adding the label to a forgotten ticket would create a second issue. The README says so.
- Test helper: `pluginHandlerFixture` now takes a `connections` option, because Linear can't be enabled until its API key is set.
I captured four previews of the Configure step using Linear's real settings with mocked API data: the "not connected" message and the loaded choices, at desktop and phone widths. The temporary spec is deleted.
Acceptance criteria
- AC1: met — `packages/plugins/test/linear.test.ts` (one issue with the link and trigger label; replays, re-added labels and simultaneous deliveries create nothing more; unmapped tickets, other label changes, edits, removed labels and comments do nothing) and `packages/core/test/linearPluginWebhooks.test.ts` (an invalid or missing signature gets 401 and no handler runs; a repeated `Linear-Delivery` gets 409)
- AC2: met — `packages/plugins/test/linear.test.ts` ("each sync-back event posts its comment when switched on, once, and nothing when off" and "the ticket moves to the configured states…; a missing state is reported and blocks nothing")
- AC3: met — `packages/plugins/test/linear.test.ts` (teams, projects and state choices, and the not-connected message), `packages/core/test/linearPluginWebhooks.test.ts` (choices loaded through the real `ctx.http` before the plugin is enabled; 409 without the key), `packages/api/test/pluginSettingOptionsRoutes.test.ts` (non-administrators get 403, signed-out requests 401) and `propr-ui/src/pages/PluginsPage/PluginSettingOptions.test.tsx` (the form's lists and its error)
- AC4: met — `packages/plugins/test/linear.test.ts` ("ticket text cannot affect the repository, the labels or the model…", using the `injection` fixture)
- AC5: met — `packages/plugins/test/linear.test.ts` (the sentinel test: ticket text is absent from Linear requests, logs, results and stored state; the comment tests check fixed wording) and `packages/core/test/linearPluginWebhooks.test.ts` (ticket text not in Activity)
- AC6: met — `packages/plugins/linear/README.md` (setup, permissions and API key access, manual checklist, Linear doc links) and `docs/docs/plugins/linear.md`
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds Linear intake, progress synchronization, and service-backed settings choices with substantial fixture coverage. It needs changes before merge because concurrent deliveries can overwrite ticket links, breaking deduplication and sync-back. ✅ Administrator-only configuration — The options route checks durable administrator authority before running a handler. ✅ Credential handling — Linear requests use the existing guarded HTTP client, with explicit plain-token authorization and integration coverage. ✅ Controlled issue routing — Repository and labels come from settings; ticket descriptions are escaped and quoted. This review used static analysis only, as requested. Current checks report 34 passed, none failed, and one pending. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Concurrent deliveries overwrite ticket links
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Capture real Linear payloadsThe README explicitly identifies ScoreThe authorization boundaries and broad fixture coverage are strong, but the shared-state overwrite can lose synchronization and create duplicate GitHub issues. The passing checks do not cover this distinct-ticket concurrency case. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
🛑 Execution Cancelled The task processing was stopped by user request. You can post a new comment to restart processing. |
…ean for root `src/`, core and shared. The 7 new test files and about 130 affected existing suites pass. What caused the #3556 sequence (for the PR description) I traced this from the issue's label timeline: 1. 16:57:52 – The weekly-limit message `resets Nov 18, 4pm (UTC)` didn't match the reset parser, which only handled `resets 4pm (UTC)`. It fell back to "next hour + 2 min", which produced "Reset time: 5:02 PM UTC" next to the weekly limit. 2. Seconds later (6–50 s) – To mark the wait, ProPR added `AI-waiting` and removed `AI-processing`. The webhook handles that label event like any unrelated one: it reads the issue's current labels and admits it unless an exclusion label is present. The exclusion list had `-processing`, `-done` and `-cancelled`, but not `-waiting` (the poller does exclude it). So ProPR's own label swap started a new task. Each new task hit the limit again and scheduled one more delayed retry. 3. "approximately 2 hours" then "less than an hour" – The same 6:02 PM reset was rounded with `ceil` in one notice and as "< 1 hour" in the next. 4. 18:02, after `AI-done` and PR #3587 – The three delayed retries woke up. Each was a child of the original dispatch, holding a snapshot of the labels from before `AI-done`. The "a sibling model set AI-done, keep going" exemption let all three start. The later cancel stopped all three, and each posted its own "Execution Cancelled". Changes by point 1. Reviews: A failed or invalid review now states one reason, carries `error="true"`, has no `/fix` block, links the task, and is counted as failed. The summary now reads "Posted 0 reviews, 1 failed". 2. Failure comments: These now give a one-sentence cause ("Provider authentication failed.", "The agent process stopped unexpectedly.") plus a task link. Container paths, HTML titles, `Comment ID: 0` and the `<synthetic>` model line are gone. An identical failure on the same PR and head within an hour updates the first comment with an occurrence count. This applies to merge-conflict, PR follow-up and issue failures. For follow-ups, the repeat's starting comment shrinks to a one-line pointer so its comment-ID receipts survive. 3. PR bodies: The "Detailed Logs" paths and "Latest Conversation Messages" block are replaced by `[View task details and logs](task page)`. The log files are still written. 4. CI failures: - Each head commit gets one comment, and later failures of that commit are added to it. - An aggregate job such as "Run Full Test Suite" is dropped when one of its own shards is listed. This is matched by name. - The "Commit:" link now points to the commit. - When ProPR edits that comment, a follow-up already queued or running is no longer aborted and restarted. 5. Rate limits: - `-waiting` is now in the webhook exclusion list. - Dated resets (`resets Nov 18, 4pm (UTC)`) now parse. - The notice shows one reset time tied to the named limit, an exact time remaining, and "Retry: once, at …". It no longer presents an estimate as the provider's reset time. - The retry is never scheduled before the stated reset. - A second task of the same issue run doesn't schedule another retry or post another notice. - A rate-limit retry skips an issue that already has `AI-done`. - Repeated start and cancel notices for the same event within 30 s are posted once. 6. Labels and ids: PR labels are added only if missing, re-checked on each attempt. The `-undefined-` task ids came from comments with no `updated_at`; those ids now omit that part. What's left - Point 5, "retried once": at most one retry is pending at a time per issue. A retry that hits the limit again schedules one more retry after the new reset; there is no hard cap of one in total. - Point 6, `AI` + `AI-done`: the current completion code already removes `AI` after adding `AI-done`, and I added a test for that. The closed issues showing both labels (e.g. #3531) have the label order of an older code path. I didn't change behaviour here. - Point 4, duplicate follow-up runs: there is no separate queued/running check for CI follow-ups on a different code path. With one comment per head, the comment itself is the guard. - Start notice: two genuine restarts of the same agent, model and branch within 30 s would also share one start comment. Things to know when reviewing - I changed six existing tests on purpose: - Three `reviewCommentFormatter` tests checked metadata using reviewer output that was invalid, which now renders as a failure, so they now use valid output. - `ciFailureFollowup` now counts only the per-check claim keys, because the new per-commit lock adds Redis calls. - `taskSubmissionLifecycle` and `issueUsageLimitRetry` mocks recorded the new comment lookup as a posted comment. - `redactSecrets` checked placeholders in the conversation preview, which is no longer published. - The `commentEventHandler` / `followupAssignmentGate` suites need `GIT_CLONES_BASE_PATH` and `GIT_WORKTREES_BASE_PATH` set here, because `/tmp/git-processor` is read-only in this container. - `goalContinuation` and `processGoalJob` failed after my parallel test runs left a half-migrated `data/propr.test.sqlite`. I moved it to `/tmp/staledb`, and both passed on rerun. - No visual previews: these changes are GitHub comment text, not app UI.
AI Implementation Summary
Closes #3556
Branch:
3556/claude-opus-5-5-official-plugin-linear-st-20261116-1705-o2fCommits: ✅ Changes committed (37d38f4)
AI Processing Completed
Execution Details:
Summary:
I've built the Linear plugin and added
optionsFrom, which lets a settings form load its choices from the service. Every suite I ran passes, but nothing has been tried against a real Linear workspace; the README has a manual checklist for that.Tests run:
plugins:check("6 plugins checked").PROPR_DEMO_MODE=true, like the other root-run suites);gen:openapi:checkpasses.I also broke the code twice on purpose (turned off the duplicate check, and the escaping of HTML in ticket text); the tests failed both times. I did not run the full repository suite or the existing Plugins Playwright specs.
Settings data source
optionsFromhandler. Combining it with anenumor aformatis refused.{ kind: 'setting_options', setting }and returns either the choices or anotConnectedmessage.GET /api/instance/plugins/v1/:pluginId/settings/:settingKey/options, administrators only. It runs the handler throughctx.httpeven before the plugin is enabled;ctx.proprstill needs the plugin enabled."authorization": "plain". Linear's docs say personal API keys go inAuthorizationwithout the wordBearer.Linear plugin (
packages/plugins/linear/)proprby default) to a ticket in a mapped team or project creates one GitHub issue with the ticket key and title, the description, a link back to the ticket and only theAIlabel.Linear-Deliveryid before the plugin runs. Retries, re-adding the label later and simultaneous deliveries create nothing more.<!-- … -->markers and @-mentions made harmless. It is not logged or sent anywhere else.https://mcp.linear.app/mcp/readonly, signed in with the same API key) and alinear-ticketskill.packages/plugins/_shared/tracker.tsandtrackerLinks.ts, for the Jira plugin to reuse.Things to know:
updatedFrom). The plugin reads the ticket's current labels andupdatedFrom.labelIds; only the fixtures confirm this so far.41/…), which is how ProPR names branches.pluginHandlerFixturenow takes aconnectionsoption, because Linear can't be enabled until its API key is set.I captured four previews of the Configure step using Linear's real settings with mocked API data: the "not connected" message and the loaded choices, at desktop and phone widths. The temporary spec is deleted.
Acceptance criteria
packages/plugins/test/linear.test.ts(one issue with the link and trigger label; replays, re-added labels and simultaneous deliveries create nothing more; unmapped tickets, other label changes, edits, removed labels and comments do nothing) andpackages/core/test/linearPluginWebhooks.test.ts(an invalid or missing signature gets 401 and no handler runs; a repeatedLinear-Deliverygets 409)packages/plugins/test/linear.test.ts("each sync-back event posts its comment when switched on, once, and nothing when off" and "the ticket moves to the configured states…; a missing state is reported and blocks nothing")packages/plugins/test/linear.test.ts(teams, projects and state choices, and the not-connected message),packages/core/test/linearPluginWebhooks.test.ts(choices loaded through the realctx.httpbefore the plugin is enabled; 409 without the key),packages/api/test/pluginSettingOptionsRoutes.test.ts(non-administrators get 403, signed-out requests 401) andpropr-ui/src/pages/PluginsPage/PluginSettingOptions.test.tsx(the form's lists and its error)packages/plugins/test/linear.test.ts("ticket text cannot affect the repository, the labels or the model…", using theinjectionfixture)packages/plugins/test/linear.test.ts(the sentinel test: ticket text is absent from Linear requests, logs, results and stored state; the comment tests check fixed wording) andpackages/core/test/linearPluginWebhooks.test.ts(ticket text not in Activity)packages/plugins/linear/README.md(setup, permissions and API key access, manual checklist, Linear doc links) anddocs/docs/plugins/linear.mdReview digest
Acceptance criteria (6 of 6 met, as stated by the agent)
Fixture-based handler tests: trigger label added on a mapped ticket creates exactly one GitHub issue with link and trigger label; repeated or replayed webhooks create no second issue; unmapped tickets and other label changes do nothing; invalid signature is rejected before plugin code runs.—`packages/plugins/test/linear.test.ts` (one issue with the link and trigger label; replays, re-added labels and simultaneous deliveries create nothing more; unmapped tickets, other label changes, edits, removed labels and comments do nothing) and `packages/core/test/linearPluginWebhooks.test.ts` (a…Each sync-back event posts the expected comment or state change when switched on and nothing when off; a missing state name is reported in Activity and does not block other events.—`packages/plugins/test/linear.test.ts` ("each sync-back event posts its comment when switched on, once, and nothing when off" and "the ticket moves to the configured states…; a missing state is reported and blocks nothing")The configure form loads teams and workflow states through `optionsFrom`, with a clear error when not connected; the options route refuses non-administrators.—`packages/plugins/test/linear.test.ts` (teams, projects and state choices, and the not-connected message), `packages/core/test/linearPluginWebhooks.test.ts` (choices loaded through the real `ctx.http` before the plugin is enabled; 409 without the key), `packages/api/test/pluginSettingOptionsRoutes.…Ticket text cannot affect repository, labels or model (injection test).—`packages/plugins/test/linear.test.ts` ("ticket text cannot affect the repository, the labels or the model…", using the `injection` fixture)No ticket text is sent anywhere except into the created GitHub issue; no code or logs are posted to tickets.—`packages/plugins/test/linear.test.ts` (the sentinel test: ticket text is absent from Linear requests, logs, results and stored state; the comment tests check fixed wording) and `packages/core/test/linearPluginWebhooks.test.ts` (ticket text not in Activity)README with setup steps, required permissions or scopes, and a manual smoke-test checklist; `docs/docs/plugins/linear.md`.—`packages/plugins/linear/README.md` (setup, permissions and API key access, manual checklist, Linear doc links) and `docs/docs/plugins/linear.md`Risk-tiered paths
packages/api/openapi/routeDocsPlugins.ts(+5/−0)packages/api/openapi/schemasPlugins.ts(+4/−0)packages/api/pluginRouteRegistry.ts(+1/−0)packages/api/routes/pluginRoutes.ts(+7/−1)packages/client/src/generated/apiTypes.ts(+11/−0)packages/core/src/plugins/pluginContext.ts(+17/−9)packages/core/src/plugins/pluginHandlerRunner.ts(+3/−3)packages/core/src/plugins/pluginHttp.ts(+9/−6)packages/core/src/plugins/pluginSettingOptions.ts(added, +42/−0)packages/plugins/_shared/tracker.ts(added, +235/−0)packages/plugins/_shared/trackerLinks.ts(added, +128/−0)packages/plugins/linear/api.ts(added, +107/−0)packages/plugins/linear/handlers.ts(added, +21/−0)packages/plugins/linear/icon.svg(added, +1/−0)packages/plugins/linear/intake.ts(added, +101/−0)packages/plugins/linear/manifest.json(added, +165/−0)packages/plugins/linear/options.ts(added, +47/−0)packages/plugins/linear/settings.ts(added, +40/−0)packages/plugins/linear/sync.ts(added, +95/−0)packages/plugins/registry.json(+1/−0)packages/shared/src/pluginSdk.ts(+43/−1)packages/shared/src/plugins.ts(+23/−0)propr-ui/src/api/pluginsApi.ts(+5/−0)propr-ui/src/pages/PluginsPage/PluginSettingFields.tsx(+31/−8)propr-ui/src/pages/PluginsPage/PluginSettingOptions.tsx(added, +34/−0)propr-ui/src/pages/PluginsPage/PluginSettingsForm.tsx(+1/−1)propr-ui/src/pages/PluginsPage/usePluginSettingOptions.ts(added, +38/−0)docs/docs/features/plugins.md(+22/−2)docs/docs/plugins/linear.md(added, +182/−0)docs/sidebars.ts(+1/−0)docs/static/openapi/propr-api.yaml(+67/−2)packages/api/test/pluginSettingOptionsRoutes.test.ts(added, +104/−0)packages/core/test/helpers/pluginHandlerFixture.ts(+3/−1)packages/core/test/linearPluginWebhooks.test.ts(added, +140/−0)packages/plugins/linear/README.md(added, +165/−0)packages/plugins/linear/fixtures/graphql.json(added, +158/−0)packages/plugins/linear/fixtures/webhooks.json(added, +68/−0)packages/plugins/linear/skills/linear-ticket/SKILL.md(added, +25/−0)packages/plugins/test/linear.test.ts(added, +317/−0)packages/plugins/test/registry.test.ts(+4/−4)packages/plugins/test/trackerLinks.test.ts(added, +45/−0)packages/shared/test/plugins.test.ts(+27/−0)propr-ui/src/pages/PluginsPage/PluginSettingOptions.test.tsx(added, +66/−0)test/checkPlugins.test.mjs(+1/−1)Validation evidence
Diff size: 44 files changed, +2,610/−39 lines
Detailed Logs:
67600812-a847-4c8f-820d-5dcfdb271294Log files stored at:
/usr/src/app/logs/executions/issue-3556-2026-11-16T17-58-53-880Z-conversation.json/usr/src/app/logs/executions/issue-3556-2026-11-16T17-58-53-880Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #3556.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!
Visual preview
Linear settings with choices loaded (desktop)
After the API key is set and the choices are reloaded: each repository's value is picked from Linear teams and projects, and the state fields list workflow state names with their team keys.
Full-size original
Linear settings with choices loaded (phone)
The loaded choices at 390 px width.
Full-size original
Linear settings before the API key is set (desktop)
The Configure step with the Linear plugin's real settings schema: the optionsFrom fields (Repository mapping and the two workflow-state fields) say why their choices could not be loaded and offer Reload choices. Mocked plugin API.
Full-size original
Linear settings before the API key is set (phone)
The same not-connected message at 390 px width.
Full-size original