Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
8 screenshot changes — 8 changed · 0 added · 0 removed Review screenshots in Frameshift |
There was a problem hiding this comment.
The core-name reservation in src/chat/plugins/agent-hooks.ts only checks runtime registrations. pluginRuntimeRegistrationsFromPluginSet() filters out manifest-only and CLI-only registrations before that check, and registerPluginManifest() does not check reserved names. A declarative plugin can therefore still claim memory or briefs and enter provider/package discovery alongside the core feature.
I reproduced this with defineJuniorPlugins([{ manifest: { name: "memory", displayName: "Other Memory", description: "Not core memory" } }]): runtime validation passed, and the catalog returned memory as an installed provider. Put the reservation check at the shared manifest-registration boundary as well, so inline and YAML manifests both reject these names. Extend the existing registration coverage to include a manifest-only plugin.
The database adoption rehearsal passed all 13 cases on real Postgres. The focused API, host-wiring, core-registration, and CLI tests also passed (19 tests). I reviewed the latest eval change at a530f8014; the broader local test run did not finish within 200 seconds, so I am not claiming a full local suite pass.
|
Fixed in 6483374. |
Memory now ships inside @sentry/junior as a core feature. createApp()
registers it for every app, so an app with only @sentry/junior gets the
tools, recall, extraction, events, Memories page, REST routes, CLI, and
operational report without a plugin.
- Core features use the plugin registration contract but stay out of
plugin and package discovery. Every hook consumer reads one list of
core features and plugins. Plugins cannot claim a core feature name.
- createApp({ memory }) takes modelId, disableRecall, disableExtraction,
and an emergency enabled: false.
- Core serves /api/memory/* and keeps /api/plugins/memory/* as an alias
for one compatibility window. The dashboard uses the core routes.
- Migration 0044_memory_core adopts the Memory tables. It creates the
final schema on a fresh database and applies only the legacy plugin
transitions that are missing. It does not rewrite data on a database
that already ran every plugin migration. The legacy plugin journal stays
as audit state.
- junior upgrade enables vector and btree_gin under the migration lock
and stops with a prerequisite error when it cannot.
- @sentry/junior-memory becomes a compatibility package that re-exports
@sentry/junior/memory. Core ignores memoryPlugin() and the package in
JUNIOR_PLUGIN_PACKAGES with one warning.
- junior init, the example app, and evals no longer install the plugin.
Memory docs move to concepts/memory.
scripts/rehearse-memory-upgrade.ts rehearses the upgrade against real
Postgres for a fresh database and every legacy plugin prefix.
Refs #1861
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Memory ships inside @sentry/junior, so apps move off the plugin in the same release instead of through a compatibility window. The upgrade keeps all Memory data: the core migration adopts the tables in place. - Delete packages/junior-memory and its CI, Craft, release, and package check wiring. - A plugin set or JUNIOR_PLUGIN_PACKAGES that still names @sentry/junior-memory stops startup and junior upgrade with a migration message. - Remove the /api/plugins/memory alias. REST clients use /api/memory. - Keep the 12 legacy plugin migrations as rehearsal fixtures so the upgrade from every legacy state stays testable. Refs #1861 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- Rebuild pnpm-lock.yaml from main so the only change is removing @sentry/junior-memory. Earlier regeneration had bumped unrelated transitive versions. - Describe Memory as core in moved comments and test names. - Rename generic test plugins that still used Memory names to notes, since memory is a reserved core feature name. Refs #1861 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Memory is a core feature, so evals install it for every scenario. Passive extraction adds model calls and a background task after each completed turn. On the OAuth resume path that task publishes to a real Vercel Queue, which the eval HTTP mock rejects. The harness now builds core features with extraction off unless a scenario sets the memory_extraction override. Recall stays on everywhere. The Memory eval suites opt in through memoryEvals. Refs #1861 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Runtime validation only saw registrations with runtime hooks, so an inline or YAML manifest could still claim memory or briefs and enter the plugin catalog next to the core feature. Check reserved names at the shared manifest registration boundary as well. Refs #1861 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
6483374 to
2237065
Compare
…ests Timed-out eval scenarios kept running after Vitest moved on. The harness raced each agent run against its abort signal and abandoned the run, so its later teardown reset the plugin catalog and core features under the next test. Agent runs already stop on their signal, so the harness now awaits them, and the eval setup waits for an aborted scenario to finish teardown before the next test starts. Remove the unused taskTimeout race. Memory adds recall and extraction model calls to every Turn. Evals now run it only through memoryEvals, and core tests that run Turns use createTestApp(), which turns it off. Drop the per-test AI Gateway embedding fake that only those tests needed. Event evals could not pass since the event burst window landed: the worker deferred each event Turn and the eval queue retried until it gave up. ingestEvent now passes its clock into the event's receivedAtMs, and eval event fixtures arrive after the window closed. Integration tests keep owning the window. Refs #1861 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Renumber the Memory adoption migration to 0046 after main added 0045_conversation_forks. Keep main's eval harness abort handling and reapply only the Memory core-feature toggle on top of it. Co-Authored-By: David Cramer <[email protected]>
Sentry Evalsjunior-behavioral
Base commit junior-guardian
Base commit junior-integration
Base commit junior-router
Base commit |
Rename createMemoryFeature to memoryFeature so it matches briefsFeature. Import Memory enum constants from the schema that owns them instead of re-exporting them through memory/types. Drop the eval helpers' needless MemoryDb casts, simplify the Memory API prefix strip, and fix stale plugin wording and the upgrade example migration count in docs. Co-Authored-By: David Cramer <[email protected]>
Child agent runs (`agent_invocation` Source) now get only `listMemories` and `searchMemories`. They no longer get `createMemory` or `archiveMemory`. Only the main agent writes memory. Children read memory and can suggest memories in their result. Recall (`userPrompt`) still runs for children, and passive extraction already skips them. Addresses the "Hide `createMemory` and `archiveMemory` in child runs" item in #2105. Note for #1889: that PR moves `packages/junior-memory/src/plugin.ts` to `packages/junior/src/chat/memory/feature.ts` and moves `packages/junior-memory/tests/storage.test.ts` into `packages/junior/tests/component/memory/`. Whichever PR lands second will need to carry the `agent_invocation` check in the `tools` hook and the new test over to the new paths. <!-- junior-request-attribution:start --> via **David Cramer**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Af05e0cc300d73222c1ff527aa103dafc --> -- [View Junior Session](https://junior-prod.sentry.dev/conversations/agent%3Af05e0cc300d73222c1ff527aa103dafc) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Af05e0cc300d73222c1ff527aa103dafc/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: David Cramer <[email protected]>
The dashboard loads `GET /api/plugins/memory/conversations/:id/memories` on every conversation page and keeps polling it. In prod it takes 6–10s in slow traces (for example `19019d5f…`, `40a68dfc…`, `9598ab4f…`), and warm it still takes 0.3–0.9s, even for small conversations. Almost all of that time goes to the two `PluginConversationEventReader.list` queries it runs in parallel (span group `d8d0f3c2e0b50993`: 2,294 runs, p50 614ms, p95 4.5s, about one day of data). For the same conversation, the slowest prod runs took 4.9s, 7.2s and 10.1s, and later polls took 0.6–0.9s. ## Cause The query filters on `conversation_id`, `type`, `payload->>'namespace'` and `payload->>'name'`. Postgres doesn't use statistics from partial expression indexes (`examine_variable` skips them). So it uses the default 0.005 selectivity for each JSON predicate and estimates that `junior_conversation_events_plugin_report_idx` (#2275) returns a handful of rows. The planner then scans that index for **every Conversation's** rows of this event and drops the other conversations with a filter. The cost grows with the total number of memory events, not with the size of the conversation. Verified on a Neon branch of prod with `EXPLAIN (ANALYZE, BUFFERS)`. Input: the conversation with the most memory events, `memories_captured`. | | Plan | Rows removed by filter | Buffers | Time | |---|---|---|---|---| | Before | `Index Scan using …plugin_report_idx` + `Filter: conversation_id`, then sort | 29,150 (to return 26) | ~27k (24.7k read) | 160.7ms | | After | `Index Scan Backward using …plugin_conversation_idx`, `conversation_id` in `Index Cond`, no sort | 0 | 27 | 0.46ms | The branch compute reads its storage locally. In prod, the before plan's ~27k buffer reads come from cold Neon storage, which fits the multi-second runs (inference, not measured). On a local Postgres 17 fixture (2.1M synthetic events), the same change took a 401-row conversation from 34.8ms to 0.2ms. The cost-report query still uses `plugin_report_idx`. ## Change - New partial index `(conversation_id, payload->>'namespace', payload->>'name', seq) WHERE type = 'structured_event'`. It matches every equality predicate, and its `seq` column gives the `ORDER BY seq DESC` without a sort. - The migration `0078_plugin_conversation_index.sql` uses the same guarded `DO` block as `0062`. `junior upgrade` builds the index if it is missing, then checks that it is valid and ready. The migration runs in a transaction, so its build is a plain `CREATE INDEX` that blocks event writes while it runs: ~18s on the prod branch. To avoid that pause, first build the index with `CONCURRENTLY` as one statement outside a transaction. The migration then skips the build. - `loadLatestStructuredEvent` (`chat/conversations/sql/history.ts`) uses the same predicates, so the index covers it too. No query code changes. The memory dashboard's `SUM … TO_CHAR(created_at …)` cost report (group `ebf8dde853a402c4`, p95 7.2s) uses the same route prefix but isn't on the conversation page. This PR doesn't change it. ## Overlap There's no file overlap with the open memory PRs #1889, #1868 and #2483. #1889 and #1868 add core migrations numbered `0043`/`0046`, which already conflict with main. #2714 is stacked on this PR and adds `0079`, so merge this one first. ## Checks `pnpm --filter @sentry/junior typecheck` and `lint`, `pnpm migration-metadata:check`, `db:generate` (no further changes). Tests against local Postgres (`compose.yaml`): `tests/component/conversation-storage-sql.test.ts`, `tests/unit/api/conversation-events.test.ts`, `tests/integration/conversation-sql.test.ts`, `tests/integration/dashboard-reporting.test.ts`. Also all `@sentry/junior-memory` tests and `junior-dashboard` `tests/dashboard-plugin-routes.test.ts`. <!-- junior-request-attribution:start --> via @thomasjiangcy. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0CCUMX7ET0%3A1793852389.842359 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC0CCUMX7ET0%3A1793852389.842359) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0CCUMX7ET0%3A1793852389.842359/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Thomas Jiang <[email protected]>
|
Closing as stale: merge conflicts, and Memory has changed a lot since. Reopen or redo if still wanted. |
Memory now ships inside
@sentry/junioras a core feature, and the@sentry/junior-memorypackage is gone. An app that installs only@sentry/juniorgets the Memory tools, automatic recall, passive extraction,memory/*events, the Memories page and conversation tab, REST routes, CLI, and operational report. It keeps all of its existing Memory data.Core features use the plugin registration contract, but core registers them directly. They stay out of plugin and package discovery, every hook consumer reads one list of core features and plugins, and a plugin cannot claim a core feature name. Briefs moved onto the same path.
Breaking changes, with migration in the same release
Operators move off the plugin when they install this version:
memoryPlugin()fromdefineJuniorPlugins(...)and@sentry/junior-memoryfromJUNIOR_PLUGIN_PACKAGES, then uninstall the package. While the plugin set still names it, startup andjunior upgradestop with a message that explains these steps.memoryPlugin({ ... })options tocreateApp({ memory: { modelId, disableRecall, disableExtraction } }).enabled: falseis an emergency switch.AI_MEMORY_MODELstill works.@sentry/junior/memory./api/plugins/memory/*to/api/memory/*. The paths below the prefix are unchanged. The dashboard already uses the new routes.vectorandbtree_ginbecome baseline database requirements.junior upgradeenables them under the migration lock and stops with a prerequisite error when it cannot.Rollback means deploying the previous release with the plugin. It reads the same tables.
Review focus:
0044_memory_core.sqlData safety depends on this migration. It adopts the Memory tables in one core journal entry and does not copy the 12 plugin journal entries. On a fresh database it creates the final schema. On an existing database it checks the current schema and data, then applies only the missing legacy transitions (0001–0011), in their original order. Data rewrites run only while legacy rows or event payloads remain. The
conversation_idbackfill runs only when the column is missing, so current rows without a Conversation stay unchanged. The legacy plugin journal stays in the database as audit state.packages/junior/scripts/rehearse-memory-upgrade.tsruns the upgrade against real Postgres. It covers a fresh database and every meaningful legacy prefix, and it checks that each path ends with the same schema and data and that a rerun changes nothing. The plugin's 12 migrations stay inscripts/fixtures/legacy-memory-migrations/so the rehearsal can build those states. All cases pass locally.Memory adds recall and extraction model calls to every Turn, so tests run it only where they measure it. Core tests that run Turns use
createTestApp(), which turns Memory off, and evals turn it on only throughmemoryEvals.The eval harness also stops a timed-out scenario before the next test starts, instead of abandoning its agent run. Event evals work again:
ingestEventnow passes its clock into the event'sreceivedAtMs, so eval fixtures can arrive after the event burst window closed.Refs #1861
🤖 Generated with Claude Code