Skip to content

feat: add session_title_generated event emission to CLI - #4590

Merged
iscekic merged 5 commits into
mainfrom
feat/session-title-generated-event
Dec 22, 2025
Merged

feat: add session_title_generated event emission to CLI#4590
iscekic merged 5 commits into
mainfrom
feat/session-title-generated-event

Conversation

@kilo-code-bot

@kilo-code-bot kilo-code-bot Bot commented Dec 19, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR adds the session_title_generated event emission to the CLI, similar to how session_created and session_synced are currently emitted.

Changes

  1. Added event type definitions for SessionTitleGeneratedMessage with sessionId, title, and timestamp fields in:

  2. Updated SessionTitleService to emit the session_title_generated event after successfully updating the session title in the updateTitle method

  3. Added SessionTitleGeneratedStreamEvent to CliOutputParser.ts for parsing the event from CLI output

  4. Wired up communication between the CLI and extension to forward this event:

  5. Added tests for the new event type:

Behavior

This event is emitted when the session title is generated, which typically happens after a session is created. The event includes:

  • sessionId: The ID of the session
  • title: The generated title
  • timestamp: Unix timestamp when the event was emitted
  • event: The event type (session_title_generated)

Testing

Added comprehensive tests for:

  • Parsing the event from CLI output (with and without timestamp)
  • Emitting the event from SessionTitleService
  • Proper callback invocation with correct parameters

- Add SessionTitleGeneratedMessage type definition with sessionId, title, and timestamp fields
- Update SessionTitleService to emit session_title_generated event after successfully updating session title
- Add SessionTitleGeneratedStreamEvent to CliOutputParser for parsing the event from CLI output
- Wire up communication between CLI and extension to forward the event
- Add tests for parsing and emitting the new event type

This event is emitted when a session title is generated, which typically happens after a session is created.
@changeset-bot

changeset-bot Bot commented Dec 19, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9eb185a

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

This PR includes changesets to release 2 packages
Name Type
kilo-code Patch
@kilocode/cli 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

@kilo-code-bot kilo-code-bot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

⚠️ 2 Issues Found

Severity Issue Location
WARNING Duplicate type definition for SessionTitleGeneratedMessage SessionSyncService.ts:35-42
SUGGESTION Unused dependency onSessionTitleGenerated in SessionSyncService SessionSyncService.ts:65

Recommendation: Address the duplicate type definition to improve maintainability.

Review Details (8 files)

Files:

  • cli/src/cli.ts - ✅ Clean
  • src/core/kilocode/agent-manager/CliOutputParser.ts - ✅ Clean
  • src/core/kilocode/agent-manager/__tests__/CliOutputParser.spec.ts - ✅ Clean
  • src/shared/kilocode/cli-sessions/core/SessionManager.ts - ✅ Clean
  • src/shared/kilocode/cli-sessions/core/SessionSyncService.ts (2 issues)
  • src/shared/kilocode/cli-sessions/core/SessionTitleService.ts - ✅ Clean
  • src/shared/kilocode/cli-sessions/core/__tests__/SessionTitleService.spec.ts - ✅ Clean
  • src/shared/kilocode/cli-sessions/extension/session-manager-utils.ts - ✅ Clean

Checked: Security, bugs, performance, error handling, code duplication

Overall: The implementation is well-structured and follows existing patterns. The event emission logic is correctly placed in SessionTitleService. Tests are comprehensive. The only issues are related to code organization (duplicate type definition and unused dependency).

Fix these issues in Kilo Cloud

Comment thread src/shared/kilocode/cli-sessions/core/SessionSyncService.ts Outdated
Comment thread src/shared/kilocode/cli-sessions/core/SessionSyncService.ts Outdated
…d dependency

- Remove duplicate SessionTitleGeneratedMessage type from SessionSyncService
- Import SessionTitleGeneratedMessage from SessionTitleService instead
- Remove unused onSessionTitleGenerated dependency from SessionSyncService
- Update SessionManager imports to reflect the changes
- Add changeset for the PR

@kilo-code-bot kilo-code-bot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ Previous Issues Addressed

The following issues from my previous review have been resolved:

  • Duplicate type definition: SessionTitleGeneratedMessage is now defined only in SessionTitleService.ts and imported where needed
  • Unused dependency: onSessionTitleGenerated was removed from SessionSyncServiceDependencies interface

No new issues found in the latest changes.

Review Details (9 files)

Files:

  • .changeset/session-title-generated-event.md - ✅ Clean
  • cli/src/cli.ts - ✅ Clean
  • src/core/kilocode/agent-manager/CliOutputParser.ts - ✅ Clean
  • src/core/kilocode/agent-manager/__tests__/CliOutputParser.spec.ts - ✅ Clean
  • src/shared/kilocode/cli-sessions/core/SessionManager.ts - ✅ Clean
  • src/shared/kilocode/cli-sessions/core/SessionSyncService.ts - ✅ Clean (issues fixed)
  • src/shared/kilocode/cli-sessions/core/SessionTitleService.ts - ✅ Clean
  • src/shared/kilocode/cli-sessions/core/__tests__/SessionTitleService.spec.ts - ✅ Clean
  • src/shared/kilocode/cli-sessions/extension/session-manager-utils.ts - ✅ Clean

