Repository navigation
fix(sessions): preserve ambiguous legacy titles during upgrade - #1848
Conversation
3dc2522 to
de250f3
Compare
vastsa
left a comment
There was a problem hiding this comment.
Thanks for tracing the migration bug to the shared placeholder matcher and adding coverage for existing v24 databases. I found a user-data preservation case the migration currently changes: rename_session() records any user-selected title as manual, including a deliberate title such as New task. The v24→v25 migration selects every manual row and reclassifies any matching placeholder as default. After upgrade, derive_session_title() may then overwrite that explicit title on the next prompt. The current test uses only an ordinary manual title, so it does not cover this case. Please address this ambiguity conservatively and add a regression that manually renames a session to a placeholder and proves the upgrade cannot overwrite it. Thanks.
bb9b962 to
f6e4ee0
Compare
|
Thanks for the catch! Addressed conservatively:
|
vastsa
left a comment
There was a problem hiding this comment.
Thanks for addressing the manual-rename preservation case. I found a separate coverage gap: this changes only the historical v22→v23 migration, while current main is at schema v24 and runs that migration only for databases whose stored version is below 23. Users who already opened a build that applied v22→v23 keep the misclassified title_source = 'manual', so derive_session_title() continues to reject their placeholder sessions. The new migration test resets a fixture to v22; the manual-placeholder test starts from a current database and renames after migration, so neither covers an already-migrated v23/v24 database containing the bad row.
Please address the affected existing databases or narrow the fix's scope and explain that the already-migrated users remain affected. There is a real data-safety constraint here: rename_session() stores only the title and manual source, so a deliberate rename to New task is indistinguishable from a placeholder misclassified by the old migration. A repair must preserve that explicit rename. Until the existing-user path is resolved, this doesn't fully fix the reported root cause. Thanks!
f6e4ee0 to
a4654b9
Compare
vastsa
left a comment
There was a problem hiding this comment.
Thanks for narrowing the already-migrated database claim and preserving manual titles in v23/v24. I found one remaining data-safety ambiguity in the newly covered v22 path, plus a compile error in the added test. Please address both before landing.
Historical schema-v22 sessions lack provenance metadata to distinguish whether a stored title is an untouched placeholder or a deliberate manual rename to the same text. The v22 to v23 migration originally attempted a heuristic reclassification by matching title text, which was both case- sensitive and risked overwriting user-chosen titles on subsequent prompts. Removing the ambiguous heuristic UPDATE leaves all pre-existing v22 sessions with title_source = 'legacy', safely protecting deliberate renames from being overwritten by first-prompt title derivation or title plugins. Existing v23/v24 databases and newly created sessions retain their standard behavior. A regression test verifies that historical v22 titles (including deliberate renames to lowercase 'new task') remain 'legacy' and refuse automatic derivation, while new sessions created after upgrade correctly receive 'default' and derive titles normally.
a4654b9 to
ce10ef2
Compare
What
Historical schema-v22 sessions lack provenance metadata to distinguish whether a stored title was an untouched placeholder or a deliberate user rename to that same text (e.g.
new task). The v22→v23 migration originally attempted a heuristic reclassification by matching title strings, which was case-sensitive and risked overwriting user-chosen titles on subsequent prompts.Fix
legacy(the column's default), keeping migration impact minimal and safely protecting deliberate renames from being overwritten by first-prompt title derivation or title plugins.default(for placeholders) ormanual(for user titles), preserving normal title derivation and plugin workflows.Tests
v22_database_migrates_session_title_sources_without_losing_titlessets up a v22 database, reproduces a deliberate v22 title-only rename to lowercasenew task, runs the real migration, and verifies:title_source = 'legacy'and their exact title strings are preserved.derive_session_title) refuses to overwrite the renamed session.set_automatic_session_title) refuse to overwrite legacy sessions.defaultand derive titles normally.cargo test -p host-core.docs/spec/03-runtime/04-data-storage.md,06-delivery/04-e2e-test-plan.md, and the zh-CN mirror.