Skip to content

fix(sessions): a compaction summary is not a human prompt - #2003

Open
Luckyou-d wants to merge 1 commit into
Tencent:mainfrom
Luckyou-d:fix/user-message-source
Open

Luckyou-d wants to merge 1 commit into
Tencent:mainfrom
Luckyou-d:fix/user-message-source

Conversation

@Luckyou-d

Copy link
Copy Markdown
Contributor

Problem

Claude writes the summary of a compacted conversation back into the transcript in the user role, marked isCompactSummary: true. isHumanPromptEntry filtered only isMeta and isSidechain:

if (entry.type !== 'user') return false;

if (entry.isMeta === true || entry.isSidechain === true) return false;

So every compaction entry counted as a turn the member took, and the prompt count - plus everything Team Improvement derives from it - ran ahead of what the person actually typed. That is the "summaries" half of #1989.

Change

TranscriptEntrySchema reads isCompactSummary, and isHumanPromptEntry skips an entry carrying it. An entry without the flag, or with it false, counts exactly as before.

Scope, honestly

#1989 lists four surfaces; this PR takes the one that is a plain defect with no conflicting expectation:

Surface Here
Claude Code isCompactSummary fixed
Claude Code injected heads that carry no isMeta (<system-reminder>, <task-notification>, interrupt marker) already filtered by TRANSCRIPT_SYSTEM_PREFIXES, so nothing to do
Claude Code slash-command markers (<command-message>, <command-name>, <command-args>) not changed on purpose: session-scoring.test.ts pins those as the member's first prompt ("prints the /name args the member typed as the first prompt, not the skill body it loads"), and a /name args line is typed input rather than injected context - worth a maintainer decision rather than a silent change here
Codex event_msg -> item_completed (item.type == "UserMessage") and Hermes display_kind / _compressed_summary not touched: separate parsers, no transcripts to verify against on this machine - they want their own PR with their own fixtures

Verification

  • New test in src/__tests__/dashboard-collector.test.ts: a type: user entry with isCompactSummary: true is not a human turn, while false and absent keep counting. It fails on main (expected true to be false) and passes here.
  • Whole file: 4 failed | 199 passed on main and 4 failed | 200 passed with the change - the same four, all Windows-environment failures that do not involve this code (sums the model steps..., reads a session of the Antigravity app..., logs the session as one unpriced request..., and the #!/bin/sh git stub of #1387).
  • npx tsc --noEmit clean; npm run lint reports the same 26 pre-existing teamai(family-facts) errors as main on this checkout, none in the two files.
  • No real-CLI record: npm run verify:world refuses on Windows (A world needs a POSIX shell; Windows is not supported. Say so in the PR instead.). This is a pure predicate on a parsed transcript line, covered by the unit above.

Refs #1989 (the Codex/Hermes halves and the slash-command decision are separate).

Claude writes the summary of a compacted conversation back into the transcript
in the user role, marked `isCompactSummary`. `isHumanPromptEntry` filtered only
`isMeta` and `isSidechain`, so every compaction entry counted as a turn the
member took: the prompt count, and everything derived from it in Team
Improvement, ran ahead of what the person actually typed (Tencent#1989).

Read the flag and skip those entries. An entry without it, or with it false,
keeps counting as before.
@github-actions

Copy link
Copy Markdown
  • [P1 blocking] Missing required real-CLI verification — PR description, “Verification”. This changes runtime behavior in src/dashboard-collector.ts:354, but the description explicitly records no real-CLI run. The trusted Code Review Rules require an end-to-end / real-CLI record for runtime changes; Windows unavailability does not waive that requirement. Record one representative run in a supported POSIX verify world before merge.

No other confident findings in the current diff.

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