Checked: Security, bugs, performance, error handling, code duplication, type consistency

Overall: The implementation is well-structured and follows existing patterns for event emission. Tests are comprehensive.

@iscekic iscekic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Needs to fix the cli tests

@kilo-code-bot kilo-code-bot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ No New Critical Issues

1 file reviewed with 1 minor suggestion | Confidence: 90% | Recommendation: Merge after addressing human reviewer feedback

Severity Issue Location
SUGGESTION Unused import SessionSyncService.ts:7
Review Details (10 files)

Files:

  • .changeset/session-title-generated-event.md - ✅ Changeset (skipped)
  • cli/src/cli.ts - ✅ Clean
  • src/core/kilocode/agent-manager/CliOutputParser.ts - ✅ Clean
  • src/core/kilocode/agent-manager/__tests__/CliOutputParser.spec.ts - ✅ Clean (test file)
  • src/shared/kilocode/cli-sessions/core/SessionManager.ts - ✅ Clean
  • src/shared/kilocode/cli-sessions/core/SessionSyncService.ts - 1 suggestion
  • src/shared/kilocode/cli-sessions/core/SessionTitleService.ts - ✅ Clean
  • src/shared/kilocode/cli-sessions/core/__tests__/SessionManager.spec.ts - ✅ Clean (test file)
  • src/shared/kilocode/cli-sessions/core/__tests__/SessionTitleService.spec.ts - ✅ Clean (test file)
  • src/shared/kilocode/cli-sessions/extension/session-manager-utils.ts - ✅ Clean

Checked: Security, bugs, performance, error handling, unused code

Previous Issues: The duplicate type definition and unused dependency issues from the previous review have been resolved.

Note: Human reviewer @iscekic mentioned "Needs to fix the cli tests" - please ensure CI tests pass before merging.

@kilo-code-bot kilo-code-bot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ No New Critical Issues

1 file reviewed with 1 minor suggestion | Confidence: 90% | Recommendation: Merge after addressing human reviewer feedback

Severity Issue Location
SUGGESTION Unused import SessionSyncService.ts:7
Review Details (10 files)

Files:

  • .changeset/session-title-generated-event.md - ✅ Changeset (skipped)
  • cli/src/cli.ts - ✅ Clean
  • src/core/kilocode/agent-manager/CliOutputParser.ts - ✅ Clean
  • src/core/kilocode/agent-manager/__tests__/CliOutputParser.spec.ts - ✅ Clean (test file)
  • src/shared/kilocode/cli-sessions/core/SessionManager.ts - ✅ Clean
  • src/shared/kilocode/cli-sessions/core/SessionSyncService.ts - 1 suggestion
  • src/shared/kilocode/cli-sessions/core/SessionTitleService.ts - ✅ Clean
  • src/shared/kilocode/cli-sessions/core/__tests__/SessionManager.spec.ts - ✅ Clean (test file)
  • src/shared/kilocode/cli-sessions/core/__tests__/SessionTitleService.spec.ts - ✅ Clean (test file)
  • src/shared/kilocode/cli-sessions/extension/session-manager-utils.ts - ✅ Clean

Checked: Security, bugs, performance, error handling, unused code

Previous Issues: The duplicate type definition and unused dependency issues from the previous review have been resolved.

Note: Human reviewer @iscekic mentioned "Needs to fix the cli tests" - please ensure CI tests pass before merging.

Comment thread src/shared/kilocode/cli-sessions/core/SessionSyncService.ts Outdated
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
@iscekic
iscekic requested review from iscekic, marius-kilocode and pandemicsyn and removed request for iscekic December 19, 2025 21:38

@kilo-code-bot kilo-code-bot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ No New Issues Found

9 files reviewed | Confidence: 92% | Recommendation: Merge after CI passes

Review Details

Files:

  • .changeset/session-title-generated-event.md - ✅ Changeset (skipped)
  • cli/src/cli.ts - ✅ Clean
  • src/core/kilocode/agent-manager/CliOutputParser.ts - ✅ Clean
  • src/core/kilocode/agent-manager/__tests__/CliOutputParser.spec.ts - ✅ Clean (test file)
  • src/shared/kilocode/cli-sessions/core/SessionManager.ts - ✅ Clean
  • src/shared/kilocode/cli-sessions/core/SessionTitleService.ts - ✅ Clean
  • src/shared/kilocode/cli-sessions/core/__tests__/SessionManager.spec.ts - ✅ Clean (test file)
  • src/shared/kilocode/cli-sessions/core/__tests__/SessionTitleService.spec.ts - ✅ Clean (test file)
  • src/shared/kilocode/cli-sessions/extension/session-manager-utils.ts - ✅ Clean

Checked: Security, bugs, performance, error handling, type consistency

Implementation Quality:

  • Type definition (SessionTitleGeneratedMessage) is properly centralized in SessionTitleService.ts
  • Event emission follows established patterns for session_created and session_synced
  • Parser correctly handles both with and without timestamp
  • Tests are comprehensive

Previous Issues: All resolved (comments now outdated)

Note: Human reviewer @iscekic mentioned "Needs to fix the cli tests" - please ensure CI tests pass before merging.

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.

2 participants