fix(gateway): clear claude-cli session on sessions.reset RPC#1232
Merged
Conversation
The sessions.reset RPC only reset the native session store, leaving the Claude CLI-backed history (.jsonl + CLAUDE.md) in place. The /reset chat command already clears it via providers.ResetCLISession, so RPC callers got an incomplete reset for claude-cli agents — stale history was resumed on the next turn. Mirror the chat path by calling ResetCLISession from handleReset. It is a no-op when the CLI provider is unused. The call is wired through an overridable package var so the behavior can be regression-tested.
mrgoonie
approved these changes
Jun 20, 2026
mrgoonie
left a comment
Contributor
There was a problem hiding this comment.
Summary: This brings the JSON-RPC sessions.reset path into parity with the chat /reset command by clearing the Claude CLI session files as well as the native session store.
Risk level: Low
Mandatory gates:
- Duplicate/prior implementation: clear — search found no existing PR/issue implementing this RPC-specific reset path; the only prior implementation is the chat-command path this mirrors.
- Project standards: passed — small gateway-method change, provider helper reuse, and regression test fit the surrounding session-method patterns.
- Strategic necessity: clear value — without this, web/RPC reset can leave claude-cli-backed agents resuming stale
.jsonl/CLAUDE.mdhistory despite reporting reset success. - CI/checks: green — release-versioning, go, and web checks succeeded.
Findings:
- Critical: none
- Important: none
- Suggestion: none
Verdict: APPROVE
Evidence checked: internal/gateway/methods/sessions.go, internal/gateway/methods/sessions_reset_cli_test.go, existing /reset implementation in cmd/gateway_consumer_handlers.go, providers.ResetCLISession behavior in internal/providers/claude_cli_session.go, duplicate search, and local go test ./internal/gateway/methods/.
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.
What
sessions.reset(JSON-RPC) only reset the native session store. For claude-cli-backed agents the actual conversation lives in the Claude CLI session files (.jsonl+CLAUDE.md), which were left in place — so the next turn resumed stale history despite a "reset".The
/resetchat command already clears these viaproviders.ResetCLISession(handleResetCommandincmd/gateway_consumer_handlers.go). This brings the RPC path to parity with the chat command.Change
handleResetnow also callsResetCLISession("", key), mirroring the chat path. It is a no-op when the CLI provider is not in use (the helper guards on missing files).cliSessionReset) so the behavior can be regression-tested without filesystem side effects.Test
TestSessionsReset_ClearsCLISessionasserts the RPC reset invokes the CLI clear with the correct session key and still resets the native store.go test ./internal/gateway/methods/✓,go vet ./internal/gateway/methods/✓,gofmtclean.Notes
sessions/bridge area, separately scoped).