fix(claude): keep ide context out of session titles - #1252
Conversation
roborev: Combined Review (
|
mjacobs
left a comment
There was a problem hiding this comment.
Thanks! The standalone-tag classification and the linear/incremental coverage
look good. The DAG branch-selection issue called out above still needs
addressing though: countUserTurns counts IDE-context user records before
they are classified as promoted system metadata, so enough of them can change
the fork heuristic. Please exclude those records from branch-turn counting and
add a UUID/DAG fork regression.
Two version-number requests as well:
1. Please leave DuckDB SchemaVersion at 5.
This PR does not change the mirror schema. A push already rebuilds when the
mirror's recorded agentsview_source_data_version differs from
db.CurrentDataVersion(). The reparse resync also creates a new SQLite
database_id, which independently forces a full rebuild on the next push.
Raising SchemaVersion has an additional effect: a new binary refuses to serve
existing v5 mirrors until their owner pushes again. Without the bump, the mirror
remains usable—with stale titles—until that push. For this metadata/title
correction, the latter is the better tradeoff and matches the mirror's normal
stale-until-next-push behavior.
AGENTS.md currently instructs authors to bump SchemaVersion for source
data-version changes, so you followed the repository guidance correctly. We
are going to narrow that policy so SchemaVersion tracks mirror-shape changes,
while source data-version changes use the existing push-time rebuild gate. I
will handle that documentation change separately; no AGENTS.md change is
needed in this PR.
2. Use dataVersion 71 on the current base.
Data versions are assigned in merge order rather than reserved for in-flight
PRs. If #1166 lands first, this PR rebases and moves to 72; if this PR lands
first, #1166 does that. A gap would be mechanically harmless because the
migration logic is monotonic, but I'd guide away from reserving numbers for
unmerged work.
abd35dd to
11dcec6
Compare
|
Addressed the requested changes in
The focused parser and DB regressions pass, and |
roborev: Combined Review (
|
|
Addressed the incremental-sync edge case in c812905e. Claude sessions with an empty stored preview now fall back to a full parse even when Validation:
|
roborev: Combined Review (
|
c812905 to
0080af1
Compare
|
@mjacobs, this is rebased onto current |
roborev: Combined Review (
|
The empty-preview fallback forced a full parse on every append while a Claude session had no real user prompt yet. A session file created by resume or auto-compact starts with a promoted continuation record and can stream assistant work for hours before the next prompt, so each watcher event re-parsed the whole growing transcript. Parse the appended chunk first and fall back to a full parse only when the chunk carries a message that can become first_message: role user, not system-injected, non-empty, and not a preview-skipped slash command (IsSkippablePreviewCommand, now exported from the parser). All other appends stay on the incremental path so per-event work remains bounded by the appended bytes rather than the transcript size.
0080af1 to
5308806
Compare
roborev: Combined Review (
|
|
Both findings from the latest review are addressed on the branch: 2759a93 parses appended Claude deltas before falling back only for the first eligible prompt (with incremental-only continuation/IDE/command regressions), and 5308806 preprocesses reminder-prefixed user text before DAG turn classification. I validated the exact current head with |
|
thanks! I'm just waiting on the CI tests that are still running. |
The VS Code extension often prepends a <ide_opened_file> or <ide_selection> wrapper directly onto a real prompt in the same user entry. PR kenn-io#1252 promoted standalone envelopes to hidden system metadata, but this mixed case (envelope + real prompt in one message) falls outside that strict standalone match by design, so the raw markup stayed in first_message and the visible transcript. Split a leading IDE-context envelope off from the rest of the message: the envelope becomes its own hidden system-metadata message (same ide_opened_file/ide_selection subtype as the standalone case), and the remaining real prompt becomes an ordinary user message. first_message and user turn counts are computed from the same firstMessageAndUserCount pass used before, so they now derive from the real prompt only. Bumps the parser data version to 75 so existing rows re-parse.
The VS Code extension often prepends a <ide_opened_file> or <ide_selection> wrapper directly onto a real prompt in the same user entry. PR kenn-io#1252 promoted standalone envelopes to hidden system metadata, but this mixed case (envelope + real prompt in one message) falls outside that strict standalone match by design, so the raw markup stayed in first_message and the visible transcript. Split a leading IDE-context envelope off from the rest of the message: the envelope becomes its own hidden system-metadata message (same ide_opened_file/ide_selection subtype as the standalone case), and the remaining real prompt becomes an ordinary user message. first_message and user turn counts are computed from the same firstMessageAndUserCount pass used before, so they now derive from the real prompt only. Bumps the parser data version to 75 so existing rows re-parse.
the claude code vscode extension writes file-open and selection hints as standalone user-role xml envelopes. agentsview currently treats them as operator prompts, so they can become sidebar titles, count as user turns, and render raw markup.
complete standalone
ide_opened_fileandide_selectionenvelopes now promote to hidden system metadata with distinct subtypes. the match is intentionally strict, so malformed wrappers and messages with real prompt text remain ordinary user content.dag fork selection applies the same user-text preprocessing before counting turns, so reminder-prefixed ide context cannot promote an obsolete branch. incremental sync keeps promptless ide and continuation appends bounded to the new bytes, falling back to a full parse only when the first title-eligible prompt arrives.
the source data version advances to 74 because main now uses 73 for opencode bash exit-failure detection. existing sqlite archives are reparsed on upgrade, and duckdb mirrors rebuild on their next push through the independent source data-version gate; the mirror schema is unchanged.
closes #1238