Skip to content

fix(linear): pass projectId for credential resolution to worker#1118

Merged
zbigniewsobiecki merged 1 commit intodevfrom
fix/linear-worker-credentials
Apr 15, 2026
Merged

fix(linear): pass projectId for credential resolution to worker#1118
zbigniewsobiecki merged 1 commit intodevfrom
fix/linear-worker-credentials

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

Linear webhook → trigger → job dispatch → worker spawn was completing, then immediately dying with Credential is encrypted but CREDENTIAL_MASTER_KEY is not set. Cannot decrypt. in the worker.

Root cause

src/router/worker-env.ts:22 extractProjectIdFromJob had branches for trello, jira, github, manual-run, retry-run, debug-analysis — but no case for linear. Linear jobs returned null, so the router skipped credential resolution and spawned the worker with no project credentials. The worker then fell back to reading credentials from the DB directly and died because workers intentionally don't get the master key (per worker-env.ts:121: "CREDENTIAL_MASTER_KEY is intentionally NOT passed to workers").

Linear jobs already carry projectId on the job payload (set by LinearRouterAdapter.buildJob at src/router/adapters/linear.ts:229).

Fix

One-line: add linear to the trello/jira branch in the projectId extractor.

Reproduction

Move a Linear issue to a configured agent-triggering state (e.g. Planning) on a project with encrypted credentials. Worker logs:

[Worker] No credentials passed from router - job will likely fail { jobType: 'linear' }
[Worker] Job failed { error: 'Error: Credential is encrypted but CREDENTIAL_MASTER_KEY is not set. Cannot decrypt.' }

Test plan

  • New test: tests/unit/router/container-manager.test.ts > extractProjectIdFromJob > returns projectId for linear jobs
  • All 48 container-manager tests pass; lint + typecheck clean
  • After merge to dev: re-trigger a Linear status transition and confirm the worker receives credentials and the agent runs through

🤖 Generated with Claude Code

Linear jobs were not handled by extractProjectIdFromJob, so the router
returned null and skipped credential resolution. Workers spawned with
no credentials, then fell back to the DB and died with "Credential is
encrypted but CREDENTIAL_MASTER_KEY is not set" because workers
intentionally don't receive the master key.

Linear jobs already carry projectId on their payload (set by
LinearRouterAdapter.buildJob), so the fix is a single branch in the
projectId extractor.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit 83ffe93 into dev Apr 15, 2026
8 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the fix/linear-worker-credentials branch April 15, 2026 22:02
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

zbigniewsobiecki added a commit that referenced this pull request Apr 18, 2026
Task 4: src/integrations/entrypoint.ts centralises every PM/SCM/alerting
registration barrel. Router, worker, CLI bootstrap, and dashboard all
side-effect-import this single file — no per-surface list of imports that
can drift when a new provider is added. Previously dashboard.ts didn't
register any PM providers at all, which is also fixed here.

Task 5: tests/unit/integrations/entrypoint-usage.test.ts grep-asserts the
invariant that every process entry file imports src/integrations/entrypoint.js.
Missing this import was the root cause of #1097, #1118, #1131, #1134 —
the test references those bug numbers in its failure message.

Co-Authored-By: Claude Opus 4 (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