Skip to content

fix(session-ingest): treat creation default title as placeholder for agent-generated titles - #4999

Merged
eshurakov merged 1 commit into
mainfrom
fix/session-ingest-default-title-placeholder
Aug 4, 2026
Merged

fix(session-ingest): treat creation default title as placeholder for agent-generated titles#4999
eshurakov merged 1 commit into
mainfrom
fix/session-ingest-default-title-placeholder

Conversation

@eshurakov

Copy link
Copy Markdown
Contributor

Problem

#4852 stopped agent-generated titles from clobbering user renames by only promoting the title away from the creation placeholder, which it assumed was always title IS NULL. That assumption is wrong for cloud-agent-next: session-registration.ts stamps every new row with a default title (New session - <ISO timestamp>) via createSessionForCloudAgent, so the row is never NULL and the auto-generated title arriving through the ingest pipeline (applyMetadataChanges) is always dropped with Skipping agent-generated title write; title is no longer the placeholder. Cloud Agent sessions keep their New session - ... title forever unless the user manually renames them.

Fix

The correct placeholder definition already existed in this service: POST /session/:sessionId/title treats both NULL and the CLI default-title pattern (New session - ... / Child session - ..., duplicated from kilocode's isDefaultTitle) as the placeholder, with a CAS at write time.

  • Extract DEFAULT_SESSION_TITLE_PATTERN / isDefaultSessionTitle from routes/api.ts into ingest/default-session-title.ts (no behavior change there).
  • applyMetadataChanges now gates the agent-generated title write on isDefaultSessionTitle(currentRow.title) instead of currentRow.title === null. User-renamed titles and earlier agent-generated titles are still never overwritten; the rest of the metadata batch is unaffected.

Tests

  • metadata.test.ts: new case — agent-generated title is applied over the default title stamped at creation (the cloud-agent-next shape). Existing cases (NULL placeholder applied, user-renamed skipped, rest-of-batch still applied) unchanged.
  • The extracted helper remains covered by the existing POST /session/:sessionId/title tests in api.test.ts (NULL, default-pattern, and user-title cases).

Verification

Not run locally (per request); relying on CI.

…agent-generated titles

PR #4852 gated agent-generated title writes on `title IS NULL`, but
cloud-agent-next creates cli_sessions_v2 rows with a non-null default
title (`New session - <ISO timestamp>` via createSessionForCloudAgent),
so the auto-generated title from the ingest pipeline was always dropped
for those sessions.

Reuse the existing isDefaultSessionTitle semantics (NULL or the CLI
default-title pattern) already used by POST /session/:sessionId/title,
extracted into a shared module, so applyMetadataChanges promotes the
title away from either placeholder form while still never overwriting a
user-chosen title.

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
@kilo-code-bot

kilo-code-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Reviewed the session-ingest placeholder-title fix with high confidence: the extracted isDefaultSessionTitle helper is a verbatim move from api.ts, the new gate in applyMetadataChanges runs inside the row-locked transaction (no rename race), all default-title creation sites match the regex shape, and the new test covers the cloud-agent-next creation shape while existing placeholder/rename cases remain intact.

Files Reviewed (4 files)
  • services/session-ingest/src/ingest/default-session-title.ts
  • services/session-ingest/src/ingest/metadata.ts
  • services/session-ingest/src/ingest/metadata.test.ts
  • services/session-ingest/src/routes/api.ts

Reviewed by kimi-k3 · Input: 51.1K · Output: 12.1K · Cached: 739.9K

Review guidance: REVIEW.md from base branch main

@eshurakov
eshurakov merged commit 4816807 into main Aug 4, 2026
16 checks passed
@eshurakov
eshurakov deleted the fix/session-ingest-default-title-placeholder branch August 4, 2026 11:36
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