-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(cli): resume older working-directory sessions in /sessions and --continue #2952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@moonshot-ai/kimi-code": patch | ||
| --- | ||
|
|
||
| Restore older working-directory sessions in `/sessions` and `kimi --continue`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -267,7 +267,20 @@ export class FileSessionIndex extends Disposable implements ISessionIndex { | |
|
|
||
| async listRecent(query: SessionListQuery): Promise<Page<SessionSummary>> { | ||
| return this.withReadModel( | ||
| (generation) => this.listRecentFromReadModel(generation, query), | ||
| async (generation) => { | ||
| const page = await this.listRecentFromReadModel(generation, query); | ||
| // A workspace-scoped read that returns nothing can still hide sessions | ||
| // that exist on disk but were not projected into the read model (e.g. | ||
| // legacy/v1-era sessions recorded with only `workDir`, or sessions in | ||
| // alias buckets). Coalesce onto the authoritative source so `/sessions` | ||
| // (working-directory scope) and `--continue` never hide them. Unscooped | ||
| // reads stay on the projected recency column. | ||
| if (page.items.length === 0 && query.workspaceIds !== undefined) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a published generation omits a legacy/v1 session, this fallback runs only if the projected workspace page is completely empty. If that workspace has even one projected session, AGENTS.md reference: packages/agent-core-v2/AGENTS.md:L81-L83 Useful? React with 👍 / 👎. |
||
| const legacy = await this.listLegacy(query); | ||
| if (legacy.items.length > 0) return legacy; | ||
| } | ||
| return page; | ||
| }, | ||
| () => this.listLegacy(query), | ||
| ); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This newly added explanatory block sits inside
listRecentand narrates the implementation, while the scoped v2 guide requires comments to live solely in the top-of-file/** */block and describe external responsibilities. Remove the inline narration or fold the relevant responsibility-level context into the existing module header.AGENTS.md reference: packages/agent-core-v2/AGENTS.md:L36-L38
Useful? React with 👍 / 👎.