Skip to content

docs: amend ADR 065 for Engine, schedules, and sessions.gc first - #3335

Open
adlerhurst wants to merge 6 commits into
mainfrom
cursor/jobs-slice-0-adr-ee5e
Open

adlerhurst wants to merge 6 commits into
mainfrom
cursor/jobs-slice-0-adr-ee5e

Conversation

@adlerhurst

@adlerhurst adlerhurst commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

TL;DR

1 of 6 (bases on main; Gherkin #3336 closed). Amends ADR 065 for the shipped shape: jobs + job_schedules, shared jobs.Engine, Take allowlist, short lease + Heartbeat, first handler sessions.gc, Cron drain as runner. Notes cloud ~1m cron vs run_at = now()+period cadence.

Reviewer map

Core Supporting
docs/adrs/065-background-jobs.md docs/adrs/README.md, docs/adrs/047-… Amended-by

Review follow-ups in this pass

  • Merged latest main.
  • Cadence note under Periodic reschedule.
  • No acceptance/Gherkin pointers.

Stack

this → #3338 → #3340 → #3341 → #3342 → #3343.

Open in Web Open in Cursor 

Align the proposed jobs ADR with locked Project decisions: jobs +
job_schedules, SetPeriodic, Take name allowlist, sched prefix, short
lease with Heartbeat, serverless Cron drain as runner, and sessions.gc
as the first product handler. Register sched in ADR 047.

Co-authored-by: Silvan <adlerhurst@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 25, 2026 09:42
@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cloud Ready Ready Preview Dec 3, 2026 4:48am UTC

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ No Changeset found

Latest commit: afd82c8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Resolve ADR index + 047 Amended-by lines: keep Engine/schedules 065
wording and main's 048/076/066 amendments.

Co-authored-by: s2s4gq4jby <s2s4gq4jby@privaterelay.appleid.com>
A blank line after the 065/066 conflict resolution stopped check-adrs
from reading rows 067–094.

Co-authored-by: s2s4gq4jby <s2s4gq4jby@privaterelay.appleid.com>

@fforootd fforootd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of the whole background-jobs stack (#3335 → #3343), with inline comments on the PRs they belong to. The design holds up and CI is green, but the stack is 35 commits behind main, and some of what landed there since 2026-12-02 breaks it without a git conflict, so a merge would look clean.

Must fix before merge

  • #3336: drop it (reasons on that PR).
  • #3340: migration numbers collide with main in all three dialects.
  • #3342: sessions.gc leaves refresh_grants rows behind; main's SessionService.Delete deletes them now.
  • #3343: drop the apps/api/turbo.json hunk; #3576 fixed the same race on main.

Production safety

  • #3342: no dialect indexes sessions.expires_at, so the reaper scans and sorts the all-tenant sessions table on every run.
  • #3342: at most 100 sessions per run, and one run per period for the whole cluster.
  • #3340: run_at = NOW() + period plus the every-minute Vercel cron means the sweep runs about every other minute on the cloud. The ADR's "Periodic reschedule" line here needs the same change.
  • #3342: a failed SetPeriodic at boot stops the server.

Also

  • The Spanner lane has not run on any branch of this stack, so the Spanner jobs SQL and Spanner DeleteSessions have never executed. Please dispatch spanner.yml on the tip once before merging.
  • Follow-up, not blocking: schedule state (last_error, next run_at) is visible only in the database and metrics, so neither an agent nor a self-hosted operator can tell that sessions.gc keeps failing. Worth surfacing through the CLI later.

Generated by Claude Code

cursoragent and others added 2 commits December 3, 2026 03:52
Co-authored-by: Silvan <adlerhurst@users.noreply.github.com>
Co-authored-by: Silvan <adlerhurst@users.noreply.github.com>
@cursor

cursor Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Addressed the stack review (Silvan-approved plan). Summary for @fforootd:

Must-fix

Production safety

  • expires_at index on all three dialects (sqlite 056 / postgres 069 CONCURRENTLY / spanner 074).
  • Batch drain until deleted < limit (or ctx done); logs total deleted.
  • SetPeriodic at boot soft-fails (warn + continue).
  • Cadence note on ADR 065 Periodic reschedule + design runtime (kept run_at = now()+period as ADR; documented every-other-minute cloud effect).

Deferred (as planned)

Ready for a second look when CI finishes on the restacked tips.

Co-authored-by: Silvan <adlerhurst@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
Preview — 5219aeef Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

4 participants