Skip to content

fix(cline-cli): gate the rollup fallback on metrics presence, not emitted calls - #895

Closed
ozymandiashh wants to merge 1 commit into
getagentseal:mainfrom
ozymandiashh:fix/894-cline-cli-rollup-gate
Closed

fix(cline-cli): gate the rollup fallback on metrics presence, not emitted calls#895
ozymandiashh wants to merge 1 commit into
getagentseal:mainfrom
ozymandiashh:fix/894-cline-cli-rollup-gate

Conversation

@ozymandiashh

Copy link
Copy Markdown
Collaborator

Closes #894 with exactly the shape the issue prescribes: hadMetrics set before the dedup check gates the rollup, and the now-consumerless emitted counter is gone.

Mutation check done as requested: the new duplicate-session_id test (rollup on the second-visited directory, which is the layout that distinguishes the two gates) fails against the old emitted-based gate with 1 failed / 33 passed, and passes post-fix at 34/34. The fixture gained a sessionIdInMeta override so a test can model a copied session directory without renaming it on disk.

tsc --noEmit clean, no new dependencies. Built with the same review flow as #891: verified locally since CI does not run the suite.

…tted calls

The rollup fallback fired whenever no call was yielded, but the shared
seenKeys dedup runs before the emit, so a session directory whose internal
session_id collides with an already-parsed one (a copied session dir) had
every per-message call suppressed and then resurrected the same spend a
second time through metadata.usage as <id>:rollup.

Track whether any message carried metrics before the dedup check and gate
the rollup on that instead; the emitted counter had no other consumer and
is removed. The new test writes the duplicate-session_id layout with the
rollup on the second-visited directory and fails against the old gate
(verified: 1 failed / 33 passed pre-fix, 34 passed post-fix).

Closes getagentseal#894
@iamtoruk

iamtoruk commented Aug 4, 2026

Copy link
Copy Markdown
Member

Thanks for this, and sorry for the collision. I filed #894 and then landed the same fix in #896 (merged) a few minutes before this came in, so #894 is already closed with exactly this shape: hadMetrics set before the dedup check, the emitted counter removed, and the duplicate-session_id regression test mutation-checked against the old gate.

Closing as a duplicate, no reflection on the work, our two fixes are the same. One thing yours does nicer: the sessionIdInMeta fixture override to model a copied session directory without renaming it on disk is cleaner than the two-dirs-by-hand approach that landed. If you want to send that fixture improvement on its own, I would take it.

@iamtoruk iamtoruk closed this Aug 4, 2026
@ozymandiashh
ozymandiashh deleted the fix/894-cline-cli-rollup-gate branch August 4, 2026 00:04
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.

cline-cli: rollup fallback double-counts a session whose per-message calls were all deduped

2 participants