Skip to content

[Feature] Add session renaming functionality and improve session metadata - #814

Merged
will-lamerton merged 11 commits into
Nano-Collective:mainfrom
arpan7sarkar:feat/rename-sessions
Aug 11, 2026
Merged

will-lamerton merged 11 commits into
Nano-Collective:mainfrom
arpan7sarkar:feat/rename-sessions

Conversation

@arpan7sarkar

Copy link
Copy Markdown
Contributor

Description

Fixes #749

rename-chat.mp4

Improve session management & history UX in the VS Code extension.

  • Session renaming: Sessions can now be renamed directly from the History view via a renameSession ACP extension method (extMethod) on the CLI's ACP agent, backed by the session manager — no full resume required.
  • History view navigation: Creating a new chat (+) or resuming a session from the History list now returns to the active chat view instead of leaving the panel stuck on the session list.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changeset

  • Added a changeset (pnpm changeset) describing this change for the changelog

Docs-only or internal chores need no changeset (or run pnpm changeset --empty to note that intentionally).

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging

- Implemented a new method to rename sessions in the ACP client and updated the corresponding webview provider to handle rename requests.
- Enhanced session data structure to include an `updatedAt` timestamp for better session management.
- Modified the chat panel to display relative time for the last session update.
- Updated session management logic to prevent auto-derived titles from overwriting user-defined titles.
- Added UI elements for editing session titles in the chat panel, including input handling for renaming sessions.
Copilot AI lite review requested due to automatic review settings August 7, 2026 10:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@arpan7sarkar

Copy link
Copy Markdown
Contributor Author

Hey @Avtrkrb , @akramcodez , @will-lamerton do check this out its all done :-)

@will-lamerton

Copy link
Copy Markdown
Member

Hey @arpan7sarkar - thanks for this, the extMethod approach is the right call and the titleManuallySet threading is clean. A few things before merge:

Blocking: case 'renameSession' in chat-webview-provider.ts is missing its break;, so it falls through into requestPathInfo. That's not just cosmetic - npx tsc --noEmit -p plugins/vscode/tsconfig.json fails with three new TS2339: Property 'path' does not exist errors that aren't on main, and at runtime every rename hits fs.statSync(undefined) and gets swallowed by the bare catch {}. (Worth knowing: test:all doesn't cover the plugin and build:ext is esbuild with no type checking, so CI can't catch this today.)

Please also fix: updatedAt maps to lastAccessedAt, which is only ever written by createSession and loadSession. Autosave never bumps it, so the new "Today / Yesterday / Last 7 Days" buckets and the "5m ago" label show created-or-resumed time, not last activity. A session created three days ago and chatted in a minute ago renders as "3d ago". Either bump lastAccessedAt on autosave or add a real updatedAt field.

Two smaller ones:

  • The checklist says tests were added but the diff has none. session-manager.spec.ts and acp-agent.spec.ts already exist, and renameSession (empty title, over-length, missing session, flag round-trip) plus extMethod (unknown method, non-string params) would be easy to cover there.
  • The comment at useSessionAutosave.ts:153 says /rename in the CLI sets this flag. It doesn't - onRenameSession is wired to setSessionName, which is display-only state for the status line and never reaches disk. Either wire it through sessionManager.renameSession or reword the comment.

Nice-to-haves, not blockers: input.maxLength = 100 so an over-length title fails locally instead of round-tripping to an error toast, and sorting within date groups by updatedAt rather than reversed creation order.

Thanks :)

…estPathInfo and crashing on fs.statSync(undefined))

- bump lastAccessedAt in saveSession() so "last used" reflects actual
  activity, not just create/resume time
- add tests for renameSession and extMethod
- reword stale comment about CLI /rename setting titleManuallySet
- add maxLength=100 to rename input, sort session groups by updatedAt
…ng into tests

- revert saveSession() to trust the caller's lastAccessedAt again;
  it was overwriting explicit values, which broke resolve-session tests
  that backdate a session to simulate an older one
- bump lastAccessedAt only where it should count as activity:
  renameSession() and the autosave update path
- chdir acp-agent.spec.ts and model-selector.spec.tsx into an isolated
  temp dir so a local agents.config.json can't leak providers into tests
- add tests: saveSession trusts explicit lastAccessedAt, renameSession
  bumps it, autosave bumps it
… dependency in this repo, already the established pattern in 5+ other spec files (streaming-reasoning.spec.tsx etc.). Verified it passes both with and without FORCE_COLOR set.
- styled-select-input.spec.tsx: strip ANSI codes before matching output.
  CI sets FORCE_COLOR=1, so Ink renders real color codes and the "> "
  indicator regex no longer matches the start of the line
- user-input.spec.tsx: add missing unmount() to 18 tests that rendered
  and never tore down. AVA runs a file's tests concurrently, so these
  piled up and starved later tests under CI's more limited CPU
@arpan7sarkar

Copy link
Copy Markdown
Contributor Author

Hey @willlamerton, added all the changes you asked for.

While testing I also ran into two test bugs in this repo, unrelated to this PR, that were failing CI runs for others too. Fixed both:

  1. styled-select-input.spec.tsx was failing in CI only. CI sets FORCE_COLOR=1, so Ink prints real color codes around the text, and the test's regex expects plain text starting with >. Fixed by stripping ANSI codes before checking, same as a few other test files already do.
  2. user-input.spec.tsx had 18 tests that rendered a component and never unmounted it. Since tests in the same file run at the same time, all those leftover components kept running in the background for the rest of the file, which can slow things down enough to time out later tests on a busy CI runner. Added the missing cleanup to all 18.

Both are pre-existing on main, not caused by this PR, just happened to show up while I was testing this branch. Can you take a look?

@will-lamerton

Copy link
Copy Markdown
Member

Great work @arpan7sarkar :)

@will-lamerton
will-lamerton merged commit d5ca3d6 into Nano-Collective:main Aug 11, 2026
10 checks passed
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.

[Feature] Chat Session Management Polish in VS Code Extension

3 participants