Skip to content

fix(jobs): keep missing job id lookups out of Sentry - #961

Merged
kody-bot merged 1 commit into
mainfrom
cursor/sentry-triage-kody-cloudflare-2b-a6da
Jul 26, 2026
Merged

kody-bot merged 1 commit into
mainfrom
cursor/sentry-triage-kody-cloudflare-2b-a6da

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Jul 26, 2026 •

Copy link
Copy Markdown
Member

Summary

job_get (and sibling job mutate paths) threw a plain Error when a caller-supplied job id did not resolve for the signed-in user. Agents routinely hit this with stale or typo’d ids; MCP observability then opened Sentry issues that look like platform bugs (KODY-CLOUDFLARE-2B).

Throw McpCallerError instead so the established caller-error carve-out keeps these on mcp-event logs only. MCP response messages are unchanged.

Changes

  • getJob, updateJob, deleteJob, and runJobNow throw McpCallerError for missing job ids
  • Tests assert the caller-error type on get/inspect/run-now and cross-user mutate/delete

Test plan

  • Focused unit tests for missing-job McpCallerError paths
  • npm run validate / CI
System recap — composes existing primitives (low risk)

Mode: recap · Base: main · Head: cursor/sentry-triage-kody-cloudflare-2b-a6da

Classification: composes — reuses existing McpCallerError on job not-found paths; no new primitives or API shape changes.

Primitives touched

Primitive Group Impact
jobs assistant composes

System map

Missing job ids from MCP job capabilities now fail as caller errors so Sentry stays quiet.

Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).

flowchart LR
	mcpServer["mcp-server<br/>MCP endpoint"]:::untouched
	jobs["jobs<br/>Scheduled jobs"]:::touched
	mcpServer -->|"job_get / update / delete / run_now"| jobs
	jobs -->|"McpCallerError on missing id"| mcpServer
	classDef touched fill:#1a7f37,color:#fff
	classDef extended fill:#9a6700,color:#fff
	classDef added fill:#cf222e,color:#fff
	classDef untouched fill:#57606a,color:#fff
Loading

Before / after

Path Before After
Missing job id Error → Sentry issue McpCallerError → mcp-event only
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling when requested jobs are not found.
    • Standardized job-related errors for missing or unauthorized jobs, providing clearer and more consistent messages.
    • Updated behavior across viewing, updating, deleting, and running jobs.

job_get/update/delete/run_now threw plain Error for caller-supplied ids
that do not resolve, so agent typos and stale ids opened Sentry issues
that look like platform bugs (KODY-CLOUDFLARE-2B). Throw McpCallerError
so MCP observability keeps them on mcp-event logs only.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: df3af456-f6f7-40b0-9be0-48a21cdd1e1c

📥 Commits

Reviewing files that changed from the base of the PR and between 8179950 and a8216f4.

📒 Files selected for processing (2)
  • packages/worker/src/jobs/service.node.test.ts
  • packages/worker/src/jobs/service.ts

📝 Walkthrough

Walkthrough

Job service endpoints now classify missing job references as McpCallerError. Tests verify error types and structured messages for unauthorized updates/deletions and missing jobs across retrieval, inspection, and execution paths.

Changes

Job error classification

Layer / File(s) Summary
Service error handling
packages/worker/src/jobs/service.ts
getJob, updateJob, deleteJob, and runJobNow now throw McpCallerError when job identifiers do not resolve.
Error behavior tests
packages/worker/src/jobs/service.node.test.ts
Tests assert McpCallerError types and messages for unauthorized mutations and missing jobs.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: kody-bot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: missing job ID lookups now avoid Sentry by using caller errors.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/sentry-triage-kody-cloudflare-2b-a6da

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kody-bot
kody-bot marked this pull request as ready for review July 26, 2026 14:22
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-961.kody-a99.workers.dev

Worker: kody-pr-961
D1: kody-pr-961-db
KV: kody-pr-961-oauth-kv

Mocks:

@kody-bot
kody-bot merged commit e8dd817 into main Jul 26, 2026
17 checks passed
@kody-bot
kody-bot deleted the cursor/sentry-triage-kody-cloudflare-2b-a6da branch July 26, 2026 14:26
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.

3 participants