Repository navigation
feat(run): clean up the qodercli session directory too - #397
Merged
Merged
Conversation
Walternater
requested review from
JHWang-1997,
hittyt and
zpzjzj
as code owners
November 12, 2026 11:35
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
10 tasks
zpzjzj
approved these changes
Nov 13, 2026
Qoder CLI keeps the same per-workspace state as Claude Code: it writes $HOME/.qoder/projects/<workspace-key>/ (or $HOME/.qoder-cn/ for the CN edition) holding the session transcript, sub-agent transcripts under <sessionID>/subagents/, and <sessionID>-session.json metadata. With the opt-in cleanup in place, those directories accumulated exactly like the Claude ones. QoderCLIAgent now implements SessionDirCleaner through the shared removeAgentSessionDir, so the same safeguards apply: the directory is removed only when every transcript in it records this workspace, ownership is parsed from the top-level cwd/directories fields rather than matched as a string, discovery follows the lookup's two-phase shape, and unproven or conflicting ownership keeps the directory. The projects root is taken from the profile's configDir, so the global and CN editions each clean their own tree and never the other's; the lookup and the cleanup now share qoderSessionLookup so they cannot disagree about which directory belongs to the run. Tests are fixture-level only: this environment has no qoder CLI to run the real thing. The cases cover directories identity, cwd identity, a shared directory, no identity, an unparsable transcript, a hashed directory name, the CN root, and the nested sub-agent/metadata files that go with the directory.
Walternater
force-pushed
the
feat/qoder-session-cleanup
branch
from
November 13, 2026 06:59
a4678e7 to
7ef4869
Compare
Contributor
Author
|
Rebased onto |
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.
Summary
Extends the opt-in session cleanup from #394 to qodercli, the first engine named in #267.
Qoder CLI keeps the same kind of per-workspace state as Claude Code:
$HOME/.qoder/projects/<workspace-key>/(CN edition:$HOME/.qoder-cn/projects/<workspace-key>/) holding the session transcript, sub-agent transcripts under<sessionID>/subagents/, and<sessionID>-session.json. With cleanup enabled it accumulated exactly like the Claude directories.Related issues
Refs #267 — this lands the qodercli slice of the design input posted there.
Changes
QoderCLIAgent.CleanupSessionDirdelegates to the sharedremoveAgentSessionDir, so every safeguard from feat(run): add opt-in cleanup of the Claude Code session directory #394 applies unchanged: ownership parsed from the top-levelcwd/directoriesfields, keep when conflicting or unproven, two-phase discovery for hashed names, and the--no-delete/ externally owned workspace guards.qoderSessionLookup(configDir)is now shared by the resume lookup and the cleanup, and the projects root comes from the profile'sconfigDir, so the global and CN editions clean their own trees and never each other's.claude_codeas the only supported engine in its skip message.Test plan
make testpassesmake verifypasses (fmt + vet + lint, 0 issues)internal/agent/qodercli_test.go:directoriesidentity,cwdidentity, a directory naming another workspace, a second transcript for another workspace, no identity, an unparsable transcript, a hashed directory name, CN root isolation, and removal of nested sub-agent transcripts plus*-session.json.Notes for reviewers
qwen_codestill reports unsupported because its chat files record no working directory, so ownership cannot be proven; the snapshot-diff shape discussed in feat(agent): add session cleanup lifecycle for built-in and custom agents #267 is a separate change.*-session.jsonand the sub-agent transcripts are part of this run too.Disclosure: implemented with DeepSeek Harness (deepseek-v4.1-flash).