Skip to content

feat(web): hide empty sessions from the session list - #1166

Merged
wbxl2000 merged 4 commits into
mainfrom
feat/web-hide-empty-sessions
Jun 28, 2026
Merged

feat(web): hide empty sessions from the session list#1166
wbxl2000 merged 4 commits into
mainfrom
feat/web-hide-empty-sessions

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

Related Issue

No related issue — see Problem below.

Problem

The web session list shows empty "New Session" placeholders — sessions that were created but never received a message. They clutter the sidebar and carry no useful content. Separately, the /sessions slash command opened a session-browser popup that duplicates what the sidebar already shows.

What changed

  • Server: added an optional exclude_empty query parameter to GET /api/v1/sessions. When set, the service drops sessions that have no last_prompt (i.e. never used) before cursor pagination, so every returned page is filled with non-empty sessions and has_more reflects the filtered set. Default is off, so existing clients are unaffected.
  • Web: the session-list requests now pass exclude_empty: true, so unused "New Session" entries are hidden from the sidebar by default. The earlier client-side filter was removed in favor of the server-side one.
  • Web: removed the /sessions slash command and its session-browser popup; the sidebar already covers session browsing.

Added a SessionService.list test covering excludeEmpty together with pagination and cursors. Typecheck passes for agent-core, server, and kimi-web; the swagger and api-surface tests pass without snapshot changes.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

wbxl2000 added 2 commits June 28, 2026 02:16
Add an optional exclude_empty parameter to the session list API; the web client passes it so unused "New Session" entries are hidden by default, with pagination and has_more computed on the filtered set.
@changeset-bot

changeset-bot Bot commented Jun 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e4d0171

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 27, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@e4d0171
npx https://pkg.pr.new/@moonshot-ai/kimi-code@e4d0171

commit: e4d0171

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 95b7d7cee0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

page_size: z.coerce.number().int().min(1).max(100).optional(),
status: sessionStatusSchema.optional(),
include_archive: booleanQueryParam,
exclude_empty: booleanQueryParam,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the protocol query schema in sync

This adds exclude_empty only to the server-local route schema, but packages/protocol/src/rest/session.ts still defines listSessionsQuerySchema/ListSessionsQuery with only status and include_archive. Any client or validation path that imports the protocol schema will silently strip the new flag and the generated TypeScript type will not expose it, so the newly documented API parameter is unusable through the shared protocol package; add the same boolean field and tests there as part of this change.

Useful? React with 👍 / 👎.

.listSessions({
workspaceId: w.id,
pageSize: SESSIONS_INITIAL_PAGE_SIZE,
excludeEmpty: true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Filter live-created empty sessions too

Passing excludeEmpty here only affects REST-loaded pages; while the web app is already connected, a different client can create a session and the global event.session.created path still prepends that empty session into rawState.sessions via reduceAppEvent, and the sidebar grouping does not re-filter by lastPrompt. In that multi-client scenario an unused “New Session” row immediately reappears until refresh, so the live event path needs the same empty-session policy or a follow-up fetch once session.meta.updated supplies a prompt.

Useful? React with 👍 / 👎.

Keep the shared protocol schema in sync with the server route so clients using the protocol type see the new parameter.
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d73002e18f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

z.object({
status: sessionStatusSchema.optional(),
include_archive: booleanQueryParam,
exclude_empty: booleanQueryParam,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid advertising exclude_empty on child lists

Adding this flag to listSessionsQuerySchema also changes listSessionChildrenQuerySchema because it aliases the same schema, but the /sessions/{id}/children route still parses only before/after/page_size/status and SessionService.listChildren never applies excludeEmpty. Clients generated from the protocol will think GET /children?exclude_empty=true is supported while the server still includes empty child sessions; split the schemas or pass/filter the option for child lists.

Useful? React with 👍 / 👎.

@@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not mark a removed slash command as patch

Line 5 says the web /sessions slash command is removed, but this changeset bumps @moonshot-ai/kimi-code as patch. The repo-level AGENTS.md classifies renamed or removed commands/arguments as major criteria requiring explicit confirmation before writing a major changeset; releasing this as a patch mislabels a breaking UI command removal. Please restore the command or handle the changeset as a confirmed breaking change.

Useful? React with 👍 / 👎.

listSessionChildrenQuerySchema aliased the main list schema, so it inherited exclude_empty even though the /sessions/{id}/children route does not filter by it. Split it so generated clients are not misled.
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: e4d0171a64

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@wbxl2000
wbxl2000 merged commit dfcfdfd into main Jun 28, 2026
9 checks passed
@wbxl2000
wbxl2000 deleted the feat/web-hide-empty-sessions branch June 28, 2026 05:38
@github-actions github-actions Bot mentioned this pull request Jun 28, 2026
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.

1 participant