feat(plugins): Add SQL-backed plugin runtime APIs#604
Merged
Conversation
Define plugin prompt contribution, observation, session state, and database migration contracts for the upcoming memory plugin work. Co-Authored-By: Codex <codex@openai.com>
Define the V1 memory plugin contract, including policy, storage, retrieval, tools, security, and verification. Document the generic plugin surfaces needed for memory background tasks, database access, and future CLI administration. Co-Authored-By: GPT-5 Codex <codex@openai.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Move the public plugin API out of one large module and cut over exported contracts from AgentPlugin-prefixed names to Plugin-prefixed names. Add initial prompt, task, and database hook shapes so memory-style plugins can build against the intended V1 surface. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Add a narrow plugin database surface, plugin-owned SQL migration discovery, and storage migration hooks for upgrade-time backfills. Move scheduler onto plugin SQL as the first consumer while keeping the state-backed store path available for tests and existing flows. Document the storage migration contract and cover plugin migration discovery, upgrade wiring, and scheduler SQL behavior with targeted tests. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Share plugin package env parsing between app startup and upgrade so plugin SQL migration discovery follows the same configured catalog surface. Make missing virtual config handling stricter, clarify plugin schema migration errors, and add guardrail tests for required database plugins and migration filenames. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Wire database-backed plugin registrations through heartbeat contexts so scheduler hooks can read from the same SQL store that tools and upgrade migrations write to. Keep plugin storage migrations on the upgrade command boundaries by using the migration context database and state adapter. Update the scheduler and plugin database specs to reflect that migration application and checksum checks happen only in junior upgrade. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Treat plugin database declarations as required SQL access instead of an optional runtime mode. Storage migration hooks now receive a required ctx.db and fail before running when a plugin has not declared database access. Keep the scheduler plugin on the SQL-backed runtime path for tools, heartbeat, and operational reporting while leaving state-backed storage only for tests and migration support. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Allow the SQL scheduler store to claim a later due occurrence when an older pending run for the same task is stale. Fresh pending and running runs still block new claims. Add a SQL scheduler component regression test for stale pending claims so the SQL store matches the state-backed scheduler behavior. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Load the trusted scheduler plugin registration during storage upgrade when package-only plugin config enabled its SQL migrations. This keeps scheduler state backfill from being skipped when the virtual plugin module is unavailable. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Resolve upgrade plugin package names and registrations into one effective plugin set and catalog before running plugin migrations. This keeps trusted package-enabled hooks and SQL schema discovery on the same path. Harden scheduler SQL scans so malformed record payloads fail point reads but do not block valid due claims. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Keep scheduler SQL task rows claimable when only the prompt text is malformed so heartbeat can mark the run and task blocked. Corrupt records missing scheduler-critical fields still fail zod parsing and are skipped in scan paths. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Use manifest.name as the only plugin registration identity and keep packageName as a package locator for bundled plugin content. Tie package migrations to JavaScript registrations so declarative manifests stay manifest-only. Move plugin database migration coverage into component tests and tighten scheduler retained-state parsing with schemas. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Apply plugin SQL namespace validation during central migration discovery and reject duplicate or destructive migration inputs before execution. Keep scheduler runtime registration out of core upgrade wiring and add a package-boundary check so @sentry/junior cannot import plugin packages other than @sentry/junior-plugin-api. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Give scheduler eval registration a migrated plugin database from the eval package, without importing scheduler into core Junior code. Add a regression test for malformed JSONB string scheduler records so invalid stored rows are skipped or rejected instead of crashing scan paths. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Prevent the SQL scheduler store from creating a fresh pending run over an existing terminal occurrence. This keeps SQL claiming aligned with the state-backed store. Add a component regression test that leaves a completed task occurrence due and verifies it is not reclaimed. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Keep the scheduler Drizzle config and generation command, but invoke drizzle-kit with pnpm dlx so the repository lockfile does not add vulnerable transitive esbuild versions. This keeps dependency review green while preserving the Drizzle migration workflow. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Return undefined for invalid scheduler SQL task and run records during point lookups, matching scan paths and the state-backed store behavior. Update the scheduler SQL component regression to cover malformed object and string records without throwing. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Remove SQL content inspection from plugin migration loading while keeping central ordering, checksums, and filename validation. Plugins are trusted code, so Junior should not maintain a partial SQL validator. Keep future prompt and task hooks out of the exported plugin API until core invokes them, and fail fast when migration-only packages are configured without an owning code registration. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Remove the scheduler tool fallback to legacy plugin state so runtime tool construction always receives an explicit scheduler store. Keep legacy scheduler state access limited to the upgrade migration path. Drop the migration-only package ownership guardrail and update specs to distinguish future prompt hook designs from currently implemented plugin APIs. Co-Authored-By: GPT-5 Codex <codex@openai.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 06262cf. Configure here.
Allow SQL-backed scheduler tasks that are reactivated from a blocked state to dispatch the same scheduled occurrence again. Preserve completed run history by clearing only blocked run rows for the reactivated slot. Co-Authored-By: GPT-5 Codex <codex@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds the runtime plugin API surface for trusted plugins: split plugin API contracts, prompt/tool/heartbeat/dispatch hooks, packaged SQL migrations through
junior upgrade, plugin-scoped state, andctx.dbaccess for plugins that declare database usage. Database-backed plugins now require SQL instead of supporting an optional no-DB mode.The scheduler is the first concrete consumer of that API. Its runtime plugin path now uses scheduler-owned SQL tables for tools, heartbeat, and operational reporting, with state-backed storage kept only for tests and the one-time storage migration. Memory implementation remains deferred; the memory work in this PR is limited to specs that describe the future plugin policy, storage, retrieval, and admin shape.
Validated with
pnpm --filter @sentry/junior-plugin-api run typecheck,pnpm --filter @sentry/junior-scheduler run typecheck,pnpm --filter @sentry/junior-scheduler run build,pnpm --filter @sentry/junior run typecheck,pnpm --filter @sentry/junior run lint, and the focused scheduler/plugin Vitest suite.