Skip to content

fix(client-runtime): Gemini answers no longer fold away behind task-cleanup notes - #49689

Open
andredubbs wants to merge 1 commit into
pingdotgg:mainfrom
andredubbs:andy/gemini-fold-cleanup-notes
Open

andredubbs wants to merge 1 commit into
pingdotgg:mainfrom
andredubbs:andy/gemini-fold-cleanup-notes

Conversation

@andredubbs

Copy link
Copy Markdown

Problem

On Antigravity (Gemini) threads, the main answer of a turn often folds into the tool-call dropdown and only a short cleanup note stays visible. It happens when Gemini answers while a background task is still running, then kills the task with manage_task and writes a note like "I stopped the leftover task (task-464)…". Expected behavior: the answer stays visible above the fold, the way it does for other providers' trailing sign-offs.

Two things in turnFoldReplies.ts cause it:

  1. Antigravity stores tool names as display titles, e.g. "Run manage_task" (~11k of ~11.1k manage_task calls in my local history). HOUSEKEEPING_TOOL_RE only accepts the name after start-of-string or ._:/-, so the space means the kill is never recognized as housekeeping, and the existing sign-off rescue never fires, even for short notes. QUESTION_TOOL_RE and INTERACTIVE_PAUSE_TOOL_RE miss "Run ask_question" the same way.
  2. Gemini's post-kill notes are often 300-750 characters, over the 260-character isThinReply cap.

Change

  • Accept whitespace as a tool-name separator in the three tool matchers.
  • Let a plain note (no headings, code, or tables) of up to 900 characters count as a sign-off, but only when housekeeping tools sit between it and the answer. Thin replies keep their existing behavior, and the 1.5x length ratio still applies.

Scope

Small fix for a visible bug: the reply a user needs is hidden behind the dropdown. It touches only the shared fold-selection logic in packages/client-runtime, so web and mobile both get it. Related but separate: #39450 and #25599 are about Antigravity background tasks staying in RUNNING, not about which reply stays visible.

Verification

  • Replayed 389 multi-reply Antigravity runs (Dec 1-5) from a local copy of my statev2.sqlite through the old and new selectRetainedTurnFoldAssistantIds. 10 runs now keep their answer visible (answers of 2.6k-7.3k chars behind cleanup notes of 104-734 chars, e.g. a 4,000-char answer behind a 734-char "Final live verification receipt…" note). 0 runs hide a reply they showed before.
  • Added cases to the existing turnFoldReplies.test.ts: a display-titled Run manage_task kill followed by a short and a ~600-char plain note keeps the answer; a long note with no cleanup before it, or a note with a heading, does not. The first case fails on main and passes with the change.
  • Not checked: I did not run it in a live client, so there are no before/after screenshots. The worktree could not install dependencies locally, so I could not run vp run check:changed; the test file runs green, and the type check reported no errors in the changed files.

…leanup notes

Antigravity stores tool names as display titles ("Run manage_task"), so the
housekeeping and question matchers never matched them: the space before the
name wasn't an accepted separator. Gemini also writes 300-750 character notes
after killing a leftover background task, which the 260-character sign-off cap
rejected. Either way the real answer collapsed into the tool dropdown and only
the cleanup note stayed visible.

Accept whitespace as a tool-name separator, and let a plain note of up to 900
characters count as a sign-off when housekeeping tools sit between it and the
answer.

Verification: replayed 389 multi-reply Antigravity runs (Dec 1-5) from a local
statev2 copy through the old and new rules: 10 runs now keep their answer
visible (answers of 2.6k-7.3k chars behind 104-734 char cleanup notes), 0 runs
hide a reply they showed before. The new test fails on the old code.
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Dec 6, 2026
@macroscopeapp

macroscopeapp Bot commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 09743fe

Macroscope's review found this PR approvable — Keeps substantive answers visible when task-cleanup notes follow them, including tools identified by display titles. The change is limited to conversation presentation and does not alter stored messages or tool execution.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The reply-folding logic now recognizes whitespace-separated housekeeping tool names and can retain eligible plain-text terminal replies as sign-offs. Tests cover cleanup notes with and without a task-kill entry, including notes with a receipt title.

Changes: Reply folding

Layer / File(s) Summary
Housekeeping sign-off selection
packages/client-runtime/src/turnFoldReplies.ts, packages/client-runtime/src/turnFoldReplies.test.ts
Tool-name patterns accept whitespace separators. Terminal replies over 900 characters or with rich structure are excluded from sign-off processing. Other non-thin replies qualify only after a housekeeping tool. Tests cover cleanup-note cases.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • pingdotgg/t3code#47146: Changes the same reply-selection logic for retaining an answer before a short sign-off after housekeeping tools.
  • pingdotgg/t3code#29859: Addresses the same hidden-answer symptom through a different mechanism.

Suggested labels: bugfix

Suggested reviewers: t3dotgg, macroscopeapp

Merge Risk: Minimal · up to 09743

This change makes Gemini answers less likely to be hidden in the tool-call dropdown when a cleanup note follows. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Gemini answers were folded behind task-cleanup notes, and the fix is in client-runtime fold logic. It follows the conventional commit format and is specific enough for…
Description check Passed The description follows the template well. It has Problem, Change, Scope, and Verification sections. The problem and cause are explained with reproduction context. The change is described. The scope l…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: Gemini answers were folded behind task-cleanup notes, and the fix is in client-runtime fold logic. It follows the conventional commit format and is specific enough for a reviewer scanning history.

Full details: Description check

Explanation

The description follows the template well. It has Problem, Change, Scope, and Verification sections. The problem and cause are explained with reproduction context. The change is described. The scope links related issues and justifies why no issue is linked for the fix. Verification gives replay counts, added tests, and states what was not checked, including the missing live-client test and the failed check:changed run. The template's agent-model footer is absent, and no screenshots are included, but the author states there is no live UI check, so the gap is non-critical.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between deb56a0 and 09743fe.

Files selected for processing: 2

  • packages/client-runtime/src/turnFoldReplies.test.ts
  • packages/client-runtime/src/turnFoldReplies.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant