Skip to content

fix: hide empty current session from sessions list - #13

Merged
liruifengv merged 4 commits into
mainfrom
fix-session-list
May 25, 2026
Merged

fix: hide empty current session from sessions list#13
liruifengv merged 4 commits into
mainfrom
fix-session-list

Conversation

@liruifengv

@liruifengv liruifengv commented May 25, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

Resolve #(issue_number)

Description

fix: hide empty current session from sessions list

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@liruifengv
liruifengv merged commit 35726d7 into main May 25, 2026
4 checks passed
@liruifengv
liruifengv deleted the fix-session-list branch May 25, 2026 06:50
@github-actions github-actions Bot mentioned this pull request May 26, 2026
@trustmiao

Copy link
Copy Markdown

Workmonitor issue-flow plan stage 20260617-141319 issue #13

Plan stage findings:

  • GitHub fix: hide empty current session from sessions list #13 resolves to merged PR fix: hide empty current session from sessions list #13, fix: hide empty current session from sessions list; body states the requirement as hiding an empty current session from the sessions list. There are no issue/PR comments.
  • Relevant code is in the Kimi TUI session picker path, not in the SDK/storage API:
    • apps/kimi-code/src/tui/kimi-tui.ts: fetchSessions() calls harness.listSessions(...) and maps summaries into picker rows; hasSessionContent() currently checks state.transcriptEntries.length > 0.
    • apps/kimi-code/src/tui/utils/session-picker-rows.ts: maps SessionSummary to SessionRow and filters currentSessionId only when currentSessionHasContent is false.
    • apps/kimi-code/src/tui/components/dialogs/session-picker.ts: renders current-session badge for rows that remain visible.
    • packages/agent-core/src/session/store/session-store.ts and packages/node-sdk/src/kimi-harness.ts: list sessions broadly and should remain unchanged so non-TUI callers still see all persisted sessions.
  • Existing focused tests are in apps/kimi-code/test/tui/utils/session-picker-rows.test.ts and cover omitting the current empty session, keeping current session with content, and not filtering empty historical sessions.

Implementation plan:

  1. Keep the filtering at the TUI row-adapter boundary (sessionRowsForPicker) so the behavior is scoped to the picker UI and does not alter SDK or storage semantics.
  2. Pass the active session id and a UI-owned content flag from KimiTUI.fetchSessions() into sessionRowsForPicker.
  3. Define "current session has content" as the TUI transcript having at least one entry, matching the visible conversation state; if later product semantics require queued input/tool-only state to count, extend hasSessionContent() with focused tests.
  4. Preserve all fields needed by the picker (title, last_prompt, work_dir, updated_at, metadata) and keep the current-session badge behavior for non-empty current sessions.

Verification plan:

  1. Run pnpm --filter @moonshot-ai/kimi-code test -- apps/kimi-code/test/tui/utils/session-picker-rows.test.ts or the repository's equivalent targeted Vitest command for that file.
  2. Run the relevant session picker component tests if the picker rendering is touched: apps/kimi-code/test/tui/components/dialogs/session-picker.test.ts.
  3. Run a focused typecheck/build command for apps/kimi-code if implementation changes touch kimi-tui.ts imports or public types.
  4. Manual TUI smoke check: start a fresh session, open /sessions, confirm the current empty session is hidden; send a prompt or resume a session with transcript content, open /sessions, confirm the current session can appear with the current badge; confirm historical empty sessions are still listed.

No code changes were made in this plan stage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants