Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
#1962) DELETE /v1/sessions/{id} and DELETE /v1/sessions cleared the session store and the archive only. The context-guru plugin kept the session's summary text in context-guru-state.db for 30 days, and its forwarded-body stash and keep-alive entries (which hold the conversation) in memory. - New optional interface pipeline.SessionEraser. The wrapper of a Configurable plugin forwards it. - Both DELETE routes call it on every plugin of the live pipelines, after the store and the archive. A failure is a 500 with pluginErrors; the rest of the erase stands. DELETE /v1/sessions/{id} calls it even on a 404. - The context-guru plugin erases, in every live instance (a draining one too): its session state (store.Memory.EraseSession / EraseAll), its sentStash entries and its keeper entries. - docs/session-api.md, docs/context-guru-plugin.md and CLAUDE.md describe what the erase now removes and keeps. Needs a context-guru release with rossoctl/context-guru#1471. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: DAVID BOAZ <DAVIDBO@il.ibm.com>
- Pin context-guru v0.7.10 in core, cmd/cortex and cmd/cortex-envoy. - keepalive.Record lost its Agent field (context-guru #1506). Pass the client as Identity, from agent.Identify of the request headers, as the context-guru proxy does. - TestAPanicInOnFinishStillDeparts got its panic from a store write that context-guru now recovers itself (#1513). It now panics in stashSent, which runs in this plugin before Record. - TestPolicyDefaults expects no flat per-ping cap: since context-guru #1428 a value rule decides, and an operator opts in to a cap with keepalive_max_usd_per_ping. Behavior change: a keep-alive ping is no longer refused at a flat $0.50. It runs when the planned pings cost less than the cache miss they protect. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: DAVID BOAZ <DAVIDBO@il.ibm.com>
boazdavid
force-pushed
the
fix/1962-erase-plugin-state
branch
from
November 29, 2026 07:41
a8fd976 to
65fadde
Compare
This branch has not been deployed
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.
BEHAVIOR CHANGE: needs a human's yes before merge
This comes from the context-guru update, not from the erase fix.
not worth it.keepalive_max_usd_per_ping: 0.5in the plugin'sengine.cacheblock.Summary
DELETE /v1/sessions/{id}andDELETE /v1/sessionsnow erase the context-guru plugin's data too. Before, the session's summary text stayed in~/.cortex/context-guru-state.dbfor 30 days, and a restarted plugin loaded it back. Fixes #1962.Draft: blocked on one more context-guru tag. The erase calls
store.Memory.EraseSessionandEraseAllfrom rossoctl/context-guru#1471. The branch pins v0.7.10, which was tagged 15 minutes before #1471 merged. So CI cannot buildcore/plugins/contextguru/erase.goyet. When the next tag exists, only the version number changes in 3go.modfiles.What we found
DELETEhandlers (core/sessionapi/clear.go) cleared only the session store, the archive and the timelines.session_state, andLoadSessionloaded the summary back. The new testTestErase_RoutesRemoveSavedStateis that repro, and it now passes.What changed
The erase (commit
4d3fdf905)pipeline.SessionEraser(EraseSession,EraseAllSessions). The wrapper of a configured plugin (configuredPlugin) forwards it, as it forwardsShutdowner.DELETEroutes call it on every plugin of the live pipelines, after the store and the archive.pluginErrors("<plugin>: <error>"). The rest of the erase stands.DELETE /v1/sessions/{id}calls the plugins even when it answers 404. After a restart, the plugin's file can hold a session that neither the store nor the archive holds.sentStash);liveInstances) holds each instance fromInittoShutdown.docs/session-api.md,docs/context-guru-plugin.mdandCLAUDE.mdnow say what the erase removes and what it keeps.The context-guru update to v0.7.10 (commit
a8fd976d6)go mod tidy -diffis clean in every module.keepalive.Recordlost itsAgentfield (context-guru Feat: Record plain-HTTP bodies and body sizes in lineage (contract v1.8) #1506). The plugin now passesIdentity: agent.Identify(pctx.Headers), as the context-guru proxy does.TestAPanicInOnFinishStillDepartsgot its panic from a store write. context-guru now recovers that panic itself (build(deps): Bump actions/download-artifact from 8.0.1 to 8.0.2 #1513), so the test panics instashSentinstead, which runs in Cortex beforeRecord. It still fails when theDepartguard is removed.TestPolicyDefaultsnow expects no flat ping cap. See Behavior change above.What the erase keeps
DELETE /v1/sessionsremoves them.How it was tested
core/plugins/contextguru/erase_test.go, with 3 tests:core/sessionapi/erase_plugins_test.go, with 3 tests: both routes reach an eraser, a 404 still erases, and a plugin error gives a 500 withpluginErrors.core/pipeline/configured_test.go: the wrapper forwards both calls.GOWORKfile that points at the merged context-gurumain(dd0c46d: v0.7.10 plus 5 commits, Feat: Add the Python SDK for script plugins, with replay #1471 among them). I committed noreplacedirective.accounting,plugins/contextguru,sessionapiandpipelinepass (-tags include_plugin_contextguru).cmd/cortexandcmd/cortex-envoybuild with the plugin.gofmt -l coreandgo vetare clean.Open questions
X-Cortex-Record: off, feat: Let a user keep one session out of the recording #1923) is not in this PR. The comment on Deleting a session leaves the context-guru plugin's saved state, which holds conversation text #1962 proposes aSessionWithholderinterface for it.Assisted-By: Claude (Anthropic AI) noreply@anthropic.com